java_md.unix.c revision ada1678a4262b208a7b87391f520a7767d25287c
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
#include "java.h"
#include <iconv.h>
#include <langinfo.h>
#include <pthread.h>
#ifndef P_tmpdir
#endif
#ifdef SOLARIS
#endif
#define PIPE_SIZE 512
struct jvminfo {
char *version;
char *path;
};
typedef const char *(*message_t)(void);
/*
* Prototypes.
*/
static const char *
UpdateLocale();
const char *
GetArch()
{
#ifdef JNI_MD_SYSNAME
return JNI_MD_SYSNAME;
#else
#endif
}
static int lockfd = -1;
static void
{
if (lockfd >= 0)
if (lockfile)
{
}
}
void
{
const char *tmpdir;
const char *execname;
/*
* Create a file unique to this executable and the effective user running
* this program and put an exclusive lock on it. Note that if the default
* temporary directory is not writable (a very unusual case which causes
* many other problems for many other applications), there is no checking.
*/
if ((tmpdir = GetTempDir()) != NULL && (execname = GetExecName()) != NULL && stat(execname, &sb) == 0)
{
sprintf(lockfile, "%s" FILE_SEPARATOR "%s.%lu.%llu.%lu", tmpdir, title, (unsigned long)sb.st_dev, (unsigned long long)sb.st_ino, (unsigned long)geteuid());
{
{
exit(1);
}
}
}
return;
}
SetTempDir(const char *path)
{
int size = MAXPATHLEN;
{
size += MAXPATHLEN;
}
if (cwd)
if (tmppath && access(tmppath, R_OK | W_OK | X_OK) == 0 && stat(tmppath, &sb) == 0 && (sb.st_mode & S_IFDIR) == S_IFDIR)
{
if (tmpdir)
return JNI_TRUE;
}
if (tmppath)
return JNI_FALSE;
}
#ifndef RES_BUNDLE_NAME
#endif
/*
* Retrieve a localized message from the resource bundle compiled into the
* executable.
*/
char *
GetLocalizedMessage(const char *key)
{
const char *encoding;
const char *value;
while (!sym)
{
{
}
{
{
char *s;
*s = '\0';
else
*lc = '\0';
}
else
{
goto error;
}
}
else
{
break;
}
}
goto error;
/* Convert from UTF-8 to local encoding */
if ((encoding = nl_langinfo(CODESET)) != NULL && (cd = iconv_open(encoding, "UTF-8")) != (iconv_t)-1)
{
for (;;)
{
{
/* NULL terminate the converted string */
break;
}
else
{
{
size += MAXPATHLEN;
}
else
{
goto error;
}
}
}
}
else
{
/* Pass it through unconverted and hope for the best */
}
return ret;
/* Always return a valid string */
if (lc)
if (fullkey)
if (ret)
ret[0] = '\0';
return ret;
}
const char *
{
if (!tmpdir)
return tmpdir;
}
/*
* Find path to JRE based on a user specified Java installation directory.
*/
char *
GetJREPath(const char *path)
{
char *libjava;
/* Is JRE co-located with the application? */
sprintf(libjava, "%s" FILE_SEPARATOR "lib" FILE_SEPARATOR "%s" FILE_SEPARATOR JAVA_DLL, path, arch);
{
goto found;
}
/* Does the app ship a private JRE in <apphome>/jre directory? */
sprintf(libjava, "%s" FILE_SEPARATOR "jre" FILE_SEPARATOR "lib" FILE_SEPARATOR "%s" FILE_SEPARATOR JAVA_DLL, path, arch);
{
goto found;
}
#ifdef LINUX
/* for 64-bit JDK, must try a different directory */
sprintf(libjava, "%s" FILE_SEPARATOR "jre" FILE_SEPARATOR "lib" FILE_SEPARATOR "%s" FILE_SEPARATOR JAVA_DLL, path, X64);
{
goto found;
}
#endif
return NULL;
{
/* Check that executables exist */
{
}
}
return libjava;
}
static pthread_mutexattr_t lockattributes;
static pthread_mutex_t lock;
static int
{
/*
* Sometimes errors happen, especially when xhosting. When that happens,
* switch to console mode.
*/
return 0;
}
static int
{
/* Switch to console mode before Xlib invokes exit() */
return 0;
}
static void
{
}
static void *
DispatchX11Events(void *arg)
{
{
{
{
}
}
/* Need to use nanosleep so that lower priority threads can run */
}
}
const X11Functions *
{
static loadingx11 = JNI_FALSE;
int argc = 0;
int policy;
struct sched_param priority;
char *s;
/* Handle the rare cases where this function is recursively called */
if (loadingx11)
return NULL;
/* Don't bother trying to load libraries if a prior attempt failed */
if (nox11)
return NULL;
/* Try to load Motif 2.1 or 1.2 libraries */
if (!libgui
{
goto error;
}
if (!x11funcs)
{
if ((x11funcs->XCloseDisplay = (XCloseDisplay_t)dlsym(libgui, "XCloseDisplay")) == NULL) goto error;
if ((x11funcs->XSetErrorHandler = (XSetErrorHandler_t)dlsym(libgui, "XSetErrorHandler")) == NULL) goto error;
if ((x11funcs->XSetIOErrorHandler = (XSetIOErrorHandler_t)dlsym(libgui, "XSetIOErrorHandler")) == NULL) goto error;
if ((x11funcs->XSetLocaleModifiers = (XSetLocaleModifiers_t)dlsym(libgui, "XSetLocaleModifiers")) == NULL) goto error;
if ((x11funcs->XSupportsLocale = (XSupportsLocale_t)dlsym(libgui, "XSupportsLocale")) == NULL) goto error;
if ((x11funcs->XmCreateErrorDialog = (XmCreateErrorDialog_t)dlsym(libgui, "XmCreateErrorDialog")) == NULL) goto error;
if ((x11funcs->XmCreateInformationDialog = (XmCreateInformationDialog_t)dlsym(libgui, "XmCreateInformationDialog")) == NULL) goto error;
if ((x11funcs->XmCreateTemplateDialog = (XmCreateTemplateDialog_t)dlsym(libgui, "XmCreateTemplateDialog")) == NULL) goto error;
if ((x11funcs->XmMessageBoxGetChild = (XmMessageBoxGetChild_t)dlsym(libgui, "XmMessageBoxGetChild")) == NULL) goto error;
if ((x11funcs->XmStringCreateLtoR = (XmStringCreateLtoR_t)dlsym(libgui, "XmStringCreateLtoR")) == NULL) goto error;
if ((x11funcs->XtAppNextEvent = (XtAppNextEvent_t)dlsym(libgui, "XtAppNextEvent")) == NULL) goto error;
if ((x11funcs->XtAppSetErrorHandler = (XtAppSetErrorHandler_t)dlsym(libgui, "XtAppSetErrorHandler")) == NULL) goto error;
if ((x11funcs->XtAppSetWarningHandler = (XtAppSetWarningHandler_t)dlsym(libgui, "XtAppSetWarningHandler")) == NULL) goto error;
if ((x11funcs->XtDestroyWidget = (XtDestroyWidget_t)dlsym(libgui, "XtDestroyWidget")) == NULL) goto error;
if ((x11funcs->XtDispatchEvent = (XtDispatchEvent_t)dlsym(libgui, "XtDispatchEvent")) == NULL) goto error;
if ((x11funcs->XtManageChild = (XtManageChild_t)dlsym(libgui, "XtManageChild")) == NULL) goto error;
if ((x11funcs->XtRealizeWidget = (XtRealizeWidget_t)dlsym(libgui, "XtRealizeWidget")) == NULL) goto error;
if ((x11funcs->XtScreenOfObject = (XtScreenOfObject_t)dlsym(libgui, "XtScreenOfObject")) == NULL) goto error;
if ((x11funcs->XtUnmanageChild = (XtUnmanageChild_t)dlsym(libgui, "XtUnmanageChild")) == NULL) goto error;
if ((x11funcs->XtVaAppInitialize = (XtVaAppInitialize_t)dlsym(libgui, "XtVaAppInitialize")) == NULL) goto error;
if ((x11funcs->XtVaSetValues = (XtVaSetValues_t)dlsym(libgui, "XtVaSetValues")) == NULL) goto error;
if ((x11funcs->XtWindowOfObject = (XtWindowOfObject_t)dlsym(libgui, "XtWindowOfObject")) == NULL) goto error;
}
/* Return if the initialize display flag is false */
if (!initdisplay)
return x11funcs;
if (appshell)
{
return x11funcs;
}
goto error;
/* Try to make the X11 server's locale match our locale */
if (!x11funcs->XSupportsLocale())
{
/* Reset cached locale */
UpdateLocale();
}
/*
* Don't bother checking return value since this function will terminate
* the application if it fails
*/
appshell = x11funcs->XtVaAppInitialize(&appcontext, (char *)GetTitle(), NULL, 0, &argc, NULL, NULL, NULL);
NULL);
/* Initialize the lock */
if (!dispatch)
{
goto error;
if (pthread_mutexattr_settype(&lockattributes, PTHREAD_MUTEX_RECURSIVE) || pthread_mutex_init(&lock, &lockattributes))
{
goto error;
}
}
/* Create the event loop thread */
goto error;
/* Raise the thread's priority so that it is guaranteed a time slice */
if (pthread_getschedparam(tid, &policy, &priority) || (priority.sched_priority = sched_get_priority_max(policy)) == -1)
goto error;
goto error;
return x11funcs;
if (dispatch)
{
}
/* Close the display and all associated resources */
if (x11funcs)
{
if (display)
}
appcontext = NULL;
statusdialog = NULL;
/* Unload the library */
if (libgui)
return NULL;
}
static void
{
const X11Functions *funcs;
{
Dimension screenwidth = 0;
Dimension screenheight = 0;
Position x = 0;
Position y = 0;
if (funcs->XtIsManaged(w))
else
funcs->XtManageChild(w);
if (screenwidth > width)
if (screenheight > height)
funcs->XtVaSetValues(w,
XmNx, x,
XmNy, y,
NULL);
}
}
static int
{
int ret;
int increment = 1024;
char *message;
const X11Functions *funcs;
int cachedlen = 0;
static char *cachedmessage = NULL;
if (cachedmessage)
for (;;)
{
if (cachedmessage)
{
continue;
}
break;
}
if (cachedmessage)
{
/* Create the status window */
if (!statusdialog)
{
{
goto cleanup;
}
if ((statusdialog = funcs->XmCreateTemplateDialog(appshell, "Status", xargs, XtNumber(xargs))) == NULL)
{
goto cleanup;
}
}
{
/* Chop off trailing newline */
}
else
{
/* If there is no newline, cache message and print later */
ret = 0;
goto cleanup;
}
/* Update and show the status window */
{
goto cleanup;
}
NULL);
if (xtitle)
if (xmessage)
if (err)
}
else
{
}
return ret;
}
static void
{
const X11Functions *funcs;
{
if (statusdialog)
{
}
}
statusdialog = NULL;
}
static int
{
int ret;
int increment = 1024;
char *message;
const X11Functions *funcs;
int cachedlen = 0;
static char *cachedmessage = NULL;
if (cachedmessage)
for (;;)
{
if (cachedmessage)
{
continue;
}
break;
}
if (cachedmessage)
{
{
/* Chop off trailing newline */
}
else
{
/* If there is no newline, cache message and print later */
goto cleanup;
}
/* Create the dialog */
{
goto cleanup;
}
{
goto cleanup;
}
{
goto cleanup;
}
XtSetArg(xargs[4], XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH);
XtSetArg(xargs[5], XmNmwmFunctions, MWM_FUNC_ALL | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE);
if (type == XmDIALOG_INFORMATION)
{
if ((dialog = funcs->XmCreateInformationDialog(appshell, "Information", xargs, XtNumber(xargs))) == NULL)
{
goto cleanup;
}
}
else
{
{
goto cleanup;
}
}
/* Display the dialog */
if (!appcontext)
{
goto cleanup;
}
/* Wait for the user to close the dialog */
{
}
if (xtitle)
if (xmessage)
if (xok)
if (dialog)
if (err)
}
else
{
}
return ret;
}
/*
* Search for a JRE giving priority to JDK installations
*/
char *
{
const char *envvar;
const char *envvar2;
char *jrefoundpath = NULL;
{
bundledjdk = info;
else
bundledjre = info;
}
#ifdef SOLARIS
/* Look in standard Solaris package installation location */
{
{
{
{
}
else
{
}
}
else
{
}
}
}
/* Look in standard Linux RPM installation locations */
{
{
{
{
continue;
{
{
{
{
}
else
{
}
}
else
{
}
}
}
}
}
}
}
#endif
/* Look in the JAVA_HOME and PATH environment variables */
{
char *currentpath;
char *tokstr = (char *)MemAlloc((envvar ? strlen(envvar) + 5 : 0) + (envvar2 ? strlen(envvar2) : 0) + 1);
*path = '\0';
if (envvar)
{
}
if (envvar2)
{
}
while (tokstr)
{
/*
* Look for the Java executable and, if found, find its
* installation directory
*/
*tokstr++ = '\0';
if (strlen(currentpath) == 0)
currentpath = ".";
{
/* Chop off executable name */
/* Chop off last directory name */
{
{
{
}
else
{
}
}
}
}
}
}
/* Make bundled JDK first choice */
if (bundledjdk)
{
if (!jrefoundpath)
else
bundledjdk = NULL;
}
/* Iterate through JDKs and use the one with the highest version */
{
{
}
else
{
}
}
if (jdks)
{
if (!jrefoundpath)
else
}
/* Make bundled JRE the next choice */
if (bundledjre)
{
if (!jrefoundpath)
else
bundledjre = NULL;
}
/* Iterate through JREs and use the one with the highest version */
{
{
}
else
{
}
}
if (jres)
{
if (!jrefoundpath)
else
}
return jrefoundpath;
}
{
/* Does the app ship a private JRE in <apphome>/jre directory? */
{
{
goto found;
}
}
/* Is JRE co-located with the application? */
else
{
{
goto found;
}
}
return isJDK;
}
/* Default to console mode */
{
return printToConsole;
}
void
{
}
int
{
int ret;
else
return ret;
}
int
{
int ret;
{
}
else
{
else
}
return ret;
}
int
{
int ret;
if (format)
{
else
}
return ret;
}
/*
* Mappings from partial locale names to full locale names.
*
* Note: this table is copied from the solaris/native/java/lang/locale_str.h
* header in the J2SE 1.4.1 source code and should be updated as new releases
* of J2SE come out.
*/
static const char *locale_aliases[] = {
"ar", "ar_EG",
"be", "be_BY",
"bg", "bg_BG",
"br", "br_FR",
"ca", "ca_ES",
"cs", "cs_CZ",
"cz", "cs_CZ",
"da", "da_DK",
"de", "de_DE",
"el", "el_GR",
"en", "en_US",
"eo", "eo", /* no country for Esperanto */
"es", "es_ES",
"et", "et_EE",
"eu", "eu_ES",
"fi", "fi_FI",
"fr", "fr_FR",
"ga", "ga_IE",
"gl", "gl_ES",
"he", "iw_IL",
"hr", "hr_HR",
#ifdef LINUX
"hs", "en_US", // used on Linux, not clear what it stands for
#endif
"hu", "hu_HU",
"id", "in_ID",
"in", "in_ID",
"is", "is_IS",
"it", "it_IT",
"iw", "iw_IL",
"ja", "ja_JP",
"kl", "kl_GL",
"ko", "ko_KR",
"lt", "lt_LT",
"lv", "lv_LV",
"mk", "mk_MK",
"nl", "nl_NL",
"no", "no_NO",
"pl", "pl_PL",
"pt", "pt_PT",
"ro", "ro_RO",
"ru", "ru_RU",
#ifdef LINUX
"se", "en_US", // used on Linux, not clear what it stands for
#endif
"sh", "sh_YU",
"sk", "sk_SK",
"sl", "sl_SI",
"sq", "sq_AL",
"sr", "sr_YU",
"su", "fi_FI",
"sv", "sv_SE",
"th", "th_TH",
"tr", "tr_TR",
#ifdef LINUX
"ua", "en_US", // used on Linux, not clear what it stands for
#endif
"uk", "uk_UA",
#ifdef LINUX
"wa", "en_US", // used on Linux, not clear what it stands for
#endif
"zh", "zh_CN",
#ifdef LINUX
"catalan", "ca_ES",
"croatian", "hr_HR",
"czech", "cs_CZ",
"danish", "da_DK",
"dansk", "da_DK",
"deutsch", "de_DE",
"dutch", "nl_NL",
"finnish", "fi_FI",
"fran\xE7\x61is", "fr_FR",
"french", "fr_FR",
"german", "de_DE",
"greek", "el_GR",
"hebrew", "iw_IL",
"hrvatski", "hr_HR",
"hungarian", "hu_HU",
"icelandic", "is_IS",
"italian", "it_IT",
"japanese", "ja_JP",
"norwegian", "no_NO",
"polish", "pl_PL",
"portuguese", "pt_PT",
"romanian", "ro_RO",
"russian", "ru_RU",
"slovak", "sk_SK",
"slovene", "sl_SI",
"slovenian", "sl_SI",
"spanish", "es_ES",
"swedish", "sv_SE",
"turkish", "tr_TR",
#else
"big5", "zh_TW.Big5",
"chinese", "zh_CN",
"japanese", "ja_JP",
"tchinese", "zh_TW",
#endif
""
};
/*
*
* Note: this table is copied from the solaris/native/java/lang/locale_str.h
* header in the J2SE 1.4.1 source code and should be updated as new releases
* of J2SE come out.
*/
static const char *language_names[] = {
"C", "en",
"POSIX", "en",
"ar", "ar",
"be", "be",
"bg", "bg",
"br", "br",
"ca", "ca",
"cs", "cs",
"cz", "cs",
"da", "da",
"de", "de",
"el", "el",
"en", "en",
"eo", "eo",
"es", "es",
"et", "et",
"eu", "eu",
"fi", "fi",
"fo", "fo",
"fr", "fr",
"ga", "ga",
"gl", "gl",
"hi", "hi",
"he", "iw",
"hr", "hr",
#ifdef LINUX
"hs", "en", // used on Linux, not clear what it stands for
#endif
"hu", "hu",
"id", "in",
"in", "in",
"is", "is",
"it", "it",
"iw", "iw",
"ja", "ja",
"kl", "kl",
"ko", "ko",
"lt", "lt",
"lv", "lv",
"mk", "mk",
"nl", "nl",
"no", "no",
"nr", "nr",
"pl", "pl",
"pt", "pt",
"ro", "ro",
"ru", "ru",
#ifdef LINUX
"se", "en", // used on Linux, not clear what it stands for
#endif
"sh", "sh",
"sk", "sk",
"sl", "sl",
"sq", "sq",
"sr", "sr",
"su", "fi",
"sv", "sv",
"th", "th",
"tr", "tr",
#ifdef LINUX
"ua", "en", // used on Linux, not clear what it stands for
#endif
"uk", "uk",
#ifdef LINUX
"wa", "en", // used on Linux, not clear what it stands for
#endif
"zh", "zh",
#ifdef LINUX
"catalan", "ca",
"croatian", "hr",
"czech", "cs",
"danish", "da",
"dansk", "da",
"deutsch", "de",
"dutch", "nl",
"finnish", "fi",
"fran\xE7\x61is", "fr",
"french", "fr",
"german", "de",
"greek", "el",
"hebrew", "iw",
"hrvatski", "hr",
"hungarian", "hu",
"icelandic", "is",
"italian", "it",
"japanese", "ja",
"norwegian", "no",
"polish", "pl",
"portuguese", "pt",
"romanian", "ro",
"russian", "ru",
"slovak", "sk",
"slovene", "sl",
"slovenian", "sl",
"spanish", "es",
"swedish", "sv",
"turkish", "tr",
#else
"chinese", "zh",
"japanese", "ja",
"korean", "ko",
#endif
"",
};
/*
*
* Note: this table is copied from the solaris/native/java/lang/locale_str.h
* header in the J2SE 1.4.1 source code and should be updated as new releases
* of J2SE come out.
*/
static const char *country_names[] = {
"AT", "AT",
"AU", "AU",
"AR", "AR",
"BE", "BE",
"BR", "BR",
"BO", "BO",
"CA", "CA",
"CH", "CH",
"CL", "CL",
"CN", "CN",
"CO", "CO",
"CR", "CR",
"CZ", "CZ",
"DE", "DE",
"DK", "DK",
"DO", "DO",
"EC", "EC",
"EE", "EE",
"ES", "ES",
"FI", "FI",
"FO", "FO",
"FR", "FR",
"GB", "GB",
"GR", "GR",
"GT", "GT",
"HN", "HN",
"HR", "HR",
"HU", "HU",
"ID", "ID",
"IE", "IE",
"IL", "IL",
"IN", "IN",
"IS", "IS",
"IT", "IT",
"JP", "JP",
"KR", "KR",
"LT", "LT",
"LU", "LU",
"LV", "LV",
"MX", "MX",
"NI", "NI",
"NL", "NL",
"NO", "NO",
"NZ", "NZ",
"PA", "PA",
"PE", "PE",
"PL", "PL",
"PT", "PT",
"PY", "PY",
#ifdef LINUX
"RN", "US", // used on Linux, not clear what it stands for
#endif
"RO", "RO",
"RU", "RU",
"SE", "SE",
"SI", "SI",
"SK", "SK",
"SV", "SV",
"TH", "TH",
"TR", "TR",
"UA", "UA",
"UK", "GB",
"US", "US",
"UY", "UY",
"VE", "VE",
"TW", "TW",
"YU", "YU",
"",
};
/*
*
* Note: this table is copied from the solaris/native/java/lang/locale_str.h
* header in the J2SE 1.4.1 source code and should be updated as new releases
* of J2SE come out.
*/
static const char *variant_names[] = {
#ifdef LINUX
"nynorsk", "NY",
#endif
"",
};
/*
* Take an array of string pairs (map of key->value) and a string (key).
* Examine each pair in the map to see if the first string (key) matches the
* string. If so, store the second string of the pair (value) in the value and
* return 1. Otherwise do nothing and return 0. The end of the map is
* indicated by an empty string at the start of a pair (key of "").
*/
static int
int i;
{
{
return 1;
}
}
return 0;
}
static const char *
{
if (locale)
return GetLocale();
}
/* Use native strrchr to avoid recursive calls to this function */
const char *
{
/* Use native strrchr to avoid recursive calls to this function */
if (!locale)
{
const char *lc;
char *s;
char *t;
const char *language = "en";
/* Set the locale to the users current locale */
/*
* Using the UTF-8 or utf8 encodings is not handled well when xhosting
* so chop it off.
*/
*s = '\0';
*s = '\0';
s = NULL;
free(t);
t = NULL;
#ifdef SOLARIS
/*
* Xlib on Solaris does not handle the "@euro" variant very well so
* chop it off.
*/
*s = '\0';
s = NULL;
free(t);
t = NULL;
#endif
/* Parse the language, country, encoding, and variant from the
* locale. Any of the elements may be missing, but they must occur
* in the order language_country.encoding@variant, and must be
* preceded by their delimiter (except for language).
*
* If the locale name (without .encoding@variant, if any) matches
* any of the names in the locale_aliases list, map it to the
* corresponding full locale name. Most of the entries in the
* locale_aliases list are locales that include a language name but
* no country name, and this facility is used to map each language
* to a default country if that's possible. It's also used to map
* the Solaris locale aliases to their proper Java locale IDs.
*/
/* Get and normalize the variant */
{
*t++ = '\0';
}
/* Skip the encoding */
*t++ = '\0';
/* Get and normalize the country */
{
free(s);
}
{
*t++ = '\0';
}
/* Get and normalize the language */
free(s);
s = NULL;
/* Create the full locale string */
locale = (char *)MemAlloc((language ? strlen(language) : 0) + (country ? strlen(country) : 0) + (variant ? strlen(variant) : 0) + 3);
if (country)
{
}
if (variant)
{
if (!country)
}
}
return locale;
}
IsMultiByteChar(const char *s, int pos)
{
int curpos = 0;
if (!pos)
return JNI_TRUE;
/* Make sure charset is set */
GetLocale();
/* Make sure that preceding character is not a multi-byte character */
{
int charsize;
return JNI_FALSE;
}
return JNI_TRUE;
else
return JNI_FALSE;
}
/*
* Check if the path is executable.
*/
IsExecutable(const char *path)
{
return JNI_TRUE;
else
return JNI_FALSE;
}
/*
* Find a command in a directory, returning the path.
*/
char *
{
if (parent)
{
}
else
{
}
{
}
else
{
}
return path;
}
char *
CheckJREVersion(const char *path)
{
{
int fdout[2];
int info;
int i;
return NULL;
/* Flush all open streams before forking */
/* Child process */
{
char *cmdv[3];
/* Connect output stream to pipe */
/* Close input and output streams to avoid hanging */
/*
* Make sure debug statements are suppressed by passing an empty
* environment
*/
}
/* If child exited with a 0 exit status, the check passed */
#ifdef LINUX
#else
if (pid > 0 && waitpid(pid, &info, 0) >= 0 && WIFEXITED(info) && fstat(fdout[0], &sb) == 0 && sb.st_size > 0)
#endif
{
/*
* Read the first line of output. We only need to read once since
* the standard pipe buffer size is far larger than the longest
* version string.
*/
if (bytes < 0)
bytes = 0;
/* Chop off any garbage after the first newline */
*str = '\0';
/* Parse version string */
*str = '\0';
{
*str++ = '\0';
}
if (!CheckVersion(version))
{
}
}
}
return version;
}
/*
* Execute a Java subprocess with the specified arguments.
*/
int
ExecuteJava(const char *jrepath, int numOptions, const JavaVMOption *options,int numProps, const JavaPropsOption *props)
{
int i;
int j;
const char* class = GetJavaClassName();
int info;
int ret = 1;
unsigned int sec = 10;
/*
if (!CheckJavaClassFile(class))
{
char *key = NULL;
char *message = NULL;
key = GetMessageKeyPrefix("no_files");
message = GetLocalizedMessage(key);
free(key);
key = NULL;
fprintf(stderr, message);
free(message);
message = NULL;
return ret;
}
*/
if (!IsExecutable(command))
{
return ret;
}
j = 0;
/*
cmdv[j++] = "-client";
*/
for (i = 0; i < numOptions; i++) {
}
for (i = 0; i < numProps; i++) {
}
/* Flush all open streams before forking */
/* Child process */
{
}
/*
Grab child's exit status
*/
if (pid > 0)
{
/*Wait a few seconds to display the status dialog */
;
/*
if (!console)
{
HideStatusWindow();
}
*/
}
else
{
}
return ret;
}
/*
* Perform recursive deletion of a file or directory. Note: don't use MemAlloc
* function here since this is called from an exit handler.
*/
void
{
int i;
return;
filename++;
/* Ignore special directory entries */
{
return;
}
/* Chop off any trailing file separator */
{
{
if (newpath)
}
}
/* Ignore files in the save list */
{
return;
}
/* Use lstat so that we don't recurse into softlinks to diretories */
{
{
{
char entrypath[2048];
{
}
}
}
}
}
/* used to invoke the upgrade tool in console mode*/
int
InvokeUpgradeTool(const char *invokerPath)
{
int ret = -1;
char * cmdv[2];
}
if ( pid > 0) {
}
}
return ret;
}