Author: yamamoto
Date: Tue Aug  9 09:06:48 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 (original)
+++ trunk/fep/README.ja Tue Aug  9 09:06:48 2005
@@ -159,12 +159,22 @@
   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 (original)
+++ trunk/fep/uim-fep.c Tue Aug  9 09:06:48 2005
@@ -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;
 }
 

Reply via email to