[vlc-commits] vlc: fix regression with command line arguments
Rémi Denis-Courmont
git at videolan.org
Tue Mar 20 16:57:04 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 20 17:56:43 2012 +0200| [b542d4589832e4eb2d5598bdbbc8e27715763e7f] | committer: Rémi Denis-Courmont
vlc: fix regression with command line arguments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b542d4589832e4eb2d5598bdbbc8e27715763e7f
---
bin/vlc.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/bin/vlc.c b/bin/vlc.c
index 5757f9c..80418f1 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
+#include <string.h>
#include <locale.h>
#include <signal.h>
#ifdef HAVE_PTHREAD_H
@@ -40,10 +41,6 @@
#endif
#include <unistd.h>
-#ifdef __APPLE__
-#include <string.h>
-#endif
-
#ifdef __OS2__
# define pthread_t int
# define pthread_self() _gettid()
@@ -178,6 +175,17 @@ int main( int i_argc, const char *ppsz_argv[] )
#ifdef TOP_SRCDIR
argv[argc++] = "--data-path="TOP_SRCDIR"/share";
#endif
+ ppsz_argv++; i_argc--; /* skip executable path */
+#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 >= 1 && !strncmp (*ppsz_argv, "-psn" , 4))
+ ppsz_argv++, i_argc--;
+#endif
+ memcpy (argv + argc, ppsz_argv, i_argc * sizeof (*argv));
+ argc += i_argc;
argv[argc] = NULL;
vlc_enable_override ();
More information about the vlc-commits
mailing list