* options) */
module_InitBank( p_libvlc );
- if( config_LoadCmdLine( p_libvlc, i_argc, ppsz_argv, true ) )
+ if( config_LoadCmdLine( p_libvlc, i_argc, ppsz_argv, NULL ) )
{
module_EndBank( p_libvlc, false );
return VLC_EGENERIC;
/*
* Override configuration with command line settings
*/
- /* config_LoadCmdLine(), DBus (below) and Win32-specific use vlc_optind,
- * vlc_optarg and vlc_optopt globals. This is not thread-safe!! */
-#warning BUG!
- if( config_LoadCmdLine( p_libvlc, i_argc, ppsz_argv, false ) )
+ int vlc_optind;
+ if( config_LoadCmdLine( p_libvlc, i_argc, ppsz_argv, &vlc_optind ) )
{
#ifdef WIN32
ShowConsole( false );
}
/* System specific configuration */
- system_Configure( p_libvlc, i_argc, ppsz_argv );
+ system_Configure( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind );
/* Add service discovery modules */
psz_modules = var_InheritString( p_libvlc, "services-discovery" );
* We assume that the remaining parameters are filenames
* and their input options.
*/
- msg_Info( p_libvlc, "optind = %u", vlc_optind );
GetFilenames( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind );
/*
* makes the environment unconsistent when libvlc is unloaded and
* should probably be moved to a safer place like vlc.c. */
static char psz_lcall[20];
- snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang );
- psz_lcall[19] = '\0';
+ snprintf( psz_lcall, sizeof(psz_lcall), "LC_ALL=%s", psz_lang );
putenv( psz_lcall );
#endif
( b_strict ? strcmp( psz_search, p_parser->psz_object_name )
: !strstr( p_parser->psz_object_name, psz_search ) ) )
{
- char *const *pp_shortcut = p_parser->pp_shortcuts;
- while( *pp_shortcut )
+ char *const *pp_shortcuts = p_parser->pp_shortcuts;
+ unsigned i;
+ for( i = 0; i < p_parser->i_shortcuts; i++ )
{
- if( b_strict ? !strcmp( psz_search, *pp_shortcut )
- : !!strstr( *pp_shortcut, psz_search ) )
+ if( b_strict ? !strcmp( psz_search, pp_shortcuts[i] )
+ : !!strstr( pp_shortcuts[i], psz_search ) )
break;
- pp_shortcut ++;
}
- if( !*pp_shortcut )
+ if( i == p_parser->i_shortcuts )
continue;
}
if( b_verbose )
{
- char *const *pp_shortcut = p_parser->pp_shortcuts;
- while( *pp_shortcut )
+ char *const *pp_shortcuts = p_parser->pp_shortcuts;
+ for( unsigned i = 0; i < p_parser->i_shortcuts; i++ )
{
- if( strcmp( *pp_shortcut, p_parser->psz_object_name ) )
+ if( strcmp( pp_shortcuts[i], p_parser->psz_object_name ) )
{
if( b_color )
utf8_fprintf( stdout, CYAN" s %s\n"GRAY,
- *pp_shortcut );
+ pp_shortcuts[i] );
else
utf8_fprintf( stdout, " s %s\n",
- *pp_shortcut );
+ pp_shortcuts[i] );
}
- pp_shortcut++;
}
if( p_parser->psz_capability )
{