1 --- oo_1.1rc3_src/vcl/unx/source/app/salmain.cxx.sal-main-cmdline 2003-07-31 23:34:39.000000000 -0400
2 +++ oo_1.1rc3_src/vcl/unx/source/app/salmain.cxx 2003-08-25 04:38:27.000000000 -0400
3 @@ -93,6 +93,10 @@ int main( int argc, char *argv[] )
4 setrlimit( RLIMIT_NOFILE, &aLimit );
8 + extern void osl_setCommandArgs(sal_Char* aArgs[], sal_uInt32 nArgs);
9 + osl_setCommandArgs(argv, argc);
13 // #75628# avoid calling atexit and fini since this core-dumps if calling pgp-java
14 --- oo_1.1rc3_src/sal/inc/sal/main.h.sal-main-cmdline 2001-02-27 05:44:53.000000000 -0500
15 +++ oo_1.1rc3_src/sal/inc/sal/main.h 2003-08-25 04:37:48.000000000 -0400
16 @@ -118,8 +118,18 @@ int WINAPI WinMain( HINSTANCE _hinst, HI
22 -#else /* ! SAL_W32 */
23 +extern "C" void osl_setCommandArgs(sal_Char* aArgs[], sal_uInt32 nArgs);
25 +#define SAL_DEFINE_CRT_ENTRY() \
26 +int main(int argc, char *argv[]) \
28 + osl_setCommandArgs(argv, argc); \
29 + return sal_main(); \
32 +#else /* ! SAL_W32 && ! LINUX */
34 #define SAL_DEFINE_CRT_ENTRY() \
36 --- oo_1.1rc3_src/sal/osl/unx/process.c.sal-main-cmdline 2003-07-02 09:34:17.000000000 -0400
37 +++ oo_1.1rc3_src/sal/osl/unx/process.c 2003-08-25 04:40:23.000000000 -0400
38 @@ -308,12 +308,17 @@ sal_Char *getCmdLine()
42 -#ifdef CMD_ARG_PROC_STREAM
43 +#if defined( CMD_ARG_PROC_STREAM ) || defined( CMD_ARG_FROM_MAIN )
45 * mfe: this is for Linux
46 * (and which other Unix flavours?)
48 +#ifdef CMD_ARG_PROC_STREAM
49 sal_Char *getCmdLine()
51 +#define ALTERNATE_GETCMDLINE alternate_getCmdLine
52 +static sal_Char *ALTERNATE_GETCMDLINE()
56 sal_Char name[PATH_MAX + 1];
57 @@ -450,6 +455,61 @@ sal_Char *getCmdLine()
61 +#ifdef CMD_ARG_FROM_MAIN
62 +/* Command line arguments copied from main() entry values. */
63 +static sal_Char *aCommandArgs = NULL;
64 +static sal_uInt32 nCommandSize = 0;
66 +sal_Char *getCmdLine()
70 + sal_Char *pchr = (sal_Char *) malloc(nCommandSize);
71 + return pchr && memcpy(pchr, aCommandArgs, nCommandSize) ? pchr : NULL;
73 +#ifdef ALTERNATE_GETCMDLINE
74 + return ALTERNATE_GETCMDLINE();
80 +void osl_setCommandArgs(sal_Char* aArgs[], sal_uInt32 nArgs)
82 + sal_uInt32 nArg, nSize = 0;
84 + for (nArg = 0; nArg < nArgs; nArg++)
85 + nSize += strlen(aArgs[nArg]) + 1;
87 + // NOTE: a sal_Char is always 1 anyway
88 + nCommandSize = nSize + 1;
89 + aCommandArgs = (sal_Char *) calloc(nCommandSize, sizeof(sal_Char));
93 + sal_Char *pszArgs = aCommandArgs;
94 + for (nArg = 0; nArg < nArgs; nArg++)
96 + nSize = strlen(aArgs[nArg]);
97 + memcpy(pszArgs, aArgs[nArg], nSize);
98 + pszArgs += nSize + 1; // skip '\0';
102 + pszArgs = aCommandArgs;
103 + fprintf(stderr, "osl_setCommandArgs, %d args\n", nArgs);
104 + for (nArg = 0; nArg < nArgs; nArg++)
106 + fprintf(stderr, "%u: '%s'\n", nArg, pszArgs);
107 + pszArgs += strlen(pszArgs) + 1;
116 /*******************************************************************
117 !!! Working on byte strings is dangerous because of MBCS see
119 --- oo_1.1rc3_src/sal/osl/unx/system.h.sal-main-cmdline 2003-07-30 12:04:04.000000000 -0400
120 +++ oo_1.1rc3_src/sal/osl/unx/system.h 2003-08-25 04:37:48.000000000 -0400
122 # define IOCHANNEL_TRANSFER_BSD_RENO
123 # define pthread_testcancel()
124 # define NO_PTHREAD_PRIORITY
125 -# define CMD_ARG_PROC_STREAM
126 # define CMD_ARG_PROC_NAME "/proc/%u/cmdline"
127 +# define CMD_ARG_FROM_MAIN
128 # define PTHREAD_SIGACTION pthread_sigaction
131 --- oo_1.1rc3_src/sal/util/sal.map.sal-main-cmdline 2003-04-04 05:46:19.000000000 -0500
132 +++ oo_1.1rc3_src/sal/util/sal.map 2003-08-25 04:37:48.000000000 -0400
133 @@ -51,6 +51,7 @@ UDK_3_0_0 {
134 osl_freeProcessHandle;
135 osl_freeSecurityHandle;
136 osl_getAddrOfSocketAddr;
137 + osl_setCommandArgs;
139 osl_getCommandArgCount;