[uim-commit] r666 - trunk/fep

yamamoto at freedesktop.org yamamoto at freedesktop.org
Wed Feb 16 06:31:31 PST 2005


Author: yamamoto
Date: 2005-02-16 06:31:28 -0800 (Wed, 16 Feb 2005)
New Revision: 666

Modified:
   trunk/fep/str.c
   trunk/fep/uim-fep.c
Log:
 * fep/uim-fep.c(usage): use get_enc() instead of NULL


Modified: trunk/fep/str.c
===================================================================
--- trunk/fep/str.c	2005-02-16 06:04:00 UTC (rev 665)
+++ trunk/fep/str.c	2005-02-16 14:31:28 UTC (rev 666)
@@ -81,14 +81,14 @@
  */
 const char *get_enc(void)
 {
-  const char *locale;
-  if ((locale = setlocale(LC_CTYPE, "")) != NULL) {
-    if (strcasecmp(locale, "ja") == 0) {
-      return "EUC-JP";
-    } else {
-      char *ptr = strstr(locale, ".");
-      return ptr != NULL ? ptr + 1 : "UTF-8";
-    }
+  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";
   }
   return "UTF-8";
 }

Modified: trunk/fep/uim-fep.c
===================================================================
--- trunk/fep/uim-fep.c	2005-02-16 06:04:00 UTC (rev 665)
+++ trunk/fep/uim-fep.c	2005-02-16 14:31:28 UTC (rev 666)
@@ -232,6 +232,7 @@
   }
   command[1] = NULL;
 
+  init_str();
   engine = get_default_im_name();
 
   while ((op = getopt(argc, argv, "e:s:u:b:w:t:C:Sciovh")) != -1) {
@@ -353,8 +354,6 @@
     return EXIT_FAILURE;
   }
 
-  init_str();
-
   tcgetattr(g_win_in, &s_save_tios);
   setupterm(NULL, g_win_out, NULL);
 
@@ -921,7 +920,7 @@
   int max_im_name_len = 0;
 
   uim_init();
-  context = uim_create_context(NULL, NULL, NULL, NULL, uim_iconv, commit_cb);
+  context = uim_create_context(NULL, get_enc(), NULL, NULL, uim_iconv, commit_cb);
 
   printf("usage: uim-fep [OPTIONS]\n"
       "\n"



More information about the Uim-commit mailing list