Commit c59fd2bb authored by Sam Hocevar's avatar Sam Hocevar

* 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.
parent d99c3102
...@@ -122,6 +122,7 @@ struct vlc_list_t ...@@ -122,6 +122,7 @@ struct vlc_list_t
#define VLC_EBADVAR -31 /* Bad variable value */ #define VLC_EBADVAR -31 /* Bad variable value */
#define VLC_EEXIT -255 /* Program exited */ #define VLC_EEXIT -255 /* Program exited */
#define VLC_EEXITSUCCESS -999 /* Program exited successfully */
#define VLC_EGENERIC -666 /* Generic error */ #define VLC_EGENERIC -666 /* Generic error */
/***************************************************************************** /*****************************************************************************
......
...@@ -275,6 +275,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -275,6 +275,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
char * psz_parser; char * psz_parser;
char * psz_control; char * psz_control;
vlc_bool_t b_exit = VLC_FALSE; vlc_bool_t b_exit = VLC_FALSE;
int i_ret = VLC_EEXIT;
vlc_t * p_vlc = vlc_current_object( i_object ); vlc_t * p_vlc = vlc_current_object( i_object );
module_t *p_help_module; module_t *p_help_module;
playlist_t *p_playlist; playlist_t *p_playlist;
...@@ -358,12 +359,14 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -358,12 +359,14 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
{ {
Help( p_vlc, "help" ); Help( p_vlc, "help" );
b_exit = VLC_TRUE; b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
} }
/* Check for version option */ /* Check for version option */
else if( config_GetInt( p_vlc, "version" ) ) else if( config_GetInt( p_vlc, "version" ) )
{ {
Version(); Version();
b_exit = VLC_TRUE; b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
} }
/* Set the config file stuff */ /* Set the config file stuff */
...@@ -423,6 +426,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -423,6 +426,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
/* This is the parent, exit right now */ /* This is the parent, exit right now */
msg_Dbg( p_vlc, "closing parent process" ); msg_Dbg( p_vlc, "closing parent process" );
b_exit = VLC_TRUE; b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
} }
else else
{ {
...@@ -444,7 +448,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -444,7 +448,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
vlc_object_destroy( p_help_module ); vlc_object_destroy( p_help_module );
module_EndBank( p_vlc ); module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc ); if( i_object ) vlc_object_release( p_vlc );
return VLC_EEXIT; return i_ret;
} }
/* Check for translation config option */ /* Check for translation config option */
...@@ -505,18 +509,21 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -505,18 +509,21 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
Help( p_vlc, p_tmp ); Help( p_vlc, p_tmp );
free( p_tmp ); free( p_tmp );
b_exit = VLC_TRUE; b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
} }
/* Check for long help option */ /* Check for long help option */
else if( config_GetInt( p_vlc, "longhelp" ) ) else if( config_GetInt( p_vlc, "longhelp" ) )
{ {
Help( p_vlc, "longhelp" ); Help( p_vlc, "longhelp" );
b_exit = VLC_TRUE; b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
} }
/* Check for module list option */ /* Check for module list option */
else if( config_GetInt( p_vlc, "list" ) ) else if( config_GetInt( p_vlc, "list" ) )
{ {
ListModules( p_vlc ); ListModules( p_vlc );
b_exit = VLC_TRUE; b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
} }
/* Check for config file options */ /* Check for config file options */
...@@ -547,7 +554,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -547,7 +554,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
vlc_object_destroy( p_help_module ); vlc_object_destroy( p_help_module );
module_EndBank( p_vlc ); module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc ); if( i_object ) vlc_object_release( p_vlc );
return VLC_EEXIT; return i_ret;
} }
/* /*
......
...@@ -99,7 +99,7 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -99,7 +99,7 @@ int main( int i_argc, char *ppsz_argv[] )
if( i_ret < 0 ) if( i_ret < 0 )
{ {
VLC_Destroy( 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 ); i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );
......
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