#include <stdlib.h>
#include <locale.h>
+#ifdef __APPLE__
+#include <string.h>
+#endif
+
/* Explicit HACK */
extern void LocaleFree (const char *);
# endif
#endif
- for (int i = 1; i < i_argc; i++)
+ int i = 1;
+#ifdef __APPLE__
+ /* 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
+ * for example -psn_0_9306113 */
+ if(i_argc >= 2 && !strncmp( ppsz_argv[1] , "-psn" , 4 ))
+ i = 2;
+#endif
+ for (; i < i_argc; i++)
if ((argv[argc++] = FromLocale (ppsz_argv[i])) == NULL)
return 1; // BOOM!
argv[argc] = NULL;
module_config_t *pp_shortopts[256];
char *psz_shortopts;
-#ifdef __APPLE__
- /* 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 ( (*pi_argc > 1) && (strncmp( ppsz_argv[ 1 ] , "-psn" , 4 ) == 0) )
- /* for example -psn_0_9306113 */
- {
- /* 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.
- * As there won't be any more args to parse, just exit. */
- assert( *pi_argc == 2 );
- *pi_argc = 1;
- return 0;
- }
-#endif
-
/* List all modules */
module_t **list = module_list_get (NULL);