X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Flibvlc-common.c;h=1a0bdf71a1322dcd6107daab6ccfb37b93495f34;hb=8838c6953d183eac8fc203edcdf290eb28a29f3b;hp=e3df03e4fc3685e04fcbd54a4249f3c0f0548f3b;hpb=7f42e055f359bbb4d136c1b5c554baa2b23b52a2;p=vlc diff --git a/src/libvlc-common.c b/src/libvlc-common.c index e3df03e4fc..1a0bdf71a1 100644 --- a/src/libvlc-common.c +++ b/src/libvlc-common.c @@ -37,7 +37,7 @@ #include #include "modules/modules.h" -#include "modules/configuration.h" +#include "config/config.h" #include /* ENOMEM */ #include /* sprintf() */ @@ -214,6 +214,8 @@ libvlc_int_t * libvlc_InternalCreate( void ) /* Announce who we are - Do it only for first instance ? */ msg_Dbg( p_libvlc, COPYRIGHT_MESSAGE ); msg_Dbg( p_libvlc, "libvlc was configured with %s", CONFIGURE_LINE ); + if( strcmp( p_libvlc->psz_object_name, "cvlc" ) ) /* Not running with cvlc */ + msg_Info( p_libvlc, "Running vlc with the default interface. Use 'cvlc' to use vlc without interface."); /* Initialize mutexes */ vlc_mutex_init( p_libvlc, &p_libvlc->config_lock ); @@ -261,11 +263,11 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, /* Get the executable name (similar to the basename command) */ if( i_argc > 0 ) { - p_libvlc->psz_object_name = p_tmp = ppsz_argv[ 0 ]; - while( *p_tmp ) + const char *exe = p_libvlc->psz_object_name = ppsz_argv[0]; + while( *exe ) { - if( *p_tmp == '/' ) p_libvlc->psz_object_name = ++p_tmp; - else ++p_tmp; + if( *exe++ == '/' ) + p_libvlc->psz_object_name = exe; } } else @@ -303,7 +305,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, if( config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE ) ) { vlc_object_detach( p_help_module ); - config_Free( p_help_module ); + p_help_module->p_config = NULL; + p_help_module->confsize = 0; vlc_object_destroy( p_help_module ); module_EndBank( p_libvlc ); return VLC_EGENERIC; @@ -411,7 +414,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, if( b_exit ) { - config_Free( p_help_module ); + p_help_module->p_config = NULL; p_help_module->confsize = 0; vlc_object_destroy( p_help_module ); module_EndBank( p_libvlc ); return i_ret; @@ -521,7 +524,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, if( b_exit ) { - config_Free( p_help_module ); + p_help_module->p_config = NULL; p_help_module->confsize = 0; vlc_object_destroy( p_help_module ); module_EndBank( p_libvlc ); return i_ret; @@ -554,7 +557,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, PauseConsole(); #endif vlc_object_detach( p_help_module ); - config_Free( p_help_module ); + p_help_module->p_config = NULL; p_help_module->confsize = 0; vlc_object_destroy( p_help_module ); module_EndBank( p_libvlc ); return VLC_EGENERIC; @@ -562,7 +565,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, /* Hack: remove the help module here */ vlc_object_detach( p_help_module ); - config_Free( p_help_module ); + p_help_module->p_config = NULL; p_help_module->confsize = 0; vlc_object_destroy( p_help_module ); /* End hack */ @@ -1330,6 +1333,7 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name ) # define WHITE COL(37) # define GRAY "\033[0m" #define COLOR_FORMAT_STRING (WHITE" %s --%s"YELLOW"%s%s%s%s%s%s "GRAY) +#define COLOR_FORMAT_STRING_BOOL (WHITE" %s --%s%s%s%s%s%s%s "GRAY) #define LINE_START 8 #define PADDING_SPACES 25 @@ -1342,6 +1346,7 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name ) char psz_spaces_text[PADDING_SPACES+LINE_START+1]; char psz_spaces_longtext[LINE_START+3]; char psz_format[sizeof(COLOR_FORMAT_STRING)]; + char psz_format_bool[sizeof(COLOR_FORMAT_STRING_BOOL)]; char psz_buffer[10000]; char psz_short[4]; int i_index; @@ -1358,9 +1363,15 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name ) psz_spaces_longtext[LINE_START+2] = '\0'; if( b_color ) + { strcpy( psz_format, COLOR_FORMAT_STRING ); + strcpy( psz_format_bool, COLOR_FORMAT_STRING_BOOL ); + } else + { strcpy( psz_format, FORMAT_STRING ); + strcpy( psz_format_bool, FORMAT_STRING ); + } /* List all modules */ p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); @@ -1607,9 +1618,9 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name ) if( p_item->i_type == CONFIG_ITEM_BOOL && !b_help_module ) { - utf8_fprintf( stdout, psz_format, psz_short, p_item->psz_name, - psz_prefix, p_item->psz_name, psz_bra, psz_type, - psz_ket, psz_spaces ); + utf8_fprintf( stdout, psz_format_bool, psz_short, + p_item->psz_name, psz_prefix, p_item->psz_name, + psz_bra, psz_type, psz_ket, psz_spaces ); } else { @@ -1799,14 +1810,6 @@ static void ListModules( libvlc_int_t *p_this, vlc_bool_t b_verbose ) p_parser->psz_capability, p_parser->i_score ); } - if( p_parser->psz_program ) - { - if( b_color ) - utf8_fprintf( stdout, YELLOW " p %s\n"GRAY, - p_parser->psz_program ); - else - utf8_fprintf( stdout, " p %s\n", p_parser->psz_program ); - } } psz_spaces[i] = ' ';