$OpenBSD: patch-j2se_src_solaris_native_java_lang_java_props_md_c,v 1.1.1.1 2005/05/25 17:27:53 kurt Exp $
--- j2se/src/solaris/native/java/lang/java_props_md.c.orig	Tue Jan 25 22:14:53 2005
+++ j2se/src/solaris/native/java/lang/java_props_md.c	Tue Jan 25 22:16:09 2005
@@ -14,7 +14,10 @@
 #ifndef ARCH
 #include <sys/systeminfo.h>	/* For os_arch */
 #endif
+#ifndef __OpenBSD__
+#define HAVE_NL_LANGINFO
 #include <langinfo.h>           /* For nl_langinfo */
+#endif
 #include <sys/utsname.h>	/* For os_name and os_version */
 #include <stdlib.h>
 #include <string.h>
@@ -196,7 +199,7 @@ GetJavaProperties(JNIEnv *env)
     {
         char *lc;
         lc = setlocale(LC_CTYPE, "");
-#if defined(_ALLBSD_SOURCE)
+#if defined(_ALLBSD_SOURCE) && defined(HAVE_NL_LANGINFO)
 	if (lc == NULL) {
 	    lc = "C";
 	}
@@ -329,6 +332,7 @@ GetJavaProperties(JNIEnv *env)
              * converter for such locales.
 	     */
 #if defined(_ALLBSD_SOURCE)
+#  if defined(HAVE_NL_LANGINFO)
 	    p = nl_langinfo(CODESET);
 	    if (p == NULL || *p == '\0' ||
 			!strcmp(p, "C") || !strcmp(p, "US-ASCII")) {
@@ -338,6 +342,24 @@ GetJavaProperties(JNIEnv *env)
 		if (p == NULL)
 		    p = "";	/* strdup failed */
 	    }
+#  else
+	    if (encoding) {
+		std_encoding = encoding;
+		if (!strcmp(encoding, "EUC") && std_country) {
+		    snprintf(encoding_variant, sizeof(encoding_variant) - 1,
+			     "%s_%s", encoding, std_country);
+		    encoding_variant[sizeof(encoding_variant) - 1] = '\0';
+		    std_encoding = encoding_variant;
+		}
+		p = strdup(std_encoding);
+		if (p == NULL) {
+		    /* strdup failed */
+		    p = "";
+		}
+	    } else {
+		p = "";
+	    }
+#  endif /* HAVE_NL_LANGINFO */
 #else
 	    /* OK, not so reliable - nl_langinfo() gives wrong answers on
 	     * Euro locales, in particular. */
