]> git.sesse.net Git - vlc/commitdiff
* src/vlc.c: do not exit the program with an error if no error occurred, for
authorSam Hocevar <sam@videolan.org>
Sat, 12 Nov 2005 00:42:44 +0000 (00:42 +0000)
committerSam Hocevar <sam@videolan.org>
Sat, 12 Nov 2005 00:42:44 +0000 (00:42 +0000)
    instance when listing the plugins or asking for the usage.

include/vlc/vlc.h
src/libvlc.c
src/vlc.c

index ef0bc1a53858085988f4513e83f45ff009008011..bcd2ce12f710a9a5fc8614db7b0dbc9882418aa0 100644 (file)
@@ -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 */
 
 /*****************************************************************************
index 34868e514a83fbccd88c2eb74f0eaab09fa430f0..03f62c5fe477d670ebf63f87493bfd897da911d9 100644 (file)
@@ -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;
     }
 
     /*
index 52be84bc9b36d3b54db041543c3e9a8e47b64b19..67e9a19b5c32b2a00a51499754d0c1f404711e82 100644 (file)
--- 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 );