[uim-commit] r887 - in trunk: . fep
ekato at freedesktop.org
ekato at freedesktop.org
Thu Jun 16 20:32:13 PDT 2005
Author: ekato
Date: 2005-06-16 20:32:09 -0700 (Thu, 16 Jun 2005)
New Revision: 887
Modified:
trunk/configure.ac
trunk/fep/str.c
Log:
* configure.ac : Use AM_LANGINFO_CODESET instead of checking
langinfo.h. Fix some duplicate check with AC_CHECK_HEADERS.
* fep/str.c (get_enc): Restore old code for system without
nl_langinfo(CODESET);
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-06-16 11:54:44 UTC (rev 886)
+++ trunk/configure.ac 2005-06-17 03:32:09 UTC (rev 887)
@@ -162,13 +162,15 @@
fi
AM_CONDITIONAL(WITH_XFT, test x"$XFT" = "xtrue")
+# for uim-fep
+AM_LANGINFO_CODESET
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h unistd.h])
-AC_CHECK_HEADERS([langinfo.h stdlib.h string.h sys/ioctl.h sys/socket.h termios.h unistd.h wchar.h])
-AC_CHECK_HEADERS([sys/time.h sys/stat.h sys/un.h getopt.h assert.h signal.h term.h ncurses/term.h ctype.h pwd.h stdarg.h fcntl.h])
+AC_CHECK_HEADERS([string.h sys/ioctl.h sys/socket.h termios.h wchar.h])
+AC_CHECK_HEADERS([sys/time.h sys/stat.h sys/un.h getopt.h assert.h signal.h term.h ncurses/term.h ctype.h pwd.h stdarg.h])
AC_CHECK_HEADERS([pty.h utmp.h util.h libutil.h])
AC_CHECK_HEADERS([curses.h stropts.h])
AC_CHECK_HEADERS([sys/param.h strings.h])
Modified: trunk/fep/str.c
===================================================================
--- trunk/fep/str.c 2005-06-16 11:54:44 UTC (rev 886)
+++ trunk/fep/str.c 2005-06-17 03:32:09 UTC (rev 887)
@@ -59,7 +59,7 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_LANGINFO_H
+#ifdef HAVE_LANGINFO_CODESET
#include <langinfo.h>
#endif
#include "uim-fep.h"
@@ -87,8 +87,20 @@
#ifdef __CYGWIN32__
return "EUC-JP";
#else
+#ifdef HAVE_LANGINFO_CODESET
return nl_langinfo(CODESET);
+#else
+ const char *locale = setlocale(LC_CTYPE, NULL);
+ assert(locale != NULL);
+
+ if (strcasecmp(locale, "ja") == 0) {
+ return "EUC-JP";
+ } else {
+ char *ptr = strstr(locale, ".");
+ return ptr != NULL ? ptr + 1 : "UTF-8";
+ }
#endif
+#endif
}
/*
More information about the uim-commit
mailing list