]> git.sesse.net Git - vlc/blobdiff - src/interface/main.c
* BeOS icon and MIME resources courtesy of Wade Majors <guru@startrek.com>.
[vlc] / src / interface / main.c
index 8bde632b68254f33865fa9944ae7208f109aea00..726df6c3117e1b0af9a427c85c9235e3fbcc9450 100644 (file)
@@ -4,7 +4,7 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: main.c,v 1.84 2001/04/11 14:10:49 ej Exp $
+ * $Id: main.c,v 1.85 2001/04/12 01:52:45 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 #endif
 
 #ifdef SYS_DARWIN1_3
-#include <mach/mach.h>                                  /* Altivec detection */
-#include <mach/mach_error.h>          /* some day the header files||compiler *
+#   include <mach/mach.h>                               /* Altivec detection */
+#   include <mach/mach_error.h>       /* some day the header files||compiler *
                                                        will define it for us */
-#include <mach/bootstrap.h>
+#   include <mach/bootstrap.h>
 #endif
 
 #include <unistd.h>
 #include "video_output.h"
 
 #ifdef SYS_BEOS
-#include "beos_specific.h"
+#   include "beos_specific.h"
+#endif
+
+#ifdef SYS_DARWIN1_3
+#   include "darwin_specific.h"
 #endif
 
 #include "netutils.h"                                 /* network_ChannelJoin */
@@ -182,7 +186,7 @@ main_t *p_main;
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  GetConfiguration        ( int *i_argc, char *ppsz_argv[],
+static int  GetConfiguration        ( int *pi_argc, char *ppsz_argv[],
                                       char *ppsz_env[] );
 static int  GetFilenames            ( int i_argc, char *ppsz_argv[] );
 static void Usage                   ( int i_fashion );
@@ -213,8 +217,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * System specific initialization code
      */
-#ifdef SYS_BEOS
-    beos_Create();
+#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
+    system_Create( &i_argc, ppsz_argv, ppsz_env );
 #endif
 
     p_main->i_cpu_capabilities = CPUCapabilities();
@@ -395,11 +399,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
      */
     intf_PlaylistDestroy( p_main->p_playlist );
 
-#ifdef SYS_BEOS
     /*
      * System specific cleaning code
      */
-    beos_Destroy();
+#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
+    system_Destroy();
 #endif
 
     /*
@@ -504,13 +508,13 @@ void main_PutIntVariable( char *psz_name, int i_value )
  * stage, but most structures are not allocated, so only environment should
  * be used.
  *****************************************************************************/
-static int GetConfiguration( int *i_argc, char *ppsz_argv[], char *ppsz_env[] )
+static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 {
     int   i_cmd;
     char *p_tmp;
 
     /* Set default configuration and copy arguments */
-    p_main->i_argc    = *i_argc;
+    p_main->i_argc    = *pi_argc;
     p_main->ppsz_argv = ppsz_argv;
     p_main->ppsz_env  = ppsz_env;
 
@@ -534,23 +538,30 @@ static int GetConfiguration( int *i_argc, char *ppsz_argv[], char *ppsz_env[] )
         }
     }
 
-//when vlc.app is run by double clicking in Mac OS X, the 2nd arg is the PSN - process serial number (a unique PID-ish thingie)
-//still ok for real Darwin & when run from command line
 #ifdef SYS_DARWIN1_3
-    if ( strncmp( ppsz_argv[ 1 ] , "-psn" , 4) == 0 ) //for example -psn_0_9306113
+    /* When vlc.app is run by double clicking in Mac OS X, the 2nd arg
+     * is the PSN - process serial number (a unique PID-ish thingie)
+     * still ok for real Darwin & when run from command line */
+    if ( strncmp( ppsz_argv[ 1 ] , "-psn" , 4) == 0 )
+                                  /* for example -psn_0_9306113 */
     {
-        //ppsz_argv[ 1 ] = NULL; //GDMF!... I can't do this or else the MacOSX window server will not pick up the PSN and not register the app and we crash...hence the following kludge
-        //otherwise we'll get confused w/ argv[1] being an input file name
-        *i_argc = *i_argc - 1;
-        p_main->i_argc--;
+        /* GDMF!... I can't do this or else the MacOSX window server will
+         * not pick up the PSN and not register the app and we crash...
+         * hence the following kludge otherwise we'll get confused w/ argv[1]
+         * being an input file name */
+#if 0
+        ppsz_argv[ 1 ] = NULL;
+#endif
+        *pi_argc = *pi_argc - 1;
+        pi_argc--;
         return( 0 );
     }
 #endif
 
     /* Parse command line options */
     opterr = 0;
-    while( ( i_cmd = getopt_long( *i_argc, ppsz_argv,
-                                  psz_shortopts, longopts, 0 ) ) != EOF )
+    while( ( i_cmd = getopt_long( *pi_argc, ppsz_argv,
+                                   psz_shortopts, longopts, 0 ) ) != EOF )
     {
         switch( i_cmd )
         {