[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gui: Ignore the -psn_xxx option passed to Mac desktop apps.
From: |
Ben Pfaff |
Subject: |
[PATCH] gui: Ignore the -psn_xxx option passed to Mac desktop apps. |
Date: |
Wed, 17 Aug 2011 21:57:53 -0700 |
Jeremy Lavergne <address@hidden> reports that this
is necessary to make PSPPIRE launch gracefully on the Mac.
---
Jeremy, can you try out this patch and see if it has the desired effect?
If it does, I will commit it. Thank you!
diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c
index 7e9d4ee..cc5ebe3 100644
--- a/src/ui/gui/main.c
+++ b/src/ui/gui/main.c
@@ -1,5 +1,5 @@
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2004, 2005, 2006, 2010 Free Software Foundation
+ Copyright (C) 2004, 2005, 2006, 2010, 2011 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
#include "language/lexer/include-path.h"
#include "libpspp/argv-parser.h"
+#include "libpspp/array.h"
#include "libpspp/assertion.h"
#include "libpspp/cast.h"
#include "libpspp/copyleft.h"
@@ -216,6 +217,27 @@ static GMemVTable vtable =
realloc
};
+#ifdef __APPLE__
+/* Searches ARGV for the -psn_xxxx option that the desktop application
+ launcher passes in, and removes it if it finds it. Returns the new value
+ of ARGC. */
+static int
+remove_psn (int argc, char **argv)
+{
+ int i;
+
+ for (i = 0; i < argc; i++)
+ {
+ if (!strncmp(argv[i], "-psn", 4))
+ {
+ remove_element (argv, argc + 1, sizeof *argv, i);
+ return argc - 1;
+ }
+ }
+ return argc;
+}
+#endif /* __APPLE__ */
+
int
main (int argc, char *argv[])
{
@@ -244,6 +266,9 @@ main (int argc, char *argv[])
g_warning ("%s", vers);
}
+#ifdef __APPLE__
+ argc = remove_psn (argc, argv);
+#endif
/* Parse our own options.
This must come BEFORE gdk_init otherwise options such as
--
1.7.2.5
- [PATCH] gui: Ignore the -psn_xxx option passed to Mac desktop apps.,
Ben Pfaff <=