summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMartin Hollmichel <mh@openoffice.org>2002-08-12 13:58:34 +0000
committerMartin Hollmichel <mh@openoffice.org>2002-08-12 13:58:34 +0000
commit8e0c76d27d5b676fd3a882abe4bf4ac80ddda0ea (patch)
treebc4273774eb07f2cd5aec5bb80323c634e4baab9 /sal
parent5a1cd122c1f69816bf16f8ff55747a731e317343 (diff)
join: from OOO_STABLE_1, #101685
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/process.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c
index 6b685e17d..ad524ba7f 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -2,9 +2,9 @@
*
* $RCSfile: process.c,v $
*
- * $Revision: 1.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: mhu $ $Date: 2002-08-03 13:53:03 $
+ * last change: $Author: mh $ $Date: 2002-08-12 14:58:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -182,10 +182,39 @@ static int nArgCount = -1;
*
*****************************************************************************/
+#if defined(MACOSX)
+// Can't access environ and __progname directly when linking two-level.
+static sal_Char *getCmdLine()
+{
+ int i;
+ int len = 0;
+ sal_Char *result;
+ int the_argc = *_NSGetArgc();
+ char **the_argv = *_NSGetArgv();
+
+ for (i = 0; i < the_argc; i++) {
+ len += 1 + strlen(the_argv[i]);
+ }
+
+ result = calloc(len + 1, sizeof(sal_Char));
+ if (result) {
+ sal_Char *dst = result;
+ for (i = 0; i < the_argc; i++) {
+ strcpy(dst, the_argv[i]);
+ dst += 1 + strlen(the_argv[i]);
+ }
+ *dst = '\0';
+ return result;
+ }
+
+ return NULL;
+}
+
+#endif
#if defined(CMD_ARG_PRG) && defined(CMD_ARG_ENV)
/*
- * mfe: used by FreeBSD, NetBSD, HP-UX, IRIX, MacOS X
+ * mfe: used by FreeBSD, NetBSD, HP-UX, IRIX
* (and which other Unix flavours?)
*/
static sal_Char *getCmdLine()