From 687c86594fa47ce21b2c838b05c5b078fb51a288 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Sun, 21 Sep 2008 17:43:25 +0200 Subject: [PATCH] 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... --- src/config/cmdline.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/config/cmdline.c b/src/config/cmdline.c index ad5f2ca4e8..8de2e2224d 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: -- 2.39.5