Commit d50656d8 authored by Antoine Cellerier's avatar Antoine Cellerier

Fix indentation.

I was actually trying to understand why command line option parsing on my computer with self compiled VLC behaves as "If the first character of optstring is '+' or the environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a non-option argument is encountered." while neither of these conditions is true (see the while( getopt_long( ... ) != EOF ) loop).
Small illustration:
./vlc -vvv -I dummy input.ts --color
All options before the first non option argument work as expected (-vvv and -I dummy). All options after the first non option argument are also interpreted as being non option arguments.
Help would be appreciated.
(I've already had reports of other people having the same kind of issues)
parent 94ad23ae
...@@ -1569,83 +1569,83 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], ...@@ -1569,83 +1569,83 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
p_conf = config_FindConfig( p_this, psz_name ); p_conf = config_FindConfig( p_this, psz_name );
} }
switch( p_conf->i_type ) switch( p_conf->i_type )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_MODULE_LIST_CAT:
case CONFIG_ITEM_MODULE_CAT:
config_PutPsz( p_this, psz_name, optarg );
break;
case CONFIG_ITEM_INTEGER:
config_PutInt( p_this, psz_name, strtol(optarg, 0, 0));
break;
case CONFIG_ITEM_FLOAT:
config_PutFloat( p_this, psz_name, (float)atof(optarg) );
break;
case CONFIG_ITEM_KEY:
config_PutInt( p_this, psz_name, ConfigStringToKey( optarg ) );
break;
case CONFIG_ITEM_BOOL:
config_PutInt( p_this, psz_name, !flag );
break;
}
continue;
}
}
/* A short option has been recognized */
if( pp_shortopts[i_cmd] != NULL )
{
switch( pp_shortopts[i_cmd]->i_type )
{ {
case CONFIG_ITEM_STRING: case CONFIG_ITEM_STRING:
case CONFIG_ITEM_FILE: case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_MODULE_CAT:
case CONFIG_ITEM_MODULE_LIST: case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_MODULE_LIST_CAT: case CONFIG_ITEM_MODULE_LIST_CAT:
case CONFIG_ITEM_MODULE_CAT: config_PutPsz( p_this, pp_shortopts[i_cmd]->psz_name, optarg );
config_PutPsz( p_this, psz_name, optarg );
break; break;
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
config_PutInt( p_this, psz_name, strtol(optarg, 0, 0)); if( i_cmd == 'v' )
break;
case CONFIG_ITEM_FLOAT:
config_PutFloat( p_this, psz_name, (float)atof(optarg) );
break;
case CONFIG_ITEM_KEY:
config_PutInt( p_this, psz_name, ConfigStringToKey( optarg ) );
break;
case CONFIG_ITEM_BOOL:
config_PutInt( p_this, psz_name, !flag );
break;
}
continue;
}
}
/* A short option has been recognized */
if( pp_shortopts[i_cmd] != NULL )
{
switch( pp_shortopts[i_cmd]->i_type )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_MODULE_CAT:
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_MODULE_LIST_CAT:
config_PutPsz( p_this, pp_shortopts[i_cmd]->psz_name, optarg );
break;
case CONFIG_ITEM_INTEGER:
if( i_cmd == 'v' )
{
if( optarg )
{ {
if( *optarg == 'v' ) /* eg. -vvv */ if( optarg )
{ {
i_verbose++; if( *optarg == 'v' ) /* eg. -vvv */
while( *optarg == 'v' )
{ {
i_verbose++; i_verbose++;
optarg++; while( *optarg == 'v' )
{
i_verbose++;
optarg++;
}
}
else
{
i_verbose += atoi( optarg ); /* eg. -v2 */
} }
} }
else else
{ {
i_verbose += atoi( optarg ); /* eg. -v2 */ i_verbose++; /* -v */
} }
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
i_verbose );
} }
else else
{ {
i_verbose++; /* -v */ config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
strtol(optarg, 0, 0) );
} }
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name, break;
i_verbose ); case CONFIG_ITEM_BOOL:
} config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name, 1 );
else break;
{
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
strtol(optarg, 0, 0) );
}
break;
case CONFIG_ITEM_BOOL:
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name, 1 );
break;
} }
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment