[uim-commit] r1174 - trunk/fep

yamamoto at freedesktop.org yamamoto at freedesktop.org
Wed Aug 10 02:06:51 EST 2005


Author: yamamoto
Date: 2005-08-09 09:06:48 -0700 (Tue, 09 Aug 2005)
New Revision: 1174

Modified:
   trunk/fep/README.ja
   trunk/fep/uim-fep.c
Log:
 * fep/uim-fep.c (main) :
   change the values of UIM_FEP_SETMODE and UIM_FEP_GETMODE


Modified: trunk/fep/README.ja
===================================================================
--- trunk/fep/README.ja	2005-08-09 06:22:24 UTC (rev 1173)
+++ trunk/fep/README.ja	2005-08-09 16:06:48 UTC (rev 1174)
@@ -159,13 +159,23 @@
   o -S
     GNU screen¤Ç¥Õ¥£¥ë¥¿¤È¤·¤Æ»È¤¨¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£(GNU screen 4.0.2°Ê¹ß)
     Î㤨¤Ð¡¢~/.screenrc¤Ë
+
     bind J exec | uim-fep -S
     bind K eval 'exec cat' kill redisplay
+
     ¤³¤Î¤è¤¦¤Ë½ñ¤±¤Ð¡¢C-a J¤Çuim-fep¤ò¥Õ¥£¥ë¥¿¤È¤·¤Æµ¯Æ°¤·¡¢C-a K
     ¤Ç½ªÎ»¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
+
     -s¥ª¥×¥·¥ç¥ó¤Ë¤«¤«¤ï¤é¤º¥â¡¼¥Éɽ¼¨¤Ë¤Ï
     backtick¤¬»È¤ï¤ì¤Þ¤¹¡£
 
+    UIM_FEP_SETMODE, UIM_FEP_GETMODE¤ÎÃͤÏ
+    $TMP/uim-fep-setmode-$STY-$WINDOW
+    $TMP/uim-fep-getmode-$STY-$WINDOW
+    ¤Ë¤Ê¤ê¤Þ¤¹¡£
+    ($TMP¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï/tmp¤¬»È¤ï¤ì¤ë)
+
+
   o -d
     ¸õÊä°ìÍ÷¤Îɽ¼¨¥¹¥¿¥¤¥ë¤òddskk¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
 

Modified: trunk/fep/uim-fep.c
===================================================================
--- trunk/fep/uim-fep.c	2005-08-09 06:22:24 UTC (rev 1173)
+++ trunk/fep/uim-fep.c	2005-08-09 16:06:48 UTC (rev 1174)
@@ -224,6 +224,9 @@
     UNDEFINED  /* background */
   };
   FILE *fp;
+  const char *tmp_dir;
+  const char *sty_str;
+  const char *win_str;
 
   int op;
 
@@ -371,18 +374,24 @@
   tcgetattr(g_win_in, &s_save_tios);
   setupterm(NULL, g_win_out, NULL);
 
-  if (getenv("TMP")) {
-    struct passwd *pw = getpwuid(getuid());
-    /* Generate get mode filepath */
-    snprintf(s_path_getmode, sizeof(s_path_getmode), "%s/uim-fep-%s-%d-getmode", getenv("TMP"), pw->pw_name, getpid());
-    /* Generate set mode filepath */
-    snprintf(s_path_setmode, sizeof(s_path_setmode), "%s/uim-fep-%s-%d-setmode", getenv("TMP"), pw->pw_name, getpid());
+  if ((tmp_dir = getenv("TMP")) == NULL) {
+    tmp_dir = "/tmp";
+  }
+
+  if (gnu_screen && (sty_str = getenv("STY")) != NULL && (win_str = getenv("WINDOW")) != NULL) {
+    snprintf(s_path_getmode, sizeof(s_path_getmode), "%s/uim-fep-getmode-%s-%s", tmp_dir, sty_str, win_str);
+    snprintf(s_path_setmode, sizeof(s_path_setmode), "%s/uim-fep-setmode-%s-%s", tmp_dir, sty_str, win_str);
   } else {
-    struct passwd *pw = getpwuid(getuid());
-    /* Generate get mode filepath */
-    snprintf(s_path_getmode, sizeof(s_path_getmode), "/tmp/uim-fep-%s-%d-getmode", pw->pw_name, getpid());
-    /* Generate set mode filepath */
-    snprintf(s_path_setmode, sizeof(s_path_setmode), "/tmp/uim-fep-%s-%d-setmode", pw->pw_name, getpid());
+    struct stat stat_buf;
+    int file_suffix = 1;
+
+    snprintf(s_path_getmode, sizeof(s_path_getmode), "%s/uim-fep-getmode-%d", tmp_dir, getpid());
+    snprintf(s_path_setmode, sizeof(s_path_setmode), "%s/uim-fep-setmode-%d", tmp_dir, getpid());
+    while (stat(s_path_getmode, &stat_buf) == 0 && stat(s_path_setmode, &stat_buf) == 0) {
+      snprintf(s_path_getmode, sizeof(s_path_getmode), "%s/uim-fep-getmode-%d-%d", tmp_dir, getpid(), file_suffix);
+      snprintf(s_path_setmode, sizeof(s_path_setmode), "%s/uim-fep-setmode-%d-%d", tmp_dir, getpid(), file_suffix);
+      file_suffix++;
+    }
   }
 
   env_buf = malloc(30);
@@ -882,6 +891,10 @@
   if (g_opt.status_type == LASTLINE) {
     win->ws_row--;
   }
+#ifdef PTY_TEST
+  win->ws_col = 140;
+  win->ws_row = 50;
+#endif
   return win;
 }
 



More information about the uim-commit mailing list