1 --- extensions/source/nsplugin/source/so_env.cxx.orig 2007-03-18 18:43:48.259831000 +0200
2 +++ extensions/source/nsplugin/source/so_env.cxx 2007-03-18 18:44:09.670316347 +0200
8 #if defined(SOLARIS) && !defined(__GNUC__)
16 +extern int nspluginOOoModuleHook (void** aResult);
17 +int nspluginOOoModuleHook (void** aResult)
22 + dl_handle = dlopen(NULL, RTLD_NOW);
25 + fprintf (stderr, "Can't open myself '%s'\n", dlerror());
29 + Dl_info dl_info = { 0, };
30 + if(!dladdr((const void *)nspluginOOoModuleHook, &dl_info))
32 + fprintf (stderr, "Can't find my own address '%s'\n", dlerror());
36 + if (!dl_info.dli_fname)
38 + fprintf (stderr, "Can't find my own file name\n");
42 + char cwdstr[NPP_PATH_MAX];
43 + if (!getcwd (cwdstr, sizeof(cwdstr)))
45 + fprintf (stderr, "Can't get cwd\n");
49 + char libFileName[NPP_PATH_MAX];
51 + if (dl_info.dli_fname[0] != '/')
53 + strcpy (libFileName, cwdstr);
54 + strcat (libFileName, "/");
56 + strcat (libFileName, dl_info.dli_fname);
59 + static char realFileName[NPP_PATH_MAX] = {0};
60 +# define SEARCH_SUFFIX "/program/libnpsoplug"
62 + if (!(clobber = strstr (libFileName, SEARCH_SUFFIX)))
64 + ssize_t len = readlink(libFileName, realFileName, NPP_PATH_MAX);
67 + fprintf (stderr, "Couldn't read link '%s'\n", libFileName);
70 + realFileName[len] = '\0';
71 + if (!(clobber = strstr (realFileName, "/program/libnpsoplug")))
73 + fprintf (stderr, "Couldn't find suffix in '%s'\n", realFileName);
81 + strcpy (realFileName, libFileName);
83 + *aResult = realFileName;
85 + fprintf (stderr, "OpenOffice path is '%s'\n", realFileName);
91 // *aResult points the static string holding "/opt/staroffice8"
92 int findReadSversion(void** aResult, int bWnt, const char* tag, const char* entry)
95 // Filename of lnk file, eg. "soffice"
96 char lnkFileName[NPP_PATH_MAX] = {0};
97 char* pTempZero = NULL;
99 + /* try to fetch a 'self' pointer */
100 + if (!nspluginOOoModuleHook (aResult))
103 + /* .. now in $HOME */
104 sprintf(lnkFileName, "%s/.mozilla/plugins/libnpsoplugin%s", getenv("HOME"), SAL_DLLEXTENSION);
105 - if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) ||
106 - (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))))
107 + ssize_t len = readlink(lnkFileName, realFileName, NPP_PATH_MAX);
113 + realFileName[len] = '\0';
115 + if (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION)))