]> git.pld-linux.org Git - packages/libreoffice.git/blob - openoffice-1.1-sal-main-cmdline.patch
- DON'T hardcode java paths!
[packages/libreoffice.git] / openoffice-1.1-sal-main-cmdline.patch
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 );
5         }
6                 
7 +#ifdef LINUX
8 +    extern void osl_setCommandArgs(sal_Char* aArgs[], sal_uInt32 nArgs);
9 +    osl_setCommandArgs(argv, argc);
10 +#endif
11      SVMain();
12  
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
17         return sal_main(); \
18  }
19  
20 +#elif defined(LINUX)
21  
22 -#else  /* ! SAL_W32 */
23 +extern "C" void osl_setCommandArgs(sal_Char* aArgs[], sal_uInt32 nArgs);
24 +
25 +#define SAL_DEFINE_CRT_ENTRY()                                 \
26 +int main(int argc, char *argv[])                               \
27 +{                                                                                              \
28 +       osl_setCommandArgs(argv, argc);                         \
29 +       return sal_main();                                                      \
30 +}
31 +
32 +#else  /* ! SAL_W32 && ! LINUX */
33  
34  #define SAL_DEFINE_CRT_ENTRY() \
35  int main() \
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()
39  }
40  #endif
41  
42 -#ifdef CMD_ARG_PROC_STREAM
43 +#if defined( CMD_ARG_PROC_STREAM ) || defined( CMD_ARG_FROM_MAIN )
44  /*
45   *  mfe: this is for Linux
46   *       (and which other Unix flavours?)
47   */
48 +#ifdef CMD_ARG_PROC_STREAM
49  sal_Char *getCmdLine()
50 +#else
51 +#define ALTERNATE_GETCMDLINE alternate_getCmdLine
52 +static sal_Char *ALTERNATE_GETCMDLINE()
53 +#endif
54  {
55         FILE *fp;
56         sal_Char  name[PATH_MAX + 1];
57 @@ -450,6 +455,61 @@ sal_Char *getCmdLine()
58  }
59  #endif
60  
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;
65 +
66 +sal_Char *getCmdLine()
67 +{
68 +       if (aCommandArgs)
69 +       {
70 +               sal_Char *pchr = (sal_Char *) malloc(nCommandSize);
71 +               return pchr && memcpy(pchr, aCommandArgs, nCommandSize) ? pchr : NULL;
72 +       }
73 +#ifdef ALTERNATE_GETCMDLINE
74 +       return ALTERNATE_GETCMDLINE();
75 +#else
76 +       return NULL;
77 +#endif
78 +}
79 +
80 +void osl_setCommandArgs(sal_Char* aArgs[], sal_uInt32 nArgs)
81 +{
82 +       sal_uInt32 nArg, nSize = 0;
83 +
84 +       for (nArg = 0; nArg < nArgs; nArg++)
85 +               nSize += strlen(aArgs[nArg]) + 1;
86 +
87 +       // NOTE: a sal_Char is always 1 anyway
88 +       nCommandSize = nSize + 1;
89 +       aCommandArgs = (sal_Char *) calloc(nCommandSize, sizeof(sal_Char));
90 +
91 +       if (aCommandArgs)
92 +       {
93 +               sal_Char *pszArgs = aCommandArgs;
94 +               for (nArg = 0; nArg < nArgs; nArg++)
95 +               {
96 +                       nSize = strlen(aArgs[nArg]);
97 +                       memcpy(pszArgs, aArgs[nArg], nSize);
98 +                       pszArgs += nSize + 1; // skip '\0';
99 +               }
100 +#if 0
101 +               {
102 +                       pszArgs = aCommandArgs;
103 +                       fprintf(stderr, "osl_setCommandArgs, %d args\n", nArgs);
104 +                       for (nArg = 0; nArg < nArgs; nArg++)
105 +                       {
106 +                               fprintf(stderr, "%u: '%s'\n", nArg, pszArgs);
107 +                               pszArgs += strlen(pszArgs) + 1;
108 +                       }
109 +               }
110 +#endif
111 +       }
112 +}
113 +#endif
114
115 +
116  /*******************************************************************
117     !!! Working on byte strings is dangerous because of MBCS see 
118     #104563.
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
121 @@ -135,8 +135,8 @@
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
129  #else
130  #   include <shadow.h>
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;
138          osl_getCommandArg;
139          osl_getCommandArgCount;
140          osl_getConfigDir;
This page took 0.04202 seconds and 3 git commands to generate.