From: Sam Hocevar Date: Sat, 12 Nov 2005 00:42:44 +0000 (+0000) Subject: * src/vlc.c: do not exit the program with an error if no error occurred, for X-Git-Tag: 0.9.0-test0~13334 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c59fd2bb91a48cec804943d955062ac1098f0627;p=vlc * src/vlc.c: do not exit the program with an error if no error occurred, for instance when listing the plugins or asking for the usage. --- diff --git a/include/vlc/vlc.h b/include/vlc/vlc.h index ef0bc1a538..bcd2ce12f7 100644 --- a/include/vlc/vlc.h +++ b/include/vlc/vlc.h @@ -122,6 +122,7 @@ struct vlc_list_t #define VLC_EBADVAR -31 /* Bad variable value */ #define VLC_EEXIT -255 /* Program exited */ +#define VLC_EEXITSUCCESS -999 /* Program exited successfully */ #define VLC_EGENERIC -666 /* Generic error */ /***************************************************************************** diff --git a/src/libvlc.c b/src/libvlc.c index 34868e514a..03f62c5fe4 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -275,6 +275,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) char * psz_parser; char * psz_control; vlc_bool_t b_exit = VLC_FALSE; + int i_ret = VLC_EEXIT; vlc_t * p_vlc = vlc_current_object( i_object ); module_t *p_help_module; playlist_t *p_playlist; @@ -358,12 +359,14 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) { Help( p_vlc, "help" ); b_exit = VLC_TRUE; + i_ret = VLC_EEXITSUCCESS; } /* Check for version option */ else if( config_GetInt( p_vlc, "version" ) ) { Version(); b_exit = VLC_TRUE; + i_ret = VLC_EEXITSUCCESS; } /* Set the config file stuff */ @@ -423,6 +426,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) /* This is the parent, exit right now */ msg_Dbg( p_vlc, "closing parent process" ); b_exit = VLC_TRUE; + i_ret = VLC_EEXITSUCCESS; } else { @@ -444,7 +448,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); if( i_object ) vlc_object_release( p_vlc ); - return VLC_EEXIT; + return i_ret; } /* Check for translation config option */ @@ -505,18 +509,21 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) Help( p_vlc, p_tmp ); free( p_tmp ); b_exit = VLC_TRUE; + i_ret = VLC_EEXITSUCCESS; } /* Check for long help option */ else if( config_GetInt( p_vlc, "longhelp" ) ) { Help( p_vlc, "longhelp" ); b_exit = VLC_TRUE; + i_ret = VLC_EEXITSUCCESS; } /* Check for module list option */ else if( config_GetInt( p_vlc, "list" ) ) { ListModules( p_vlc ); b_exit = VLC_TRUE; + i_ret = VLC_EEXITSUCCESS; } /* Check for config file options */ @@ -547,7 +554,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) vlc_object_destroy( p_help_module ); module_EndBank( p_vlc ); if( i_object ) vlc_object_release( p_vlc ); - return VLC_EEXIT; + return i_ret; } /* diff --git a/src/vlc.c b/src/vlc.c index 52be84bc9b..67e9a19b5c 100644 --- a/src/vlc.c +++ b/src/vlc.c @@ -99,7 +99,7 @@ int main( int i_argc, char *ppsz_argv[] ) if( i_ret < 0 ) { VLC_Destroy( 0 ); - return i_ret; + return i_ret == VLC_EEXITSUCCESS ? 0 : i_ret; } i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );