[vlc-devel] commit: commandline parsing: Fix the macfreetv crash (Derk-Jan Hartman )

git version control git at videolan.org
Mon Sep 22 16:02:53 CEST 2008


vlc | branch: 0.9-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Sun Sep 21 17:43:25 2008 +0200| [3f756590c72af575837c71b6983cb904ac259d6e] | 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...
(cherry picked from commit 687c86594fa47ce21b2c838b05c5b078fb51a288)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f756590c72af575837c71b6983cb904ac259d6e
---

 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 7860e42..961b2a3 100644
--- a/src/config/cmdline.c
+++ b/src/config/cmdline.c
@@ -283,6 +283,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