[vlc-devel] commit: commandline parsing: Fix the macfreetv crash (Derk-Jan Hartman )
git version control
git at videolan.org
Sun Sep 21 20:36:19 CEST 2008
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Sun Sep 21 17:43:25 2008 +0200| [687c86594fa47ce21b2c838b05c5b078fb51a288] | committer: Derk-Jan Hartman
commandline parsing: Fix the macfreetv crash
Basically, somewhat of a "duh" now that we have optional_arguments on OSX.
It is highly annoying however that getopt_long behaviour differs so much
between gnu and BSD implementations, and then is even BUGGY on darwin.
'--option=value' is uniformly supported and '--option value' is a GNU getopt thing.
imperfect world etc...
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=687c86594fa47ce21b2c838b05c5b078fb51a288
---
src/config/cmdline.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/config/cmdline.c b/src/config/cmdline.c
index ad5f2ca..8de2e22 100644
--- a/src/config/cmdline.c
+++ b/src/config/cmdline.c
@@ -274,6 +274,14 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc,
psz_name = p_conf->psz_name;
}
+ if( p_conf->i_type != CONFIG_ITEM_BOOL && !optarg )
+ {
+ fprintf( stderr, "Warning: missing argument for option --%s\n", p_conf->psz_name );
+ fprintf( stderr, "Try specifying options as '--optionname=value' instead of '--optionname value'\n" );
+ continue;
+ }
+
+
switch( p_conf->i_type )
{
case CONFIG_ITEM_STRING:
More information about the vlc-devel
mailing list