しらいです。

 file & directory 管理ツール FDclone 2.08d の patch その 1
です。

Submitted-by: shirai@chandra2
Archive-name: FD-2.08d.patch/part01

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is FD-2.08d.patch, a shell archive (produced by GNU sharutils 4.2)
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2006-06-13 00:00 JST by <shirai@chandra2>.
# Source directory was `/usr/home/shirai/src/fd2'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This is part 1 of a multipart archive.                                   
# Do not concatenate these parts, unpack them in order with `/bin/sh'.     
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#  55440 -rw-r--r-- FD-2.08d.patch
#
echo=echo
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh02637; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
if test -r _sh02637/seq; then
  $echo 'Must unpack archives in sequence!'
  $echo 'Please unpack part' '`cat _sh02637/seq`' 'next!'
  exit 1
fi
# ============= FD-2.08d.patch ==============
if test -f 'FD-2.08d.patch' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'FD-2.08d.patch' '(file already exists)'
  rm -f _sh02637/new
else
  > _sh02637/new
  $echo 'x -' extracting 'FD-2.08d.patch' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'FD-2.08d.patch' &&
diff -urNP ../FD-2.08c/HISTORY ./HISTORY
--- ../FD-2.08c/HISTORY Wed May 24 00:00:00 2006
+++ ./HISTORY   Tue Jun 13 00:00:00 2006
@@ -1,3 +1,8 @@
+Ver. 2.08d     疑似端末のコマンドラインから日本語入力できなかった点を修正。
+ (06/13/06)    コマンドラインから仮名入力できなかった点を修正。
+               履歴インクリメンタルサーチ時の表示がおかしかった点を修正。
+               NFS 上の履歴セーブファイルがデッドロックに陥る点を修正。
+
X Ver. 2.08c    NFS 上のコマンド履歴セーブファイルが消されてしまう点を修正。
X  (05/24/06)   全てのアーカイブファイルサイズを 0 と表示してしまう OS に対応。
X 
diff -urNP ../FD-2.08c/HISTORY.eng ./HISTORY.eng
--- ../FD-2.08c/HISTORY.eng     Wed May 24 00:00:00 2006
+++ ./HISTORY.eng       Tue Jun 13 00:00:00 2006
@@ -1,3 +1,8 @@
+Ver. 2.08d     Bug that command line rejects any Japanese on the pty is fixed.
+ (06/13/06)    Bug that command line rejects any Kana is fixed.
+               Mis-indicating for the incremental history search is fixed.
+               Bug that the history file on NFS is deadlocked is fixed.
+
X Ver. 2.08c    Bug that the command history file on NFS is truncated is fixed.
X  (05/24/06)   Support some OSs displaying every archived file size as 0.
X 
diff -urNP ../FD-2.08c/Makefile ./Makefile
--- ../FD-2.08c/Makefile        Wed May 24 00:00:00 2006
+++ ./Makefile  Tue Jun 13 00:00:00 2006
@@ -2,7 +2,8 @@
X #     Makefile for fd
X #
X 
-VERMAJ = 2
+VERSION        = 2
+VERMAJ = $(VERSION)
X PREFIX        = /usr/local
X CONFDIR       = /etc
X BUILD =
diff -urNP ../FD-2.08c/README ./README
--- ../FD-2.08c/README  Wed May 24 00:00:00 2006
+++ ./README    Tue Jun 13 00:00:00 2006
@@ -3,7 +3,7 @@
X #     FDclone Ver. 2.08 に関して
X #
X #     Takashi SHIRAI, <shirai@unixusers.net>
-#      May 24, 2006
+#      Jun 13, 2006
X #
X ############################################################
X 
diff -urNP ../FD-2.08c/README.eng ./README.eng
--- ../FD-2.08c/README.eng      Wed May 24 00:00:00 2006
+++ ./README.eng        Tue Jun 13 00:00:00 2006
@@ -3,7 +3,7 @@
X #     About FDclone Ver. 2.08
X #
X #     Takashi SHIRAI, <shirai@unixusers.net>
-#      May 24, 2006
+#      Jun 13, 2006
X #
X ############################################################
X 
diff -urNP ../FD-2.08c/_fdrc ./_fdrc
--- ../FD-2.08c/_fdrc   Wed May 24 00:00:00 2006
+++ ./_fdrc     Tue Jun 13 00:00:00 2006
@@ -77,7 +77,7 @@
X #     Default: 50
X #DIRHIST=50
X 
-# size of saved history
+# size of saved command history
X #     Default: 50
X #SAVEHIST=50
X 
diff -urNP ../FD-2.08c/_fdrc.dif ./_fdrc.dif
--- ../FD-2.08c/_fdrc.dif       Wed May 24 00:00:00 2006
+++ ./_fdrc.dif Tue Jun 13 00:00:00 2006
@@ -77,7 +77,8 @@
X -#DIRHIST             =       50
X +#DIRHIST=50
X  
- # size of saved history
+-# size of saved history
++# size of saved command history
X  #    Default: 50
X -#SAVEHIST    =       50
X +#SAVEHIST=50
diff -urNP ../FD-2.08c/backend.c ./backend.c
--- ../FD-2.08c/backend.c       Wed May 24 00:00:00 2006
+++ ./backend.c Tue Jun 13 00:00:00 2006
@@ -20,7 +20,6 @@
X #define       MAXESCPARAM     16
X #define       MAXESCCHAR      4
X #define       MAXTABSTOP      255
-#define        MAXKANJIBUF     (3 + 2 + 3)
X 
X typedef struct _ptyterm_t {
X       short cur_x, cur_y;
@@ -665,7 +664,7 @@
X               return;
X       }
X 
-       switch(c) {
+       switch (c) {
X               case 'A':
X                       if (pty[w].escmode != ']') break;
X                       n = pty[w].escparam[0];
@@ -1145,9 +1144,9 @@
X                       surelocate(MAXWINDOWS, 0);
X                       settermattr(MAXWINDOWS);
X                       settermcode(MAXWINDOWS);
-                       putch2(w1);
-                       (pty[MAXWINDOWS].cur_x)++;
-                       last_x++;
+                       i = cprintf2("%c", w1);
+                       pty[MAXWINDOWS].cur_x += i;
+                       last_x += i;
X                       tflush();
X                       break;
X               case TE_CPUTS2:
@@ -1157,9 +1156,9 @@
X                               settermattr(MAXWINDOWS);
X                               settermcode(MAXWINDOWS);
X                               s[w1] = '\0';
-                               cputs2(s);
-                               pty[MAXWINDOWS].cur_x += w1;
-                               last_x += w1;
+                               i = cprintf2("%s", s);
+                               pty[MAXWINDOWS].cur_x += i;
+                               last_x += i;
X                               tflush();
X                       }
X                       free(s);
@@ -1374,7 +1373,7 @@
X # ifdef       _NOKANJICONV
X       else if (isekana2(key.code)) {
X # else
-       else if (inputkcode == EUC && isekana2(key.code)) {
+       else if (incode == EUC && isekana2(key.code)) {
X               if (incode != outcode) cnv++;
X # endif
X               key.len = (u_char)2;
@@ -1399,7 +1398,7 @@
X               buf[0] = key.code;
X #ifndef       _NOKANJICONV
X               if (incode == outcode) /*EMPTY*/;
-               else if (inputkcode == SJIS && iskana2(key.code)) cnv++;
+               else if (incode == SJIS && iskana2(key.code)) cnv++;
X               else if (code == UTF8) {
X                       if (!ismsb(key.code)) /*EMPTY*/;
X                       else if ((n = ptygetch(fd)) >= 0) {
@@ -1413,7 +1412,7 @@
X                               }
X                       }
X               }
-               else if (isinkanji1(key.code, inputkcode)
+               else if (isinkanji1(key.code, incode)
X               && (n = ptygetch(fd)) >= 0) {
X                       cnv++;
X                       buf[1] = n;
@@ -1438,7 +1437,7 @@
X int backend(VOID_A)
X {
X       char result[MAXWINDOWS + 1];
-       int i, n, fds[MAXWINDOWS + 1];
+       int i, n, x, y, fds[MAXWINDOWS + 1];
X 
X       hideclock = -1;
X       dumbterm = 1;
@@ -1463,8 +1462,17 @@
X               if (selectpty(MAXWINDOWS + 1, fds, result, -1) <= 0) continue;
X 
X               if (result[MAXWINDOWS] && (n = evalinput(emufd)) > 0) continue;
+
+               x = last_x;
+               y = last_y;
X               for (i = 0; i < MAXWINDOWS; i++)
X                       if (result[i] && ptylist[i].pid) evaloutput(i);
+
+               if (win < MAXWINDOWS) /* EMPTY*/;
+               else if (x != last_x || y != last_y) {
+                       surelocate(MAXWINDOWS, 0);
+                       tflush();
+               }
X       }
X 
X       surelocate(MAXWINDOWS, 0);
diff -urNP ../FD-2.08c/browse.c ./browse.c
--- ../FD-2.08c/browse.c        Wed May 24 00:00:00 2006
+++ ./browse.c  Tue Jun 13 00:00:00 2006
@@ -95,6 +95,7 @@
X static VOID NEAR infobar __P_((VOID_A));
X static int NEAR calclocate __P_((int));
X static int NEAR calcfilepos __P_((namelist *, int, char *));
+static int NEAR listupmyself __P_((char *));
X #ifndef       _NOSPLITWIN
X static int NEAR listupwin __P_((char *));
X #endif
@@ -129,13 +130,23 @@
X char *macrolist[MAXMACROTABLE];
X int maxmacro = 0;
X int isearch = 0;
-char *helpindex[10] = {
+char *helpindex[MAXHELPINDEX] = {
X #ifdef        _NOTREE
-       "help", "eXec", "Copy", "Delete", "Rename",
-       "Sort", "Find", "Logdir", "Editor", "Unpack"
+       "help",
X #else
-       "Logdir", "eXec", "Copy", "Delete", "Rename",
-       "Sort", "Find", "Tree", "Editor", "Unpack"
+       "Logdir",
+#endif
+       "eXec", "Copy", "Delete", "Rename", "Sort", "Find",
+#ifdef _NOTREE
+       "Logdir",
+#else
+       "Tree",
+#endif
+       "Editor",
+#ifdef _NOARCHIVE
+       "",
+#else
+       "Unpack",
X #endif
X };
X char typesymlist[] = "dbclsp";
@@ -278,30 +289,35 @@
X 
X VOID helpbar(VOID_A)
X {
-       int i, j, col, gap, width, len, ofs;
+       int i, j, col, gap, width, len, ofs, max, blk, rest;
+
+       max = MAXHELPINDEX;
+       blk = 5;
X 
X       if (ishardomit()) {
-               col = n_column + 1;
+               col = n_column;
X               gap = 0;
X       }
X       else if (iswellomit()) {
-               col = n_column + 1;
+               col = n_column;
X               gap = 1;
X       }
X       else if (isrightomit()) {
-               col = n_column + 1;
+               col = n_column;
X               gap = 2;
X       }
X       else if (isleftshift()) {
-               col = n_column + 1;
+               col = n_column;
X               gap = 3;
X       }
X       else {
-               col = n_column;
+               col = n_column - 1;
X               gap = 3;
X       }
-       width = (col - 4 - gap * 2) / 10 - 1;
-       ofs = (col - (width + 1) * 10 - 2) / 2;
+
+       rest = max - 1 + gap * ((max - 1) / blk);
+       width = (col - 4 - rest) / max;
+       ofs = (n_column - width * max - rest) / 2;
X       if (ofs < 4) ofs = 4;
X 
X       Xlocate(0, L_HELP);
@@ -313,9 +329,9 @@
X       Xputch2(isfileflg(dispmode) ? 'F' : ' ');
X #endif
X 
-       for (i = 0; i < 10; i++) {
-               Xlocate(ofs + (width + 1) * i + (i / 5) * gap, L_HELP);
-               len = (width - strlen2(helpindex[i])) / 2;
+       for (i = 0; i < max; i++) {
+               Xlocate(ofs + (width + 1) * i + (i / blk) * gap, L_HELP);
+               len = (width - strlen2(helpindex[i]) + 1) / 2;
X               if (len < 0) len = 0;
X               Xputterm(T_STANDOUT);
X               for (j = 0; j < len; j++) Xputch2(' ');
@@ -1141,6 +1157,27 @@
X       return(pos);
X }
X 
+static int NEAR listupmyself(def)
+char *def;
+{
+#ifndef        _NOTREE
+       if (treepath) rewritetree();
+       else
+#endif
+#ifndef        _NOCUSTOMIZE
+       if (custno >= 0) rewritecust();
+       else
+#endif
+#ifndef        _NOPTY
+       if (ptylist[win].pid && ptylist[win].status < 0) /*EMPTY*/;
+       else
+#endif
+       if (filelist && (filepos < maxfile || (!filepos && !maxfile)))
+               return(listupfile(filelist, maxfile, def, 1));
+
+       return(-1);
+}
+
X #ifndef       _NOSPLITWIN
X static int NEAR listupwin(def)
X char *def;
@@ -1167,17 +1204,7 @@
X       n = -1;
X       for (win = 0; win < windows; win++) {
X               if (win == dupwin) {
-# ifndef       _NOTREE
-                       if (treepath) rewritetree();
-                       else
-# endif
-# ifndef       _NOCUSTOMIZE
-                       if (custno >= 0) rewritecust();
-                       else
-# endif
-                       if (filelist
-                       && (filepos < maxfile || (!filepos && !maxfile)))
-                               n = listupfile(filelist, maxfile, def, 1);
+                       n = listupmyself(def);
X                       x = win_x;
X                       y = win_y;
X               }
@@ -1308,20 +1335,10 @@
X       pathbar();
X       if (all >= 0) {
X #ifdef        _NOSPLITWIN
-# ifndef       _NOTREE
-               if (treepath) rewritetree();
-               else
-# endif
-# ifndef       _NOCUSTOMIZE
-               if (custno >= 0) rewritecust();
-               else
-# endif
-               if (filelist && filepos < maxfile)
-                       listupfile(filelist, maxfile,
-                               filelist[filepos].name, 1);
-#else  /* !_NOSPLITWIN */
+               listupmyself(filelist[filepos].name);
+#else
X               listupwin(filelist[filepos].name);
-#endif /* !_NOSPLITWIN */
+#endif
X       }
X 
X       if (!all) {
diff -urNP ../FD-2.08c/builtin.c ./builtin.c
--- ../FD-2.08c/builtin.c       Wed May 24 00:00:00 2006
+++ ./builtin.c Tue Jun 13 00:00:00 2006
@@ -77,6 +77,9 @@
X #define       hitkey(n)
X #endif
X static VOID NEAR fputsmeta __P_((char *, FILE *));
+#if    !defined (_NOARCHIVE) && !defined(_NOBROWSE)
+static char **NEAR file2argv __P_((FILE *, char *, int));
+#endif
X #ifndef       _NOARCHIVE
X # if  FD >= 2
X static int NEAR getlaunchopt __P_((int, char *[], char *, launchtable *));
@@ -302,6 +305,87 @@
X       }
X }
X 
+#if    !defined (_NOARCHIVE) && !defined(_NOBROWSE)
+static char **NEAR file2argv(fp, s, whole)
+FILE *fp;
+char *s;
+int whole;
+{
+       char *cp, *line, **argv;
+       ALLOC_T size;
+       int i, j, pc, argc, escape, quote, pqoute, quoted;
+
+       argc = 1;
+       argv = (char **)malloc2(2 * sizeof(char *));
+       argv[0] = strdup2(s);
+       argv[1] = NULL;
+       j = escape = 0;
+       quote = pqoute = quoted = '\0';
+       cp = c_realloc(NULL, 0, &size);
+       while ((line = fgets2(fp, 0))) {
+               if (!escape && !quote && *line == '#') {
+                       free(line);
+                       continue;
+               }
+               escape = 0;
+               for (i = 0; line[i]; i++) {
+                       cp = c_realloc(cp, j + 2, &size);
+                       pc = parsechar(&(line[i]), -1,
+                               '\0', EA_EOLMETA, &quote, &pqoute);
+                       if (pc == PC_CLQUOTE) quoted = line[i];
+                       else if (pc == PC_WORD) {
+                               cp[j++] = line[i++];
+                               cp[j++] = line[i];
+                       }
+                       else if (pc == PC_SQUOTE || pc == PC_DQUOTE)
+                               cp[j++] = line[i];
+                       else if (pc == PC_ESCAPE) {
+                               if (!line[++i]) {
+                                       escape = 1;
+                                       break;
+                               }
+                               cp[j++] = line[i];
+                       }
+                       else if (pc == PC_OPQUOTE) quoted = '\0';
+                       else if (pc != PC_NORMAL) /*EMPTY*/;
+                       else if (!strchr(IFS_SET, line[i])) cp[j++] = line[i];
+                       else if (j || quoted) {
+                               quoted = cp[j] = '\0';
+                               argv = (char **)realloc2(argv,
+                                       (argc + 2) * sizeof(char *));
+                               argv[argc++] = strdup2(cp);
+                               argv[argc] = NULL;
+                               j = 0;
+                       }
+               }
+
+               if (escape);
+               else if (quote) cp[j++] = '\n';
+               else if (j || quoted) {
+                       quoted = cp[j] = '\0';
+                       argv = (char **)realloc2(argv,
+                               (argc + 2) * sizeof(char *));
+                       argv[argc++] = strdup2(cp);
+                       argv[argc] = NULL;
+                       j = 0;
+               }
+               free(line);
+
+               if (!whole && !escape && !quote) break;
+       }
+
+       if (j) {
+               cp[j] = '\0';
+               argv = (char **)realloc2(argv, (argc + 2) * sizeof(char *));
+               argv[argc++] = strdup2(cp);
+               argv[argc] = NULL;
+       }
+       free(cp);
+
+       return(argv);
+}
+#endif /* !_NOARCHIVE && !_NOBROWSE */
+
X #ifndef       _NOARCHIVE
X # if  FD >= 2
X static int NEAR getlaunchopt(n, argv, opts, lp)
@@ -949,9 +1033,8 @@
X char **sargv, **dargv;
X {
X       FILE *fp;
-       char *cp, *line, **argv;
-       ALLOC_T size;
-       int i, j, n, argc, dargc, meta, quote, quoted;
+       char *cp, **argv;
+       int n, dargc;
X 
X       dargc = countvar(dargv);
X       for (n = 1; sargv[n]; n++) {
@@ -976,80 +1059,10 @@
X                       return(NULL);
X               }
X 
-               argc = 1;
-               argv = (char **)malloc2(2 * sizeof(char *));
-               argv[0] = strdup2(sargv[0]);
-               argv[1] = NULL;
-               j = meta = 0;
-               quote = quoted = '\0';
-               cp = c_realloc(NULL, 0, &size);
-               while ((line = fgets2(fp, 0))) {
-                       if (!meta && !quote && *line == '#') {
-                               free(line);
-                               continue;
-                       }
-                       meta = 0;
-                       for (i = 0; line[i]; i++) {
-                               cp = c_realloc(cp, j + 2, &size);
-                               if (line[i] == quote) {
-                                       quoted = quote;
-                                       quote = '\0';
-                               }
-                               else if (iskanji1(line, i)) {
-                                       cp[j++] = line[i++];
-                                       cp[j++] = line[i];
-                               }
-#  ifdef       CODEEUC
-                               else if (isekana(line, i)) {
-                                       cp[j++] = line[i++];
-                                       cp[j++] = line[i];
-                               }
-#  endif
-                               else if (quote) cp[j++] = line[i];
-                               else if (line[i] == PMETA) {
-                                       if (!line[++i]) {
-                                               meta = 1;
-                                               break;
-                                       }
-                                       cp[j++] = line[i];
-                               }
-                               else if (line[i] == '\'' || line[i] == '"') {
-                                       quoted = '\0';
-                                       quote = line[i];
-                               }
-                               else if (!strchr(IFS_SET, line[i]))
-                                       cp[j++] = line[i];
-                               else if (j || quoted) {
-                                       quoted = cp[j] = '\0';
-                                       argv = (char **)realloc2(argv,
-                                               (argc + 2) * sizeof(char *));
-                                       argv[argc++] = strdup2(cp);
-                                       argv[argc] = NULL;
-                                       j = 0;
-                               }
-                       }
-                       if (meta);
-                       else if (quote) cp[j++] = '\n';
-                       else if (j || quoted) {
-                               quoted = cp[j] = '\0';
-                               argv = (char **)realloc2(argv,
-                                       (argc + 2) * sizeof(char *));
-                               argv[argc++] = strdup2(cp);
-                               argv[argc] = NULL;
-                               j = 0;
-                       }
-                       free(line);
-               }
+               argv = file2argv(fp, sargv[0], 1);
X               if (fp != stdin) Xfclose(fp);
X               else clearerr(fp);
-               if (j) {
-                       cp[j] = '\0';
-                       argv = (char **)realloc2(argv,
-                               (argc + 2) * sizeof(char *));
-                       argv[argc++] = strdup2(cp);
-                       argv[argc] = NULL;
-               }
-               free(cp);
+
X               dargv = readargv(argv, dargv);
X               freevar(argv);
X               if (!dargv) return(NULL);
@@ -1263,7 +1276,7 @@
X       }
X       else if (argc > i) {
X               if (argv[i][0] != BINDCOMMENT
-               || bindp -> key < K_F(1) || bindp -> key > K_F(10)) {
+               || bindp -> key < K_F(1) || bindp -> key > K_F(MAXHELPINDEX)) {
X                       bindp -> key = ER_SYNTAXERR;
X                       bindp -> f_func = i;
X                       return(-1);
@@ -1302,7 +1315,7 @@
X               return(-2);
X       }
X 
-       if (bind.key < K_F(1) || bind.key > K_F(10)) {
+       if (bind.key < K_F(1) || bind.key > K_F(MAXHELPINDEX)) {
X               if (cp) free(cp);
X       }
X       else if (cp) {
@@ -1332,7 +1345,8 @@
X {
X       freemacro(bindlist[n].f_func);
X       freemacro(bindlist[n].d_func);
-       if (bindlist[n].key >= K_F(1) && bindlist[n].key <= K_F(10)) {
+       if (bindlist[n].key >= K_F(1)
+       && bindlist[n].key <= K_F(MAXHELPINDEX)) {
X               free(helpindex[bindlist[n].key - K_F(1)]);
X               helpindex[bindlist[n].key - K_F(1)] = strdup2(nullstr);
X       }
@@ -1388,7 +1402,8 @@
X {
X       int n;
X 
-       if (bindp -> key < K_F(1) || bindp -> key > K_F(10)) return(NULL);
+       if (bindp -> key < K_F(1) || bindp -> key > K_F(MAXHELPINDEX))
+               return(NULL);
X       n = bindp -> key - K_F(1);
X #ifndef       _NOCUSTOMIZE
X       if (!strcmp(helpindex[n], orighelpindex[n])) return(NULL);
@@ -2117,7 +2132,7 @@
X               skip = 0;
X               for (i = 1; argv[n][i]; i++) {
X                       skip = 0;
-                       switch(argv[n][i]) {
+                       switch (argv[n][i]) {
X                               case 'e':
X                                       if (argv[n][i + 1]) {
X                                               editor = &(argv[n][i + 1]);
@@ -3414,7 +3429,7 @@
X 
X       return(argc);
X }
-#endif
+#endif /* !_NOCOMPLETE */
X 
X #ifdef        DEBUG
X VOID freedefine(VOID_A)
@@ -3443,6 +3458,6 @@
X # ifdef       _USEDOSEMU
X       for (i = 0; fdtype[i].name; i++) free(fdtype[i].name);
X # endif
-       for (i = 0; i < 10; i++) free(helpindex[i]);
+       for (i = 0; i < MAXHELPINDEX; i++) free(helpindex[i]);
X }
X #endif
diff -urNP ../FD-2.08c/custom.c ./custom.c
--- ../FD-2.08c/custom.c        Wed May 24 00:00:00 2006
+++ ./custom.c  Tue Jun 13 00:00:00 2006
@@ -47,8 +47,10 @@
X extern int sizeinfo;
X #ifndef       _NOCOLOR
X extern int ansicolor;
+# if   FD >= 2
X extern char *ansipalette;
-#endif
+# endif
+#endif /* !_NOCOLOR */
X #ifndef       _NOEDITMODE
X extern char *editmode;
X #endif
@@ -66,7 +68,7 @@
X #ifndef       _NOORIGSHELL
X extern char *promptstr2;
X #endif
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+#if    !defined (_NOKANJICONV) || !defined (_NODOSDRIVE)
X extern int unicodebuffer;
X #endif
X #ifndef       _NOKANJIFCONV
@@ -84,7 +86,9 @@
X extern char *utf8macpath;
X extern char *noconvpath;
X #endif        /* !_NOKANJIFCONV */
+#if    FD >= 2
X extern int tmpumask;
+#endif
X #ifndef       _NOORIGSHELL
X extern int dumbshell;
X #endif
@@ -119,6 +123,9 @@
X extern int subwindow;
X extern int win_x;
X extern int win_y;
+#if    FD >= 2
+extern int lcmdline;
+#endif
X extern int calc_x;
X extern int calc_y;
X extern functable funclist[];
@@ -181,6 +188,7 @@
X 
X #define       env_str(n)      (&(envlist[n].env[FDESIZ]))
X #define       fdenv_str(n)    (envlist[n].env)
+#define        env_type(n)     (envlist[n].type)
X #ifdef        FORCEDSTDC
X #define       def_str(n)      (envlist[n].def.str)
X #define       def_num(n)      (envlist[n].def.num)
@@ -379,7 +387,7 @@
X # if  FD >= 2
X       {"FD_ANSIPALETTE", &ansipalette, DEFVAL(ANSIPALETTE), APAL_E, T_CHARP},
X # endif
-#endif
+#endif /* !_NOCOLOR */
X #ifndef       _NOEDITMODE
X       {"FD_EDITMODE", &editmode, DEFVAL(EDITMODE), EDMD_E, T_EDIT},
X #endif
@@ -425,7 +433,7 @@
X #if   FD >= 2
X       {"FD_THRUARGS", &thruargs, DEFVAL(THRUARGS), THARG_E, T_BOOL},
X #endif
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+#if    !defined (_NOKANJICONV) || !defined (_NODOSDRIVE)
X       {"FD_UNICODEBUFFER", &unicodebuffer,
X               DEFVAL(UNICODEBUFFER), UNBF_E, T_BOOL},
X #endif
@@ -538,7 +546,7 @@
X       int n;
X 
X       cp = getenv2(fdenv_str(no));
-       switch (envlist[no].type) {
+       switch (env_type(no)) {
X               case T_BOOL:
X                       if (!cp) n = def_num(no);
X                       else n = (*cp && atoi2(cp)) ? 1 : 0;
@@ -571,8 +579,8 @@
X                       *((char **)(envlist[no].var)) = cp;
X                       break;
X               case T_SORT:
-                       if (((n = atoi2(cp)) < 0 || (n & 7) > 5)
-                       && (n < 100 || ((n - 100) & 7) > 5))
+                       if ((n = atoi2(cp)) < 0 || (n / 100) > MAXSORTINHERIT
+                       || ((n % 100) & ~15) || ((n % 100) & 7) > MAXSORTTYPE)
X                               n = def_num(no);
X                       *((int *)(envlist[no].var)) = n;
X                       break;
@@ -636,7 +644,7 @@
X               case T_KOUT:
X               case T_KNAM:
X               case T_KTERM:
-                       n = (1 << (envlist[no].type - T_KIN));
+                       n = (1 << (env_type(no) - T_KIN));
X                       *((int *)(envlist[no].var)) = getlang(cp, n);
X                       break;
X #endif        /* !_NOKANJICONV || (!_NOENGMES && !NOJPNMES) */
@@ -809,7 +817,7 @@
X               pathlist[i].last = NULL;
X       }
X # endif
-       for (i = 0; i < ENVLISTSIZ; i++) switch (envlist[i].type) {
+       for (i = 0; i < ENVLISTSIZ; i++) switch (env_type(i)) {
X               case T_PATH:
X               case T_PATHS:
X                       if (*((char **)(envlist[i].var)))
@@ -1141,7 +1149,7 @@
X #endif
X       for (i = 0; i < ENVLISTSIZ; i++) {
X               setenv2(fdenv_str(i), NULL, 0);
-               cp = (envlist[i].type == T_CHARP) ? def_str(i) : NULL;
+               cp = (env_type(i) == T_CHARP) ? def_str(i) : NULL;
X               setenv2(env_str(i), cp, 0);
X               _evalenv(i);
X       }
@@ -1199,7 +1207,7 @@
X       int n, p;
X 
X       new = NULL;
-       switch (envlist[no].type) {
+       switch (env_type(no)) {
X               case T_BOOL:
X                       str[0] = VBOL0_K;
X                       str[1] = VBOL1_K;
@@ -1221,8 +1229,11 @@
X                       str[3] = OSIZE_K;
X                       str[4] = ODATE_K;
X                       str[5] = OLEN_K;
-                       p = (n >= 100) ? 1 : 0;
+                       p = n / 100;
+                       if (p > MAXSORTINHERIT) p = MAXSORTINHERIT;
X                       n %= 100;
+                       if ((n & 7) > MAXSORTTYPE)
+                               n = ((n & ~7) | MAXSORTTYPE);
X                       new = strdup2(&(str[n & 7][3]));
X 
X                       if (n & 7) {
@@ -1356,7 +1367,7 @@
X 
X       new = NULL;
X       env = env_str(no);
-       switch (envlist[no].type) {
+       switch (env_type(no)) {
X               case T_BOOL:
X                       n = (*((int *)(envlist[no].var))) ? 1 : 0;
X                       str[0] = VBOL0_K;
@@ -1417,8 +1428,11 @@
X                       val[4] = 5;
X                       val[5] = 0;
X                       val[6] = -1;
-                       p = (n >= 100) ? 100 : 0;
+                       p = n / 100;
+                       if (p > MAXSORTINHERIT) p = MAXSORTINHERIT;
X                       n %= 100;
+                       if ((n & 7) > MAXSORTTYPE)
+                               n = ((n & ~7) | MAXSORTTYPE);
X                       tmp = n & ~7;
X                       n &= 7;
X                       envcaption(env);
@@ -1439,9 +1453,10 @@
X                       str[0] = VSRT0_K;
X                       str[1] = VSRT1_K;
X                       val[0] = 0;
-                       val[1] = 100;
-                       if (noselect(&p, 2, 0, str, val)) return(0);
-                       n += p;
+                       val[1] = 1;
+                       if (noselect(&p, MAXSORTINHERIT + 1, 0, str, val))
+                               return(0);
+                       n += p * 100;
X                       cp = int2str(buf, n);
X                       break;
X               case T_DISP:
@@ -1586,7 +1601,7 @@
X #  endif      /* !_NOKANJICONV */
X                       str[tmp] = VUSET_K;
X                       val[tmp++] = -1;
-                       p = (1 << (envlist[no].type - T_KIN));
+                       p = (1 << (env_type(no) - T_KIN));
X                       for (n = 0; n < tmp; n++) {
X                               if (val[n] < 0 || (kanjiiomode[val[n]] & p))
X                                       continue;
@@ -1730,7 +1745,7 @@
X       for (i = n = 0; i < ENVLISTSIZ; i++) {
X               if ((!flaglist || !(flaglist[i] & 2))
X               && (cp = getshellvar(env_str(i), -1))
-               && (envlist[i].type != T_CHARP || strenvcmp(cp, def_str(i))))
+               && (env_type(i) != T_CHARP || strenvcmp(cp, def_str(i))))
X                       n++;
X               if ((!flaglist || !(flaglist[i] & 1))
X               && getshellvar(fdenv_str(i), -1))
@@ -1743,7 +1758,7 @@
X       for (i = 0; i < ENVLISTSIZ; i++) {
X               if ((!flaglist || !(flaglist[i] & 2))
X               && (cp = getshellvar(env_str(i), -1))
-               && (envlist[i].type != T_CHARP || strenvcmp(cp, def_str(i)))) {
+               && (env_type(i) != T_CHARP || strenvcmp(cp, def_str(i)))) {
X                       cp = killmeta(cp);
X                       fprintf2(fp, "%s=%s\n", env_str(i), cp);
X                       free(cp);
@@ -1807,7 +1822,7 @@
X               else {
X                       if (flaglist) flaglist[i] |= f;
X                       if ((cp = getshellvar(ident, -1))
-                       && (envlist[i].type != T_CHARP
+                       && (env_type(i) != T_CHARP
X                       || strenvcmp(cp, def_str(i)))) {
X                               if (ns++) fputc(' ', fp);
X                               cp = killmeta(cp);
@@ -1887,7 +1902,7 @@
X               else {
X                       if (flaglist) flaglist[i] |= f;
X                       if ((cp = getshellvar(ident, -1))
-                       && (envlist[i].type != T_CHARP
+                       && (env_type(i) != T_CHARP
X                       || strenvcmp(cp, def_str(i)))) {
X                               if (ns++) fputc(' ', fp);
X                               cp = killmeta(cp);
@@ -1940,7 +1955,7 @@
X       freestrarray(macrolist, maxmacro);
X       maxmacro = 0;
X       copybind(bindlist, origbindlist);
-       copystrarray(helpindex, orighelpindex, NULL, 10);
+       copystrarray(helpindex, orighelpindex, NULL, MAXHELPINDEX);
X }
X 
X static int NEAR dispbind(no)
@@ -2136,7 +2151,7 @@
X               }
X       }
X 
-       if (key < K_F(1) || key > K_F(10)) cp = NULL;
+       if (key < K_F(1) || key > K_F(MAXHELPINDEX)) cp = NULL;
X       else cp = inputcuststr(FCOMM_K, 0, helpindex[key - K_F(1)], -1);
X       bind.key = (short)key;
X       bind.f_func = (u_char)n1;
@@ -3928,7 +3943,7 @@
X                               copystrarray(macrolist, tmpmacrolist,
X                                       &maxmacro, tmpmaxmacro);
X                               copystrarray(helpindex, tmphelpindex,
-                                       NULL, 10);
+                                       NULL, MAXHELPINDEX);
X                               copybind(bindlist, tmpbindlist);
X                       }
X # ifndef      _NOKEYMAP
@@ -4290,7 +4305,7 @@
X 
X       tmpenvlist = copyenv(NULL);
X       tmpmacrolist = copystrarray(NULL, macrolist, &tmpmaxmacro, maxmacro);
-       tmphelpindex = copystrarray(NULL, helpindex, NULL, 10);
+       tmphelpindex = copystrarray(NULL, helpindex, NULL, MAXHELPINDEX);
X       tmpbindlist = copybind(NULL, bindlist);
X       for (i = 0; bindlist[i].key >= 0; i++);
X # ifndef      _NOKEYMAP
@@ -4441,7 +4456,7 @@
X               free(tmpmacrolist);
X       }
X       if (tmphelpindex) {
-               freestrarray(tmphelpindex, 10);
+               freestrarray(tmphelpindex, MAXHELPINDEX);
X               free(tmphelpindex);
X       }
X       if (tmpbindlist) free(tmpbindlist);
diff -urNP ../FD-2.08c/fd.cat ./fd.cat
--- ../FD-2.08c/fd.cat  Wed May 24 00:00:00 2006
+++ ./fd.cat    Tue Jun 13 00:00:00 2006
@@ -2595,8 +2595,9 @@
X                        デフォルト     変換しない
X 
X      H^HHI^HIS^HST^HTF^HFI^HIL^HLE^HE      E^HEX^HXE^HEC^HCU^HUT^HTE^HE_F^HFI^HIL^HLE^HE や E^HEX^HXE^HEC^HCU^HUT^HTE^HE_S^HSH^HH で参照できるコマン
-                   ド履歴のセーブファイルを指定します。デフォルト
-                   値は ~^H~/^H/.^H.f^Hfd^Hd_h^Hhi^His^Hst^Hto^Hor^Hry^Hy です。
+                   ド履歴のセーブファイルを指定します。ファイル名
+                   が未指定の場合はコマンド履歴はセーブもロードも
+                   されません。デフォルト値は ~^H~/^H/.^H.f^Hfd^Hd_h^Hhi^His^Hst^Hto^Hor^Hry^Hy です。
X 
X                    (MS-DOS 版でのデフォルト値は $^H$H^HHO^HOM^HME^HE\^H\f^Hfd^Hd.^H.h^Hhs^Hst^Ht とな
X                    ります。)
@@ -2794,6 +2795,19 @@
X                        u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
X                        デフォルト     変換しない
X 
+     P^HPT^HTY^HYM^HME^HEN^HNU^HUK^HKE^HEY^HY    疑似端末を操作している最中に疑似端末メニューを
+                   開くためのキーを指定します。設定値には b^Hbi^Hin^Hnd^Hd コ
+                   マンドと同様のキー名を用いることができます。疑
+                   似端末メニューでは、「この文字を送出」「文字コ
+                   ード入力」「強制終了」「ウィンドウ移動」の各項
+                   目が選択可能です。それぞれ、疑似端末メニューキ
+                   ー自身の送出、送出する文字を b^Hbi^Hin^Hnd^Hd コマンドと同
+                   様のキー名で入力、疑似端末で稼働中のプロセスを
+                   強制的に終了、ウィンドウ間の移動、を行ないます。
+                   但し、ウィンドウ非分割モードでは「ウィンドウ移
+                   動」項目は選択できません。デフォルト値は未指定
+                   です。(^H(U^HUN^HNI^HIX^HX)^H)
+
X      P^HPT^HTY^HYM^HMO^HOD^HDE^HE       外部コマンドの起動に疑似端末を用います。ウィン
X                    ドウ分割モードでは各ウィンドウ毎に独立した疑似
X                    端末を用いますので、同時に複数の外部コマンドを
@@ -2823,18 +2837,6 @@
X                    待通りでない場合もあるので、その環境で有効な端
X                    末名を指定して下さい。デフォルト値は v^Hvt^Ht1^H10^H00^H0 で
X                    す。(^H(U^HUN^HNI^HIX^HX)^H)
-
-     P^HPT^HTY^HYM^HME^HEN^HNU^HUK^HKE^HEY^HY    疑似端末を操作している最中に疑似端末メニューを
-                   開くためのキーを指定します。設定値には b^Hbi^Hin^Hnd^Hd コ
-                   マンドと同様のキー名を用いることができます。疑
-                   似端末メニューでは、「この文字を送出」「文字コ
-                   ード入力」「強制終了」「ウィンドウ移動」の各項
-                   目が選択可能です。それぞれ、疑似端末メニューキ
-                   ー自身の送出、送出する文字を b^Hbi^Hin^Hnd^Hd コマンドと同
-                   様のキー名で入力、疑似端末で稼働中のプロセスを
-                   強制的に終了、ウィンドウ間の移動、を行ないます。
-                   但し、ウィンドウ非分割モードでは「ウィンドウ移
-                   動」項目は選択できません。(^H(U^HUN^HNI^HIX^HX)^H)
X 
X      P^HPW^HWD^HD*          カレントディレクトリの絶対パス名を示す変数とし
X                    て利用します。何らかの値が設定されていた場合、
diff -urNP ../FD-2.08c/fd.h ./fd.h
--- ../FD-2.08c/fd.h    Wed May 24 00:00:00 2006
+++ ./fd.h      Tue Jun 13 00:00:00 2006
@@ -249,6 +249,9 @@
X #define       WFILEMINCUSTOM  4
X #define       WFILEMINATTR    (WMODELINE + 5)
X #define       WFILEMIN        1
+#define        MAXHELPINDEX    10
+#define        MAXSORTINHERIT  1
+#define        MAXSORTTYPE     5
X #define       L_STACK         (n_line - 3)
X #define       L_HELP          (n_line - 2)
X #define       L_INFO          (n_line - 1)
diff -urNP ../FD-2.08c/fd.man ./fd.man
--- ../FD-2.08c/fd.man  Wed May 24 00:00:00 2006
+++ ./fd.man    Tue Jun 13 00:00:00 2006
@@ -2,9 +2,9 @@
X .\" Copyright (C) 1995-2006 Takashi SHIRAI
X .\"                    <shirai@unixusers.net>
X .\"
-.\" @(#)fd.1   2.08c 05/24/06
+.\" @(#)fd.1   2.08d 06/13/06
X .\"   fd - File & Directory maintenance tool
-.TH FD 1 "May 24, 2006"
+.TH FD 1 "June 13, 2006"
X .de sh
X .br
X .PP
@@ -4329,6 +4329,7 @@
X や
X .B " EXECUTE_SH"
X で参照できるコマンド履歴のセーブファイルを指定します。
+ファイル名が未指定の場合はコマンド履歴はセーブもロードもされません。
X デフォルト値は
X .B ~/.fd_history
X です。
@@ -4613,6 +4614,25 @@
X デフォルト 変換しない
X .fi
X .RE
+.IP "\fBPTYMENUKEY\fP"
+疑似端末を操作している最中に疑似端末メニューを開くためのキーを指定します。
+設定値には
+.B " bind"
+コマンドと同様のキー名を用いることができます。
+疑似端末メニューでは、
+「この文字を送出」「文字コード入力」「強制終了」「ウィンドウ移動」の各項目が選択可能です。
+それぞれ、
+疑似端末メニューキー自身の送出、
+送出する文字を
+.B " bind"
+コマンドと同様のキー名で入力、
+疑似端末で稼働中のプロセスを強制的に終了、
+ウィンドウ間の移動、
+を行ないます。
+但し、
+ウィンドウ非分割モードでは「ウィンドウ移動」項目は選択できません。
+デフォルト値は未指定です。
+.B (UNIX)
X .IP "\fBPTYMODE\fP"
X 外部コマンドの起動に疑似端末を用います。
X ウィンドウ分割モードでは各ウィンドウ毎に独立した疑似端末を用いますので、
@@ -4655,24 +4675,6 @@
X デフォルト値は
X .B " vt100"
X です。
-.B (UNIX)
-.IP "\fBPTYMENUKEY\fP"
-疑似端末を操作している最中に疑似端末メニューを開くためのキーを指定します。
-設定値には
-.B " bind"
-コマンドと同様のキー名を用いることができます。
-疑似端末メニューでは、
-「この文字を送出」「文字コード入力」「強制終了」「ウィンドウ移動」の各項目が選択可能です。
-それぞれ、
-疑似端末メニューキー自身の送出、
-送出する文字を
-.B " bind"
-コマンドと同様のキー名で入力、
-疑似端末で稼働中のプロセスを強制的に終了、
-ウィンドウ間の移動、
-を行ないます。
-但し、
-ウィンドウ非分割モードでは「ウィンドウ移動」項目は選択できません。
X .B (UNIX)
X .IP "\fBPWD\fP\(**"
X カレントディレクトリの絶対パス名を示す変数として利用します。
diff -urNP ../FD-2.08c/fd_e.cat ./fd_e.cat
--- ../FD-2.08c/fd_e.cat        Wed May 24 00:00:00 2006
+++ ./fd_e.cat  Tue Jun 13 00:00:00 2006
@@ -2866,7 +2866,9 @@
X 
X      H^HHI^HIS^HST^HTF^HFI^HIL^HLE^HE      Specify the name of the command history file
X                    which can be referred by E^HEX^HXE^HEC^HCU^HUT^HTE^HE_F^HFI^HIL^HLE^HE and E^HEX^HXE^HE-^H-
-                   C^HCU^HUT^HTE^HE_S^HSH^HH.  The default value is ~^H~/^H/.^H.f^Hfd^Hd_h^Hhi^His^Hst^Hto^Hor^Hry^Hy.
+                   C^HCU^HUT^HTE^HE_S^HSH^HH.  Unless you specify it, the directory
+                   history is not loaded nor saved.  The default
+                   value is ~^H~/^H/.^H.f^Hfd^Hd_h^Hhi^His^Hst^Hto^Hor^Hry^Hy.
X 
X                    (On MS-DOS version, The default value is
X                    $^H$H^HHO^HOM^HME^HE\^H\f^Hfd^Hd.^H.h^Hhs^Hst^Ht.)
@@ -3080,6 +3082,21 @@
X                        u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X                        default        no convert
X 
+     P^HPT^HTY^HYM^HME^HEN^HNU^HUK^HKE^HEY^HY    Specify the key to open the pseudo terminal
+                   menu while you are handling the pseudo termi-
+                   nal.  You can describe the same key name as
+                   b^Hbi^Hin^Hnd^Hd command.  You can select the following
+                   items in the pseudo terminal menu: "SendAsIs",
+                   "InputCode", "Break" and "NextWindow".  Each
+                   item means respectively: sending the pseudo
+                   terminal menu key as is, inputing the key name
+                   to be sent like as b^Hbi^Hin^Hnd^Hd command, terminating
+                   forcedly the process running in the pseudo ter-
+                   minal, changing to the next window.  But you
+                   cannot select "NextWindow" in the non-split
+                   window mode.  The default value is not speci-
+                   fied.  (^H(U^HUN^HNI^HIX^HX)^H)
+
X      P^HPT^HTY^HYM^HMO^HOD^HDE^HE       Use the pseudo terminal to invoke external com-
X                    mands.  In the split window mode, the independ-
X                    ent pseudo terminals for every windows will be
@@ -3114,20 +3131,6 @@
X                    of the pseudo terminal, you should specify the
X                    effective terminal name in your environment.
X                    The default value is v^Hvt^Ht1^H10^H00^H0.  (^H(U^HUN^HNI^HIX^HX)^H)
-
-     P^HPT^HTY^HYM^HME^HEN^HNU^HUK^HKE^HEY^HY    Specify the key to open the pseudo terminal
-                   menu while you are handling the pseudo termi-
-                   nal.  You can describe the same key name as
-                   b^Hbi^Hin^Hnd^Hd command.  You can select the following
-                   items in the pseudo terminal menu: "SendAsIs",
-                   "InputCode", "Break" and "NextWindow".  Each
-                   item means respectively: sending the pseudo
-                   terminal menu key as is, inputing the key name
-                   to be sent like as b^Hbi^Hin^Hnd^Hd command, terminating
-                   forcedly the process running in the pseudo ter-
-                   minal, changing to the next window.  But you
-                   cannot select "NextWindow" in the non-split
-                   window mode.  (^H(U^HUN^HNI^HIX^HX)^H)
X 
X      P^HPW^HWD^HD*          The variable for the current directory with
X                    the absolute representation.  If some value is
diff -urNP ../FD-2.08c/fd_e.man ./fd_e.man
--- ../FD-2.08c/fd_e.man        Wed May 24 00:00:00 2006
+++ ./fd_e.man  Tue Jun 13 00:00:00 2006
@@ -2,9 +2,9 @@
X .\" Copyright (C) 1995-2006 Takashi SHIRAI
X .\"                    <shirai@unixusers.net>
X .\"
-.\" @(#)fd.1   2.08c 05/24/06
+.\" @(#)fd.1   2.08d 06/13/06
X .\"   fd - File & Directory maintenance tool
-.TH FD 1 "May 24, 2006"
+.TH FD 1 "June 13, 2006"
X .de sh
X .br
X .PP
@@ -4503,6 +4503,8 @@
X .B EXECUTE_FILE
X and
X .BR EXECUTE_SH .
+Unless you specify it,
+the command history is not loaded nor saved.
X The default value is
X .BR ~/.fd_history .
X 
@@ -4792,6 +4794,23 @@
X default       no convert
X .fi
X .RE
+.IP "\fBPTYMENUKEY\fP"
+Specify the key to open the pseudo terminal menu while you are handling the pseudo terminal.
+You can describe the same key name as
+.B bind
+command.
+You can select the following items in the pseudo terminal menu:
+"SendAsIs", "InputCode", "Break" and "NextWindow".
+Each item means respectively:
+sending the pseudo terminal menu key as is,
+inputing the key name to be sent like as
+.B bind
+command,
+terminating forcedly the process running in the pseudo terminal,
+changing to the next window.
+But you cannot select "NextWindow" in the non-split window mode.
+The default value is not specified.
+.B (UNIX)
X .IP "\fBPTYMODE\fP"
X Use the pseudo terminal to invoke external commands.
X In the split window mode,
@@ -4835,22 +4854,6 @@
X you should specify the effective terminal name in your environment.
X The default value is
X .BR vt100 .
-.B (UNIX)
-.IP "\fBPTYMENUKEY\fP"
-Specify the key to open the pseudo terminal menu while you are handling the pseudo terminal.
-You can describe the same key name as
-.B bind
-command.
-You can select the following items in the pseudo terminal menu:
-"SendAsIs", "InputCode", "Break" and "NextWindow".
-Each item means respectively:
-sending the pseudo terminal menu key as is,
-inputing the key name to be sent like as
-.B bind
-command,
-terminating forcedly the process running in the pseudo terminal,
-changing to the next window.
-But you cannot select "NextWindow" in the non-split window mode.
X .B (UNIX)
X .IP "\fBPWD\fP\(**"
X The variable for the current directory with the absolute representation.
diff -urNP ../FD-2.08c/frontend.c ./frontend.c
--- ../FD-2.08c/frontend.c      Wed May 24 00:00:00 2006
+++ ./frontend.c        Tue Jun 13 00:00:00 2006
@@ -24,20 +24,15 @@
X # endif
X #endif
X 
-#ifdef SIGALRM
-#define        sigalrm()       ((!noalrm) ? SIGALRM : 0)
-#else
-#define        sigalrm()       0
-#endif
+#define        MAXPTYMENU      4
X 
X extern functable funclist[];
X extern int internal_status;
-#ifdef SIGALRM
-extern int noalrm;
-#endif
X extern int fdmode;
X extern int fdflags;
X extern int wheader;
+extern int lcmdline;
+extern int maxcmdline;
X extern int ptymode;
X extern int ptyinternal;
X extern int ptymenukey;
@@ -91,7 +86,7 @@
X                       if (result[i] && ptylist[i].pid) recvchild(i);
X       }
X 
-       if (win != oldwin) {
+       if (win != oldwin || !emupid) {
X               recvchild(oldwin);
X               return(-2);
X       }
@@ -238,7 +233,7 @@
X {
X       va_list args;
X       char *buf;
-       int n;
+       int n, len;
X 
X       VA_START(args, fmt);
X       n = vasprintf2(&buf, fmt, args);
@@ -248,8 +243,9 @@
X       if (!emupid) VOID_C cputs2(buf);
X       else {
X               sendword(emufd, TE_CPUTS2);
-               sendword(emufd, n);
-               sendbuf(emufd, buf, n);
+               len = strlen(buf);
+               sendword(emufd, len);
+               sendbuf(emufd, buf, len);
X       }
X       free(buf);
X 
@@ -394,12 +390,12 @@
X 
X static int NEAR ptygetkey(VOID_A)
X {
-       char *cp, *str[4];
-       int n, c, ch, val[4];
+       char *cp, *str[MAXPTYMENU];
+       int n, c, ch, val[MAXPTYMENU];
X 
X       for (;;) {
X               n = -1;
-               c = getkey2(sigalrm());
+               c = getkey2(sigalrm(1));
X               while (lockflags & (1 << win)) {
X                       kbhit2(1000000L / SENSEPERSEC);
X                       waitpty();
@@ -420,13 +416,17 @@
X 
X               n = 0;
X               changewin(MAXWINDOWS, (p_id_t)-1);
-               ch = selectstr(&n, (windows > 1) ? 4 : 3, 0, str, val);
+               ch = selectstr(&n, (windows > 1) ? MAXPTYMENU : MAXPTYMENU - 1,
+                       0, str, val);
+               movepos(filepos, 0);
X               changewin(win, (p_id_t)-1);
X               free(str[0]);
-               if (ch != K_CR) /*EMPTY*/;
+
+               if (ch != K_CR) continue;
X               else if (!n) break;
X               else if (n == 2) {
X                       killpty(win, NULL);
+                       rewritefile(1);
X                       c = -1;
X                       break;
X               }
@@ -437,21 +437,23 @@
X               }
X               else {
X                       changewin(MAXWINDOWS, (p_id_t)-1);
+                       lcmdline = -1;
+                       maxcmdline = 1;
X                       cp = inputstr(PTYKC_K, 1, -1, NULL, -1);
+                       movepos(filepos, 0);
X                       changewin(win, (p_id_t)-1);
-                       if (cp) {
-                               c = getkeycode(cp, 0);
-                               free(cp);
-                               if (c >= 0) break;
-                               warning(0, VALNG_K);
-                       }
-               }
+                       if (!cp) continue;
+                       c = getkeycode(cp, 0);
+                       free(cp);
+                       if (c >= 0) break;
X 
-               rewritefile(1);
+                       changewin(MAXWINDOWS, (p_id_t)-1);
+                       warning(0, VALNG_K);
+                       movepos(filepos, 0);
+                       changewin(win, (p_id_t)-1);
+               }
X       }
X 
-       if (n >= 0) rewritefile(1);
-
X       return(c);
X }
X 
@@ -625,7 +627,7 @@
X       fd = ptylist[w].pipe;
X       if (recvbuf(fd, &uc, sizeof(uc)) < 0) return;
X 
-       switch(uc) {
+       switch (uc) {
X               case TE_SETVAR:
X                       if (recvbuf(fd, &varp, sizeof(varp)) < 0
X                       || recvvar(fd, &var) < 0)
@@ -761,7 +763,7 @@
X                       || recvbuf(fd, &val, sizeof(val)) < 0
X                       || recvstring(fd, &cp) < 0 || !cp)
X                               break;
-                       entryhist(n, cp, val);
+                       VOID_C entryhist(n, cp, val);
X                       free(cp);
X                       break;
X               case TE_ADDKEYBIND:
@@ -789,7 +791,7 @@
X                       || recvbuf(fd, &(key.len), sizeof(key.len)) < 0
X                       || recvstring(fd, &(key.str)) < 0)
X                               break;
-                       setkeyseq(key.code, key.str, key.len);
+                       VOID_C setkeyseq(key.code, key.str, key.len);
X                       break;
X #ifndef       _NOARCHIVE
X               case TE_ADDLAUNCH:
@@ -834,11 +836,11 @@
X                       || recvbuf(fd, &dev, sizeof(dev)) < 0
X                       || recvstring(fd, &(dev.name)) < 0)
X                               break;
-                       insertdrv(n, &dev);
+                       VOID_C insertdrv(n, &dev);
X                       break;
X               case TE_DELETEDRV:
X                       if (recvbuf(fd, &n, sizeof(n)) < 0) break;
-                       deletedrv(n);
+                       VOID_C deletedrv(n);
X                       break;
X #endif        /* _USEDOSEMU */
X               case TE_LOCKFRONT:
diff -urNP ../FD-2.08c/func.h ./func.h
--- ../FD-2.08c/func.h  Wed May 24 00:00:00 2006
+++ ./func.h    Tue Jun 13 00:00:00 2006
@@ -578,9 +578,9 @@
X #endif
X extern int entryhist __P_((int, char *, int));
X extern char *removehist __P_((int));
-extern int loadhistory __P_((int, char *));
+extern int loadhistory __P_((int));
X extern VOID convhistory __P_((char *, FILE *));
-extern int savehistory __P_((int, char *));
+extern int savehistory __P_((int));
X extern int parsehist __P_((char *, int *, int));
X extern char *evalhistory __P_((char *));
X #ifdef        DEBUG
@@ -635,6 +635,9 @@
X 
X /* info.c */
X extern VOID help __P_((int));
+#ifndef        NOFLOCK
+extern int isnfs __P_((char *));
+#endif
X extern int writablefs __P_((char *));
X extern off_t getblocksize __P_((char *));
X extern off_t calcKB __P_((off_t, off_t));
diff -urNP ../FD-2.08c/info.c ./info.c
--- ../FD-2.08c/info.c  Wed May 24 00:00:00 2006
+++ ./info.c    Tue Jun 13 00:00:00 2006
@@ -201,6 +201,9 @@
X extern VOID error __P_((char *));
X extern int _chdir2 __P_((char *));
X extern char *strcpy2 __P_((char *, char *));
+#ifndef        NOFLOCK
+extern char *strncpy2 __P_((char *, char *, int));
+#endif
X extern char *getwd2 __P_((VOID_A));
X extern VOID warning __P_((int, char *));
X #ifdef        _USEDOSPATH
@@ -217,7 +220,7 @@
X #endif
X extern char *malloc2 __P_((ALLOC_T));
X extern char *realloc2 __P_((VOID_P, ALLOC_T));
-#if    !MSDOS
+#if    !MSDOS || !defined (NOFLOCK)
X extern int Xstat __P_((char *, struct stat *));
X #endif
X extern int Xaccess __P_((char *, int));
@@ -318,6 +321,7 @@
X #ifndef       MNTTYPE_FAT32
X #define       MNTTYPE_FAT32   "fat32"       /* Win98 */
X #endif
+#define        MNTTYPE_XNFS    "nfs" /* NFS */
X 
X static int NEAR code2str __P_((char *, int));
X static int NEAR checkline __P_((int));
@@ -932,6 +936,28 @@
X 
X       return(NULL);
X }
+
+#ifndef        NOFLOCK
+int isnfs(path)
+char *path;
+{
+       mnt_t mntbuf;
+       struct stat st;
+       char *cp, buf[MAXPATHLEN];
+
+       if (Xstat(path, &st) < 0) return(-1);
+       if (!s_isdir(&st)) {
+               if (!(cp = strrdelim(path, 1))) return(-1);
+               strncpy2(buf, path, cp - path);
+               path = buf;
+       }
+       if (getfsinfo(path, NULL, &mntbuf) < 0) return(-1);
+       if (strncasecmp2(mntbuf.mnt_type, MNTTYPE_XNFS, strsize(MNTTYPE_XNFS)))
+               return(0);
+
+       return(1);
+}
+#endif /* NOFLOCK */
X 
X int writablefs(path)
X char *path;
diff -urNP ../FD-2.08c/input.c ./input.c
--- ../FD-2.08c/input.c Wed May 24 00:00:00 2006
+++ ./input.c   Tue Jun 13 00:00:00 2006
@@ -9,7 +9,7 @@
X #include "kanji.h"
X 
X #ifdef        _NOORIGSHELL
-#include <signal.h>
+#include "wait.h"
X #else
X #include "system.h"
X #endif
@@ -19,9 +19,6 @@
X extern int curcolumns;
X extern int minfilename;
X extern int hideclock;
-#ifdef SIGALRM
-extern int noalrm;
-#endif
X extern char *promptstr;
X #ifndef       _NOORIGSHELL
X extern int fdmode;
@@ -45,11 +42,6 @@
X #define       iseol(n)        (within(n) && !(ptr2col(n)))
X #define       LEFTMARGIN      0
X #define       RIGHTMARGIN     2
-#ifdef SIGALRM
-#define        sigalrm(sig)    ((!noalrm && (sig)) ? SIGALRM : 0)
-#else
-#define        sigalrm(sig)    0
-#endif
X 
X #ifndef       _NOEDITMODE
X static int NEAR getemulatekey __P_((int, CONST char []));
@@ -101,6 +93,7 @@
X static VOID NEAR selectfile __P_((int, char **));
X static int NEAR completestr __P_((int, int, int));
X #endif
+static int NEAR getch3 __P_((VOID_A));
X static int NEAR getkanjikey __P_((char *, int));
X static VOID NEAR copyhist __P_((char *, int));
X static VOID NEAR _inputstr_up __P_((int *, int, char **));
@@ -225,7 +218,7 @@
X 
X       return(ch);
X }
-#endif
+#endif /* !_NOEDITMODE */
X 
X int Xgetkey(sig, eof)
X int sig, eof;
@@ -329,12 +322,12 @@
X                               vistat |= VI_NEXT;
X                               break;
X               }
-       } while ((vistat & VI_NEXT) && (ch = getkey3(sig)));
+       } while ((vistat & VI_NEXT) && (ch = getkey3(sig)) > 0);
X       else if (!strcmp(editmode, "wordstar"))
X               ch = getemulatekey(ch, wordstarkey);
X #endif        /* !_NOEDITMODE */
X 
-       return(ch);
+       return((ch >= 0) ? ch : K_ESC);
X }
X 
X static int NEAR trquoteone(sp, s, cxp, len)
@@ -1960,6 +1953,12 @@
X }
X #endif        /* !_NOCOMPLETE */
X 
+static int NEAR getch3(VOID_A)
+{
+       if (!kbhit2(WAITMETA * 1000L)) return(EOF);
+       return(getch2());
+}
+
X static int NEAR getkanjikey(buf, ch)
X char *buf;
X int ch;
@@ -1986,11 +1985,11 @@
X       }
X # endif
X #else /* !_NOKANJICONV */
+       code = (inputkcode != NOCNV) ? inputkcode : DEFCODE;
X # ifndef      _NOPTY
-       if (parentfd >= 0) code = ptyinkcode;
-       else
+       if (parentfd >= 0 && ptyinkcode != NOCNV) code = ptyinkcode;
X # endif
-       code = inputkcode;
+
X       if (code == EUC && isekana2(ch)) {
X               tmpkanji[0] = (char)C_EKANA;
X               tmpkanji[1] = (ch & 0xff);
@@ -2006,8 +2005,7 @@
X       }
X       if (code == UTF8 || code == M_UTF8) {
X               if ((ch & 0xff00) || !ismsb(ch)) /*EMPTY*/;
-               else if (!kbhit2(WAITMETA * 1000L)
-               || (ch2 = getch2()) == EOF) {
+               else if ((ch2 = getch3()) == EOF) {
X                       buf[0] = '\0';
X                       return(-1);
X               }
@@ -2019,7 +2017,7 @@
X                               code, DEFCODE, L_INPUT);
X                       return(n);
X               }
-               else if (!kbhit2(WAITMETA * 1000L) || (n = getch2()) == EOF) {
+               else if ((n = getch3()) == EOF) {
X                       buf[0] = '\0';
X                       return(-1);
X               }
@@ -2039,8 +2037,7 @@
X #endif        /* !_NOKANJICONV */
X 
X       if (isinkanji1(ch, code)) {
-               if (!kbhit2(WAITMETA * 1000L)
-               || (ch2 = getch2()) == EOF || !isinkanji2(ch2, code)) {
+               if ((ch2 = getch3()) == EOF || !isinkanji2(ch2, code)) {
X                       buf[0] = '\0';
X                       return(-1);
X               }
@@ -2085,11 +2082,13 @@
X 
X       if (!keep) {
X               inputlen = (hist) ? strlen(hist) : 0;
-               if (rptr < 0 || rptr > inputlen) rptr = inputlen;
X               insertbuf(0);
X               if (hist) memcpy(inputbuf, hist, inputlen + 1);
X               else *inputbuf = '\0';
-               vptr = vlen(inputbuf, inputlen);
+               if (rptr < 0 || rptr > inputlen) {
+                       rptr = inputlen;
+                       vptr = vlen(inputbuf, rptr);
+               }
X       }
X       displaystr();
X 
@@ -2333,6 +2332,7 @@
X       for (; cx >= 0; cx--) {
X               if (strncmp(&(inputbuf[cx]), searchstr, slen)) continue;
X               rptr = cx + slen;
+               vptr = vlen(inputbuf, rptr);
X               return(NULL);
X       }
X 
@@ -2354,6 +2354,7 @@
X                               *tmp = strdup2(inputbuf);
X                       }
X                       rptr = cx + slen;
+                       vptr = vlen(history[h][n], rptr);
X                       *histnop = n + 1;
X                       return(history[h][n]);
X               }
@@ -2379,6 +2380,7 @@
X       for (; cx <= inputlen - slen; cx++) {
X               if (strncmp(&(inputbuf[cx]), searchstr, slen)) continue;
X               rptr = cx + slen;
+               vptr = vlen(inputbuf, rptr);
X               return(NULL);
X       }
X 
@@ -2395,17 +2397,19 @@
X                               continue;
X 
X                       rptr = cx + slen;
+                       vptr = vlen(history[h][n], rptr);
X                       *histnop = n + 1;
X                       return(history[h][n]);
X               }
X       }
X 
-       if (*tmp) {
+       if (*tmp && *histnop) {
X               hlen = strlen(*tmp);
X               for (cx = 0; cx <= hlen - slen; cx++) {
X                       if (strncmp(&((*tmp)[cx]), searchstr, slen)) continue;
X 
X                       rptr = cx + slen;
+                       vptr = vlen(*tmp, rptr);
X                       *histnop = 0;
X                       return(*tmp);
X               }
@@ -2975,17 +2979,18 @@
X               minline = 0;
X               maxline = n_line;
X       }
+
X #ifndef       _NOPTY
X # ifndef      _NOORIGSHELL
X       if (!fdmode && shellmode) /*EMPTY*/;
X       else
X # endif
-       if (isptymode() && parentfd < 0) {
+       if (isptymode() && parentfd < 0 && !maxcmdline) {
X               minline = filetop(win);
X               maxline = minline + FILEPERROW;
X               ypos -= n_line - maxline;
X       }
-#endif
+#endif /* !_NOPTY */
X 
X #ifndef       _NOORIGSHELL
X       if (dumbmode || shellmode) win_y = 0;
@@ -3481,12 +3486,12 @@
X 
X       win_y = L_MESLINE;
X       do {
+               keyflush();
X               win_x = tmpx + xx[new + 1];
X               Xlocate(win_x, win_y);
X               Xtflush();
X               old = new;
X 
-               keyflush();
X               switch (ch = Xgetkey(1, 0)) {
X                       case K_RIGHT:
X                               for (new++; new != old; new++) {
diff -urNP ../FD-2.08c/kanji.hin ./kanji.hin
--- ../FD-2.08c/kanji.hin       Wed May 24 00:00:00 2006
+++ ./kanji.hin Tue Jun 13 00:00:00 2006
@@ -247,7 +247,7 @@
X               "Define the maximum size of directory history.")
X #define       SVHS_E \
X       meslist("コマンド履歴のセーブファイル保存数を設定します.", \
-               "Define the maximum size of saved history.")
+               "Define the maximum size of saved command history.")
X #define       DCLM_E \
X       meslist("ツリー表示画面の表示ファイル数を設定します.", \
X               "Define the limit of displayed files, on tree mode.")
diff -urNP ../FD-2.08c/kctype.h ./kctype.h
--- ../FD-2.08c/kctype.h        Wed May 24 00:00:00 2006
+++ ./kctype.h  Tue Jun 13 00:00:00 2006
@@ -269,6 +269,8 @@
X #define       KANAWID 1
X #endif
X 
+#define        MAXKANJIBUF     (3 + 2 + 3)
+
X #ifdef        NOMULTIKANJI
X #define       _NOKANJICONV
X #define       _NOKANJIFCONV
diff -urNP ../FD-2.08c/libc.c ./libc.c
--- ../FD-2.08c/libc.c  Wed May 24 00:00:00 2006
+++ ./libc.c    Tue Jun 13 00:00:00 2006
@@ -369,7 +369,7 @@
X       char *cwd;
X 
X       cwd = path;
-       if (!raw && path[0] && !path[1]) switch(path[0]) {
+       if (!raw && path[0] && !path[1]) switch (path[0]) {
X               case '.':
X                       cwd = NULL;
X                       break;
diff -urNP ../FD-2.08c/log.c ./log.c
--- ../FD-2.08c/log.c   Wed May 24 00:00:00 2006
+++ ./log.c     Tue Jun 13 00:00:00 2006
@@ -90,7 +90,7 @@
X       }
X 
X #ifndef       NOFLOCK
-       if (lockfile(fd, LCK_WRITE) < 0) {
+       if (isnfs(cp) <= 0 && lockfile(fd, LCK_WRITE) < 0) {
X               close(fd);
X               return(-1);
X       }
@@ -161,7 +161,7 @@
X               uc = '\n';
X               VOID_C write(fd, &uc, sizeof(uc));
X #ifndef       NOFLOCK
-               VOID_C lockfile(fd, LCK_UNLOCK);
+               if (isnfs(logfname) <= 0) VOID_C lockfile(fd, LCK_UNLOCK);
X #endif
X               VOID_C close(fd);
X       }
diff -urNP ../FD-2.08c/main.c ./main.c
--- ../FD-2.08c/main.c  Wed May 24 00:00:00 2006
+++ ./main.c    Tue Jun 13 00:00:00 2006
@@ -58,7 +58,6 @@
X #endif
X extern int wheader;
X extern char fullpath[];
-extern char *histfile;
X extern int savehist;
X extern char *helpindex[];
X extern int subwindow;
@@ -824,7 +823,7 @@
X #ifndef       _NOCUSTOMIZE
X VOID saveorigenviron(VOID_A)
X {
-       orighelpindex = copystrarray(NULL, helpindex, NULL, 10);
+       orighelpindex = copystrarray(NULL, helpindex, NULL, MAXHELPINDEX);
X       origbindlist = copybind(NULL, bindlist);
X # ifndef      _NOKEYMAP
X       origkeymaplist = copykeyseq(NULL);
@@ -1139,7 +1138,11 @@
X VOID initfd(argv)
X char **argv;
X {
-       if (interactive) {
+#ifndef        _NOORIGSHELL
+       if (!interactive) /*EMPTY*/;
+       else
+#endif
+       {
X #if   !MSDOS
X               if (adjtty) {
X                       Xstdiomode();
@@ -1147,7 +1150,7 @@
X                       Xttyiomode(0);
X               }
X #endif        /* !MSDOS */
-               loadhistory(0, histfile);
+               loadhistory(0);
X               entryhist(1, origpath, 1);
X       }
X #ifndef       _NOLOGGING
@@ -1164,7 +1167,11 @@
X #ifndef       _NOLOGGING
X       endlog(status);
X #endif
-       if (interactive && savehist > 0) savehistory(0, histfile);
+#ifndef        _NOORIGSHELL
+       if (!interactive) /*EMPTY*/;
+       else
+#endif
+       savehistory(0);
X 
X       cwd[0] = '\0';
X       if (origpath && _chdir2(origpath) < 0) {
SHAR_EOF
  : || $echo 'restore of' 'FD-2.08d.patch' 'failed'
fi
$echo 'End of' 'FD-2.08d.patch' 'part' '1'
$echo 'File' 'FD-2.08d.patch' 'is continued in part' '2'
echo 2 > _sh02637/seq
exit 0
-- 
                                               しらい たかし