]> git.sesse.net Git - vlc/commitdiff
commandline parsing: Fix the macfreetv crash
authorDerk-Jan Hartman <hartman@videolan.org>
Sun, 21 Sep 2008 15:43:25 +0000 (17:43 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Sun, 21 Sep 2008 18:39:49 +0000 (20:39 +0200)
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...

src/config/cmdline.c

index ad5f2ca4e8d1a0da1390f18746a162dc8e043a63..8de2e2224d8ff15e87b9acdc2150862caad27e45 100644 (file)
@@ -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: