しらいです。

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

Submitted-by: shirai@chandra2
Archive-name: FD-2.08e.patch/part02

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is `FD-2.08e.shar.02' (part 2 of FD-2.08e.patch).
# Do not concatenate these parts, unpack them in order with `/bin/sh'.
# File `FD-2.08e.patch' is being continued...
#
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 test ! -r _sh01537/seq; then
  $echo 'Please unpack part 1 first!'
  exit 1
fi
shar_sequence=`cat _sh01537/seq`
if test "$shar_sequence" != 2; then
  $echo 'Please unpack part' "$shar_sequence" 'next!'
  exit 1
fi
if test ! -f _sh01537/new; then
  $echo 'x -' 'STILL SKIPPING' 'FD-2.08e.patch'
else
  $echo 'x -' 'continuing file' 'FD-2.08e.patch'
  sed 's/^X//' << 'SHAR_EOF' >> FD-2.08e.patch &&
X               free(tmp);
X       }
X 
+#  ifdef       _USEUNICODE
X       if (!unicodebuffer) discardunitable();
+#  endif
X       if (fpin != stdin) Xfclose(fpin);
X       else clearerr(fpin);
X       if (fpout != stdout) Xfclose(fpout);
@@ -3208,7 +3211,6 @@
X       setenv2(argv[1], cp, 1);
X       if (cp) free(cp);
X       adjustpath();
-       evalenv();
X 
X       return(0);
X }
@@ -3379,7 +3381,6 @@
X               i = argc;
X               if ((cp = getenvval(&i, argv)) != (char *)-1 && i == argc) {
X                       if (setenv2(argv[0], cp, 0) < 0) error(argv[0]);
-                       evalenv();
X                       if (cp) free(cp);
X                       n = RET_SUCCESS;
X               }
diff -urNP ../FD-2.08d/command.c ./command.c
--- ../FD-2.08d/command.c       Tue Jun 13 00:00:00 2006
+++ ./command.c Fri Jul 28 00:00:00 2006
@@ -35,7 +35,6 @@
X extern int fnameofs;
X extern int chgorder;
X extern int stackdepth;
-extern int removepolicy;
X extern namelist filestack[];
X #ifndef       _NOARCHIVE
X extern char archivedir[];
@@ -1267,7 +1266,7 @@
X #ifdef        _NOARCHIVE
X       help(0);
X #else
-       help(archivefile != NULL);
+       help((archivefile) ? 1 : 0);
X #endif
X 
X       return(FNC_UPDATE);
@@ -1423,9 +1422,9 @@
X       char *cp;
X       int len;
X 
-       removepolicy = 0;
X       if (mark > 0) {
X               if (!yesno(DELMK_K)) return(FNC_CANCEL);
+               prepareremove();
X               filepos = applyfile(rmvfile, NULL);
X       }
X       else if (isdir(&(filelist[filepos]))) return(warning_bell(arg));
@@ -1434,6 +1433,7 @@
X               len = strlen2(cp) - strsize("%.*s");
X               if (!yesno(cp, n_lastcolumn - len, filelist[filepos].name))
X                       return(FNC_CANCEL);
+               prepareremove();
X               filepos = applyfile(rmvfile, NULL);
X       }
X       if (filepos >= maxfile && (filepos -= 2) < 0) filepos = 0;
@@ -1444,8 +1444,11 @@
X static int delete_dir(arg)
X char *arg;
X {
+#if    !defined (NOSYMLINK) && !defined (_NODOSDRIVE)
+       char path[MAXPATHLEN];
+#endif
X       char *cp;
-       int len;
+       int ret, len;
X 
X       if (!isdir(&(filelist[filepos])) || isdotdir(filelist[filepos].name))
X               return(warning_bell(arg));
@@ -1453,23 +1456,20 @@
X       len = strlen2(cp) - strsize("%.*s");
X       if (!yesno(cp, n_lastcolumn - len, filelist[filepos].name))
X               return(FNC_CANCEL);
-       removepolicy = 0;
X       cp = filelist[filepos].name;
X #ifndef       NOSYMLINK
X       if (islink(&(filelist[filepos]))) {
-# ifndef       _NODOSDRIVE
-               char path[MAXPATHLEN];
-# endif
-               int ret;
-
+               prepareremove();
X               ret = rmvfile(fnodospath(path, filepos));
-               if (ret < 0) warning(-1, cp);
-               else if (!ret) filepos++;
+               if (ret == APL_ERROR) warning(-1, cp);
X       }
X       else
X #endif
-       if (!applydir(cp, rmvfile, NULL, rmvdir, ORD_NOPREDIR, NULL))
-               filepos++;
+       {
+               prepareremove();
+               ret = applydir(cp, rmvfile, NULL, rmvdir, ORD_NOPREDIR, NULL);
+       }
+       if (ret == APL_OK) filepos++;
X       if (filepos >= maxfile && (filepos -= 2) < 0) filepos = 0;
X 
X       return(FNC_EFFECT);
@@ -1511,7 +1511,7 @@
X       if (!(findregexp = prepareregexp(FINDD_K, arg))) return(FNC_CANCEL);
X       destpath = NULL;
X       cp = isdir(&(filelist[filepos])) ? filelist[filepos].name : curpath;
-       applydir(cp, findfile, finddir, NULL, ORD_NORMAL, NOFND_K);
+       VOID_C applydir(cp, findfile, finddir, NULL, ORD_NORMAL, NOFND_K);
X       regexp_free(findregexp);
X       if (!destpath) return(FNC_CANCEL);
X 
@@ -1827,7 +1827,7 @@
X               if (FILEPERROW < WFILEMINATTR) return(FNC_EFFECT);
X               return(FNC_UPDATE);
X       }
-       applydir(filelist[filepos].name, setattr,
+       VOID_C applydir(filelist[filepos].name, setattr,
X               NULL, setattr, ORD_NOPREDIR, NULL);
X 
X       return(FNC_EFFECT);
diff -urNP ../FD-2.08d/custom.c ./custom.c
--- ../FD-2.08d/custom.c        Tue Jun 13 00:00:00 2006
+++ ./custom.c  Fri Jul 28 00:00:00 2006
@@ -68,7 +68,7 @@
X #ifndef       _NOORIGSHELL
X extern char *promptstr2;
X #endif
-#if    !defined (_NOKANJICONV) || !defined (_NODOSDRIVE)
+#ifdef _USEUNICODE
X extern int unicodebuffer;
X #endif
X #ifndef       _NOKANJIFCONV
@@ -115,7 +115,7 @@
X extern char fullpath[];
X extern char *origpath;
X extern char *progpath;
-#if    !defined (_NOKANJICONV) || !defined (_NODOSDRIVE)
+#ifdef _USEUNICODE
X extern char *unitblpath;
X #endif
X #ifndef       _NOCUSTOMIZE
@@ -162,6 +162,9 @@
X                       (selectstr(n, m, x, s, v) != K_CR)
X #define       MAXSAVEMENU     5
X #define       MAXTNAMLEN      8
+#define        DEFPALETTE      "8962435188"
+#define        MAXPALETTE      10
+#define        MAXCOLOR        10
X #ifndef       O_BINARY
X #define       O_BINARY        0
X #endif
@@ -216,20 +219,23 @@
X #define       T_DDRV          T_BOOL
X #endif
X #define       T_COLOR         12
-#define        T_EDIT          13
-#define        T_KIN           14
-#define        T_KOUT          15
-#define        T_KNAM          16
-#define        T_KTERM         17
-#define        T_OCTAL         18
-#define        T_KEYCODE       19
+#define        T_COLORPAL      13
+#define        T_EDIT          14
+#define        T_KIN           15
+#define        T_KOUT          16
+#define        T_KNAM          17
+#define        T_KTERM         18
+#define        T_KPATHS        19
+#define        T_OCTAL         20
+#define        T_KEYCODE       21
+#define        T_NOVAR         22
X 
X #ifndef       _NOKANJIFCONV
X typedef struct _pathtable {
X       VOID_P path;
X       char *last;
-       int lang;
-       int flags;
+       u_char lang;
+       u_char flags;
X } pathtable;
X 
X #define       P_ISARRAY       0001
@@ -239,7 +245,9 @@
X #if   FD >= 2
X static int NEAR atooctal __P_((char *));
X #endif
+static int NEAR getenvid __P_((char *, int, int *));
X static VOID NEAR _evalenv __P_((int));
+static VOID NEAR evalenvone __P_((int));
X #ifndef       _NOKANJIFCONV
X static char *NEAR pathlang __P_((pathtable *, int));
X static VOID NEAR pathconv __P_((pathtable *));
@@ -269,6 +277,7 @@
X static VOID NEAR putargs __P_((char *, int, char *[], FILE *));
X # endif
X static char *NEAR int2str __P_((char *, int));
+static int NEAR inputkeycode __P_((char *));
X static int NEAR dispenv __P_((int));
X static int NEAR editenv __P_((int));
X static int NEAR dumpenv __P_((char *, FILE *));
@@ -341,7 +350,7 @@
X int custno = -1;
X #endif
X 
-static CONST envtable envlist[] = {
+static envtable envlist[] = {
X       {"FD_SORTTYPE", &sorttype, DEFVAL(SORTTYPE), STTP_E, T_SORT},
X       {"FD_DISPLAYMODE", &displaymode, DEFVAL(DISPLAYMODE), DPMD_E, T_DISP},
X #ifndef       _NOTREE
@@ -385,7 +394,8 @@
X #ifndef       _NOCOLOR
X       {"FD_ANSICOLOR", &ansicolor, DEFVAL(ANSICOLOR), ACOL_E, T_COLOR},
X # if  FD >= 2
-       {"FD_ANSIPALETTE", &ansipalette, DEFVAL(ANSIPALETTE), APAL_E, T_CHARP},
+       {"FD_ANSIPALETTE", &ansipalette,
+               DEFVAL(ANSIPALETTE), APAL_E, T_COLORPAL},
X # endif
X #endif        /* !_NOCOLOR */
X #ifndef       _NOEDITMODE
@@ -433,7 +443,7 @@
X #if   FD >= 2
X       {"FD_THRUARGS", &thruargs, DEFVAL(THRUARGS), THARG_E, T_BOOL},
X #endif
-#if    !defined (_NOKANJICONV) || !defined (_NODOSDRIVE)
+#ifdef _USEUNICODE
X       {"FD_UNICODEBUFFER", &unicodebuffer,
X               DEFVAL(UNICODEBUFFER), UNBF_E, T_BOOL},
X #endif
@@ -453,21 +463,32 @@
X #endif
X #ifndef       _NOKANJIFCONV
X       {"FD_FNAMEKCODE", &fnamekcode, DEFVAL(NOCNV), FNKC_E, T_KNAM},
-       {"FD_SJISPATH", &sjispath, DEFVAL(SJISPATH), SJSP_E, T_PATHS},
-       {"FD_EUCPATH", &eucpath, DEFVAL(EUCPATH), EUCP_E, T_PATHS},
-       {"FD_JISPATH", &jis7path, DEFVAL(JISPATH), JISP_E, T_PATHS},
-       {"FD_JIS8PATH", &jis8path, DEFVAL(JIS8PATH), JS8P_E, T_PATHS},
-       {"FD_JUNETPATH", &junetpath, DEFVAL(JUNETPATH), JNTP_E, T_PATHS},
-       {"FD_OJISPATH", &ojis7path, DEFVAL(OJISPATH), OJSP_E, T_PATHS},
-       {"FD_OJIS8PATH", &ojis8path, DEFVAL(OJIS8PATH), OJ8P_E, T_PATHS},
-       {"FD_OJUNETPATH", &ojunetpath, DEFVAL(OJUNETPATH), OJNP_E, T_PATHS},
-       {"FD_HEXPATH", &hexpath, DEFVAL(HEXPATH), HEXP_E, T_PATHS},
-       {"FD_CAPPATH", &cappath, DEFVAL(CAPPATH), CAPP_E, T_PATHS},
-       {"FD_UTF8PATH", &utf8path, DEFVAL(UTF8PATH), UTF8P_E, T_PATHS},
+       {"FD_SJISPATH", &sjispath, DEFVAL(SJISPATH), SJSP_E, T_KPATHS},
+       {"FD_EUCPATH", &eucpath, DEFVAL(EUCPATH), EUCP_E, T_KPATHS},
+       {"FD_JISPATH", &jis7path, DEFVAL(JISPATH), JISP_E, T_KPATHS},
+       {"FD_JIS8PATH", &jis8path, DEFVAL(JIS8PATH), JS8P_E, T_KPATHS},
+       {"FD_JUNETPATH", &junetpath, DEFVAL(JUNETPATH), JNTP_E, T_KPATHS},
+       {"FD_OJISPATH", &ojis7path, DEFVAL(OJISPATH), OJSP_E, T_KPATHS},
+       {"FD_OJIS8PATH", &ojis8path, DEFVAL(OJIS8PATH), OJ8P_E, T_KPATHS},
+       {"FD_OJUNETPATH", &ojunetpath, DEFVAL(OJUNETPATH), OJNP_E, T_KPATHS},
+       {"FD_HEXPATH", &hexpath, DEFVAL(HEXPATH), HEXP_E, T_KPATHS},
+       {"FD_CAPPATH", &cappath, DEFVAL(CAPPATH), CAPP_E, T_KPATHS},
+       {"FD_UTF8PATH", &utf8path, DEFVAL(UTF8PATH), UTF8P_E, T_KPATHS},
X       {"FD_UTF8MACPATH", &utf8macpath,
-               DEFVAL(UTF8MACPATH), UTF8MACP_E, T_PATHS},
-       {"FD_NOCONVPATH", &noconvpath, DEFVAL(NOCONVPATH), NCVP_E, T_PATHS},
+               DEFVAL(UTF8MACPATH), UTF8MACP_E, T_KPATHS},
+       {"FD_NOCONVPATH", &noconvpath, DEFVAL(NOCONVPATH), NCVP_E, T_KPATHS},
X #endif        /* !_NOKANJIFCONV */
+#ifndef        _NOCUSTOMIZE
+       {"FD_PAGER", NULL, DEFVAL(NULL), PAGR_E, T_NOVAR},
+       {"FD_EDITOR", NULL, DEFVAL(NULL), EDIT_E, T_NOVAR},
+       {"FD_SHELL", NULL, DEFVAL(NULL), SHEL_E, T_NOVAR},
+# ifndef       NOPOSIXUTIL
+       {"FD_FCEDIT", NULL, DEFVAL(NULL), FCED_E, T_NOVAR},
+# endif
+# if   MSDOS
+       {"FD_COMSPEC", NULL, DEFVAL(NULL), CMSP_E, T_NOVAR},
+# endif
+#endif /* !_NOCUSTOMIZE */
X };
X #define       ENVLISTSIZ      arraysize(envlist)
X 
@@ -476,7 +497,9 @@
X       {fullpath, NULL, NOCNV, P_ISARRAY},
X       {&origpath, NULL, NOCNV, P_STABLE},
X       {&progpath, NULL, NOCNV, P_STABLE},
+# ifdef        _USEUNICODE
X       {&unitblpath, NULL, NOCNV, P_STABLE},
+# endif
X };
X #define       PATHLISTSIZ     arraysize(pathlist)
X # ifndef      _NOSPLITWIN
@@ -526,6 +549,43 @@
X #endif        /* !_NOCUSTOMIZE */
X 
X 
+VOID initenv(VOID_A)
+{
+#if    !MSDOS
+       char *cp;
+       int w;
+#endif
+       int i;
+
+#if    !MSDOS
+       if ((w = sizeof(char *) - sizeof(int)) > 0) {
+               i = 0x5a;
+               cp = (char *)(&i);
+               if (*cp == 0x5a) w = 0;
+       }
+#endif
+
+       for (i = 0; i < ENVLISTSIZ; i++) {
+#if    !MSDOS
+               if (w > 0) switch (env_type(i)) {
+                       case T_CHARP:
+                       case T_PATH:
+                       case T_PATHS:
+                       case T_COLORPAL:
+                       case T_EDIT:
+                       case T_KPATHS:
+                       case T_NOVAR:
+                               break;
+                       default:
+                               cp = (char *)(&(envlist[i].def.num));
+                               memmove(cp, &(cp[w]), sizeof(int));
+                               break;
+               }
+#endif /* !MSDOS */
+               _evalenv(i);
+       }
+}
+
X #if   FD >= 2
X static int NEAR atooctal(s)
X char *s;
@@ -539,6 +599,27 @@
X }
X #endif        /* FD >= 2 */
X 
+static int NEAR getenvid(s, len, envp)
+char *s;
+int len, *envp;
+{
+       int i;
+
+       if (len < 0) len = strlen(s);
+       for (i = 0; i < ENVLISTSIZ; i++) {
+               if (!strnenvcmp(s, fdenv_str(i), len) && !fdenv_str(i)[len]) {
+                       if (envp) *envp = 0;
+                       return(i);
+               }
+               if (!strnenvcmp(s, env_str(i), len) && !env_str(i)[len]) {
+                       if (envp) *envp = 1;
+                       return(i);
+               }
+       }
+
+       return(-1);
+}
+
X static VOID NEAR _evalenv(no)
X int no;
X {
@@ -572,6 +653,7 @@
X                       *((char **)(envlist[no].var)) = cp;
X                       break;
X               case T_PATHS:
+               case T_KPATHS:
X                       if (!cp) cp = def_str(no);
X                       cp = evalpaths(cp, ':');
X                       if (*((char **)(envlist[no].var)))
@@ -583,6 +665,7 @@
X                       || ((n % 100) & ~15) || ((n % 100) & 7) > MAXSORTTYPE)
X                               n = def_num(no);
X                       *((int *)(envlist[no].var)) = n;
+                       sorton = n % 100;
X                       break;
X               case T_DISP:
X #ifdef        HAVEFLAGS
@@ -660,6 +743,10 @@
X                       *((int *)(envlist[no].var)) = n;
X                       break;
X #endif
+#ifndef        _NOCUSTOMIZE
+               case T_NOVAR:
+                       break;
+#endif
X               default:
X                       if (!cp) cp = def_str(no);
X                       *((char **)(envlist[no].var)) = cp;
@@ -787,23 +874,48 @@
X #endif
X }
X 
-VOID evalenv(VOID_A)
+static VOID NEAR evalenvone(n)
+int n;
+{
+#ifndef        _NOKANJIFCONV
+       int type;
+#endif
+
+#ifndef        _NOKANJIFCONV
+       type = env_type(n);
+       if (type < T_KIN || type > T_KPATHS) type = -1;
+       if (type >= 0) savepathlang();
+#endif
+       _evalenv(n);
+#ifndef        _NOKANJIFCONV
+       if (type >= 0) evalpathlang();
+#endif
+}
+
+VOID evalenv(s, len)
+char *s;
+int len;
X {
X       int i, duperrno;
X 
X       duperrno = errno;
+
+       if (s) {
+               if ((i = getenvid(s, len, NULL)) < 0) return;
+               evalenvone(i);
+       }
+       else {
X #ifndef       _NOKANJIFCONV
-       savepathlang();
+               savepathlang();
X #endif
-       for (i = 0; i < ENVLISTSIZ; i++) _evalenv(i);
+               for (i = 0; i < ENVLISTSIZ; i++) _evalenv(i);
X #ifndef       _NOKANJIFCONV
-       evalpathlang();
+               evalpathlang();
X #endif
+       }
+
X       evalheader();
X       errno = duperrno;
-#if    !MSDOS && !defined (_NOORIGSHELL)
-       if (autosavetty) savestdio(0);
-#endif
X }
X 
X #ifdef        DEBUG
@@ -820,6 +932,7 @@
X       for (i = 0; i < ENVLISTSIZ; i++) switch (env_type(i)) {
X               case T_PATH:
X               case T_PATHS:
+               case T_KPATHS:
X                       if (*((char **)(envlist[i].var)))
X                               free(*((char **)(envlist[i].var)));
X                       *((char **)(envlist[i].var)) = NULL;
@@ -1200,6 +1313,29 @@
X       return(buf);
X }
X 
+static int NEAR inputkeycode(s)
+char *s;
+{
+       int c, dupwin_x, dupwin_y;
+
+       dupwin_x = win_x;
+       dupwin_y = win_y;
+       Xlocate(0, L_INFO);
+       Xputterm(L_CLEAR);
+       win_x = custputs(s);
+       win_y = L_INFO;
+       Xlocate(win_x, win_y);
+       Xtflush();
+       keyflush();
+       Xgetkey(-1, 0);
+       c = Xgetkey(1, 0);
+       Xgetkey(-1, 0);
+       win_x = dupwin_x;
+       win_y = dupwin_y;
+
+       return(c);
+}
+
X static int NEAR dispenv(no)
X int no;
X {
@@ -1299,6 +1435,30 @@
X                       str[3] = VCOL3_K;
X                       cp = str[*((int *)(envlist[no].var))];
X                       break;
+#  if  FD >= 2
+               case T_COLORPAL:
+                       str[0] = VBLK1_K;
+                       str[1] = VRED1_K;
+                       str[2] = VGRN1_K;
+                       str[3] = VYEL1_K;
+                       str[4] = VBLU1_K;
+                       str[5] = VMAG1_K;
+                       str[6] = VCYN1_K;
+                       str[7] = VWHI1_K;
+                       str[8] = VFOR1_K;
+                       str[9] = VBAK1_K;
+                       if (!(cp = getenv2(fdenv_str(no)))) cp = def_str(no);
+                       new = NULL;
+                       for (n = 0; n < MAXPALETTE; n++) {
+                               if (n) new = strcatalloc(new, "/");
+                               p = (isdigit2(cp[n])) ? cp[n] : DEFPALETTE[n];
+                               p -= '0';
+                               new = strcatalloc(new, str[p]);
+                               if (!cp[n]) cp--;
+                       }
+                       cp = new;
+                       break;
+#  endif       /* FD >= 2*/
X # endif       /* !_NOCOLOR */
X # ifndef      _NOEDITMODE
X               case T_EDIT:
@@ -1407,6 +1567,7 @@
X                       break;
X               case T_PATH:
X               case T_PATHS:
+               case T_KPATHS:
X                       if (!(cp = getenv2(fdenv_str(no)))) cp = def_str(no);
X                       new = inputcustenvstr(env, 1, cp, HST_PATH);
X                       if (new == (char *)-1) return(0);
@@ -1553,6 +1714,57 @@
X                       if (noselect(&n, 5, 0, str, val)) return(0);
X                       cp = (n >= 0) ? int2str(buf, n) : NULL;
X                       break;
+#  if  FD >= 2
+               case T_COLORPAL:
+                       n = 0;
+                       str[0] = VCREG_K;
+                       str[1] = VCBAK_K;
+                       str[2] = VCDIR_K;
+                       str[3] = VCUWR_K;
+                       str[4] = VCURD_K;
+                       str[5] = VCLNK_K;
+                       str[6] = VCSCK_K;
+                       str[7] = VCFIF_K;
+                       str[8] = VCBLD_K;
+                       str[9] = VCCHD_K;
+                       str[MAXPALETTE] = VUSET_K;
+                       val[MAXPALETTE] = -1;
+                       envcaption(env);
+                       if (noselect(&n, MAXPALETTE + 1, 0, str, val))
+                               return(0);
+                       if (n < 0) {
+                               cp = NULL;
+                               break;
+                       }
+                       cp = *((char **)(envlist[no].var));
+                       p = (cp) ? strlen(cp) : 0;
+                       if (p < MAXPALETTE) p = MAXPALETTE;
+                       new = malloc2(p + 1);
+                       p = 0;
+                       if (cp) for (; cp[p]; p++) new[p] = cp[p];
+                       for (; p < MAXPALETTE; p++) new[p] = DEFPALETTE[p];
+                       new[p] = '\0';
+                       p = (isdigit2(new[n])) ? new[n] : DEFPALETTE[n];
+                       p -= '0';
+                       str[0] = VBLK2_K;
+                       str[1] = VRED2_K;
+                       str[2] = VGRN2_K;
+                       str[3] = VYEL2_K;
+                       str[4] = VBLU2_K;
+                       str[5] = VMAG2_K;
+                       str[6] = VCYN2_K;
+                       str[7] = VWHI2_K;
+                       str[8] = VFOR2_K;
+                       str[9] = VBAK2_K;
+                       envcaption(env);
+                       if (noselect(&p, MAXCOLOR, 0, str, val)) {
+                               free(new);
+                               return(0);
+                       }
+                       new[n] = p + '0';
+                       cp = new;
+                       break;
+#  endif       /* FD >= 2*/
X # endif       /* !_NOCOLOR */
X # ifndef      _NOEDITMODE
X               case T_EDIT:
@@ -1606,9 +1818,11 @@
X                               if (val[n] < 0 || (kanjiiomode[val[n]] & p))
X                                       continue;
X                               tmp--;
-                               memmove(&(str[n]), &(str[n + 1]),
+                               memmove((char *)&(str[n]),
+                                       (char *)&(str[n + 1]),
X                                       (tmp - n) * sizeof(char *));
-                               memmove(&(val[n]), &(val[n + 1]),
+                               memmove((char *)&(val[n]),
+                                       (char *)&(val[n + 1]),
X                                       (tmp - n) * sizeof(int));
X                               n--;
X                       }
@@ -1620,10 +1834,13 @@
X                               case O_JIS8:
X                               case O_JUNET:
X                               case CAP:
-                               case M_UTF8:
X                                       p = 1;
X                                       n--;
X                                       break;
+                               case M_UTF8:
+                                       p = n - UTF8;
+                                       n = UTF8;
+                                       break;
X                               default:
X                                       p = 0;
X                                       break;
@@ -1642,14 +1859,17 @@
X                               case JUNET:
X                                       str[0] = VNJIS_K;
X                                       str[1] = VOJIS_K;
+                                       tmp = 2;
X                                       break;
X                               case HEX:
X                                       str[0] = "HEX";
X                                       str[1] = "CAP";
+                                       tmp = 2;
X                                       break;
X                               case UTF8:
X                                       str[0] = VUTF8_K;
X                                       str[1] = VUTFM_K;
+                                       tmp = 2;
X                                       break;
X                               default:
X                                       tmp = -1;
@@ -1658,7 +1878,7 @@
X                       if (tmp >= 0) {
X                               val[0] = 0;
X                               val[1] = 1;
-                               if (noselect(&p, 2, 64, str, val)) return(0);
+                               if (noselect(&p, tmp, 64, str, val)) return(0);
X                               n += p;
X                       }
X #  endif      /* !_NOKANJICONV */
@@ -1700,15 +1920,16 @@
X # endif       /* FD >= 2 */
X # ifndef      _NOPTY
X               case T_KEYCODE:
-                       if (!(cp = getenv2(fdenv_str(no)))) cp = nullstr;
-                       new = inputcustenvstr(env, 0, cp, -1);
-                       if (new == (char *)-1) return(0);
-                       if (new && getkeycode(new, 0) < 0) {
-                               warning(0, VALNG_K);
-                               free(new);
-                               return(0);
+                       cp = asprintf3(VKYCD_K, env);
+                       n = inputkeycode(cp);
+                       free(cp);
+                       if (n == K_ESC) {
+                               if (!yesno(USENV_K, env)) return(0);
+                               cp = NULL;
+                               break;
X                       }
-                       cp = new;
+                       cp = getkeysym(n, 0);
+                       if (!yesno(VKYOK_K, cp, env_str(no))) return(0);
X                       break;
X # endif       /* !_NOPTY */
X               default:
@@ -1723,13 +1944,8 @@
X       else n = setenv2(env, cp, 0);
X       if (new) free(new);
X       if (n < 0) warning(-1, env);
-#ifndef        _NOKANJIFCONV
-       savepathlang();
-#endif
-       _evalenv(no);
-#ifndef        _NOKANJIFCONV
-       evalpathlang();
-#endif
+
+       evalenvone(no);
X       evalheader();
X 
X       return(1);
@@ -1783,38 +1999,24 @@
X       char *cp, *ident, **unset, **trash;
X       int i, n, ns, nu, nt, f;
X 
-       for (n = 0; argv[n]; n++) {
-               for (i = 0; i < ENVLISTSIZ; i++) {
-                       if (!strnenvcmp(argv[n], fdenv_str(i), len[n])) break;
-                       if (!strnenvcmp(argv[n], env_str(i), len[n])) break;
-               }
-               if (i < ENVLISTSIZ) break;
-       }
+       for (n = 0; argv[n]; n++)
+               if (getenvid(argv[n], len[n], NULL) >= 0) break;
X       if (!argv[n]) return(0);
X 
X       unset = trash = NULL;
X       ns = nu = nt = 0;
X       for (n = 0; argv[n]; n++) {
-#  ifdef       FAKEUNINIT
-               f = 0;  /* fake for -Wuninitialized */
-#  endif
-               for (i = 0; i < ENVLISTSIZ; i++) {
-                       ident = fdenv_str(i);
-                       if (!strnenvcmp(argv[n], ident, len[n])) {
-                               f = 1;
-                               break;
-                       }
-                       ident = env_str(i);
-                       if (!strnenvcmp(argv[n], ident, len[n])) {
-                               f = 2;
-                               break;
-                       }
-               }
-               if (i >= ENVLISTSIZ) {
+               if ((i = getenvid(argv[n], len[n], &f)) < 0) {
X                       if (ns++) fputc(' ', fp);
X                       fputs(argv[n], fp);
+                       continue;
X               }
-               else if (flaglist && (flaglist[i] & f)) {
+
+               ident = fdenv_str(i);
+               if (f) ident += FDESIZ;
+               f = (1 << f);
+
+               if (flaglist && (flaglist[i] & f)) {
X                       trash = (char **)realloc2(trash,
X                               (nt + 1) * sizeof(char *));
X                       trash[nt++] = argv[n];
@@ -1862,39 +2064,24 @@
X       if (strcommcmp(argv[0], BL_UNSET)) return(0);
X       if (argc < 2) return(-1);
X 
-       for (n = 1; argv[n]; n++) {
-               for (i = 0; i < ENVLISTSIZ; i++) {
-                       if (!strenvcmp(argv[n], fdenv_str(i))) break;
-                       if (!strenvcmp(argv[n], env_str(i))) break;
-               }
-               if (i < ENVLISTSIZ) break;
-       }
-       if (!argv[n]) return(0);
+       for (n = 1; n < argc; n++) if (getenvid(argv[n], -1, NULL) >= 0) break;
+       if (n >= argc) return(0);
X 
X       unset = trash = NULL;
X       ns = nu = nt = 0;
X       for (n = 1; n < argc; n++) {
-#  ifdef       FAKEUNINIT
-               f = 0;  /* fake for -Wuninitialized */
-#  endif
-               for (i = 0; i < ENVLISTSIZ; i++) {
-                       ident = fdenv_str(i);
-                       if (!strenvcmp(argv[n], ident)) {
-                               f = 1;
-                               break;
-                       }
-                       ident = env_str(i);
-                       if (!strenvcmp(argv[n], ident)) {
-                               f = 2;
-                               break;
-                       }
-               }
-               if (i >= ENVLISTSIZ) {
+               if ((i = getenvid(argv[n], -1, &f)) < 0) {
X                       unset = (char **)realloc2(unset,
X                               (nu + 1) * sizeof(char *));
X                       unset[nu++] = argv[n];
+                       continue;
X               }
-               else if (flaglist && (flaglist[i] & f)) {
+
+               ident = fdenv_str(i);
+               if (f) ident += FDESIZ;
+               f = (1 << f);
+
+               if (flaglist && (flaglist[i] & f)) {
X                       trash = (char **)realloc2(trash,
X                               (nt + 1) * sizeof(char *));
X                       trash[nt++] = ident;
@@ -2034,7 +2221,7 @@
X {
X       bindtable bind;
X       char *cp, *str, *buf, *func1, *func2;
-       int i, n1, n2, key, dupwin_x, dupwin_y;
+       int i, n1, n2, key;
X 
X       if ((key = bindlist[no].key) < 0) {
X               if (no >= MAXBINDTABLE - 1) {
@@ -2042,21 +2229,7 @@
X                       return(0);
X               }
X 
-               dupwin_x = win_x;
-               dupwin_y = win_y;
-               Xlocate(0, L_INFO);
-               Xputterm(L_CLEAR);
-               win_x = custputs(BINDK_K);
-               win_y = L_INFO;
-               Xlocate(win_x, win_y);
-               Xtflush();
-               keyflush();
-               Xgetkey(-1, 0);
-               key = Xgetkey(1, 0);
-               Xgetkey(-1, 0);
-               win_x = dupwin_x;
-               win_y = dupwin_y;
-
+               key = inputkeycode(BINDK_K);
X               for (i = 0; i < MAXBINDTABLE && bindlist[i].key >= 0; i++)
X                       if (key == (int)(bindlist[i].key)) break;
X               if (bindlist[i].key < 0)
@@ -2587,7 +2760,7 @@
X       putsep();
X       fillline(yy + y++, n_column);
X       nf = ni = ne = 0;
-       if (list -> format) for(; y < FILEPERROW - 1; y++) {
+       if (list -> format) for (; y < FILEPERROW - 1; y++) {
X               if (nf >= 0) {
X                       if (!(list -> format[nf])) {
X                               nf = -1;
@@ -3411,9 +3584,7 @@
X                                       break;
X                       if (fdtype[i].name) continue;
X #  endif
-                       sbuf[n][0] = dev.drive + 'A';
-                       sbuf[n][1] = ':';
-                       sbuf[n][2] = '\0';
+                       VOID_C gendospath(sbuf[n], dev.drive + 'A', '\0');
X                       str[n] = sbuf[n];
X                       val[n++] = dev.drive + 'A';
X               }
@@ -4113,9 +4284,7 @@
X # ifdef       _USEDOSEMU
X               case 5:
X                       if (fdtype[no].name) {
-                               buf[0] = fdtype[no].drive;
-                               buf[1] = ':';
-                               buf[2] = '\0';
+                               VOID_C gendospath(buf, fdtype[no].drive, '\0');
X                               cp = buf;
X                       }
X                       break;
diff -urNP ../FD-2.08d/doscom.c ./doscom.c
--- ../FD-2.08d/doscom.c        Tue Jun 13 00:00:00 2006
+++ ./doscom.c  Fri Jul 28 00:00:00 2006
@@ -8,13 +8,10 @@
X #ifdef        FD
X #include "fd.h"
X #else /* !FD */
+#include "machine.h"
X #include <stdio.h>
X #include <string.h>
X #include <errno.h>
-#include "machine.h"
-#include "printf.h"
-#include "kctype.h"
-#include "pathname.h"
X 
X #ifndef       NOUNISTDH
X #include <unistd.h>
@@ -23,6 +20,10 @@
X #ifndef       NOSTDLIBH
X #include <stdlib.h>
X #endif
+
+#include "printf.h"
+#include "kctype.h"
+#include "pathname.h"
X #endif        /* !FD */
X 
X #ifdef        USETIMEH
@@ -461,10 +462,7 @@
X       statfs_t fsbuf;
X 
X # if  MSDOS
-       drv[0] = toupper2(path[0]);
-       drv[1] = ':';
-       drv[2] = '\\';
-       drv[3] = '\0';
+       VOID_C gendospath(drv, toupper2(path[0]), _SC_);
X 
X       reg.x.ax = 0x71a0;
X       reg.x.bx = 0;
diff -urNP ../FD-2.08d/dosdisk.c ./dosdisk.c
--- ../FD-2.08d/dosdisk.c       Tue Jun 13 00:00:00 2006
+++ ./dosdisk.c Fri Jul 28 00:00:00 2006
@@ -4,11 +4,11 @@
X  *    MSDOS disk accessing module
X  */
X 
+#include "machine.h"
X #include <stdio.h>
X #include <string.h>
X #include <errno.h>
X #include <fcntl.h>
-#include "machine.h"
X 
X #ifndef       NOUNISTDH
X #include <unistd.h>
@@ -59,6 +59,9 @@
X #include <sys/ioctl.h>
X #define       D_SECSIZE(dl)   (dl).d_secsize
X # ifdef       BSD4
+#  ifdef       NETBSD
+#  define      OMIT_FSTYPENUMS         /* For NetBSD >=3.1 */
+#  endif
X # include <sys/disklabel.h>
X # else        /* !BSD4 */
X #  ifdef      SOLARIS
@@ -167,6 +170,7 @@
X #endif
X 
X #ifdef        FD
+extern char *gendospath __P_((char *, int, int));
X extern char *strdelim __P_((char *, int));
X extern char *strrdelim __P_((char *, int));
X extern char *strrdelim2 __P_((char *, char *));
@@ -180,11 +184,12 @@
X extern time_t timelocal2 __P_((struct tm *));
X extern u_int unifysjis __P_((u_int, int));
X extern u_int cnvunicode __P_((u_int, int));
-extern off_t Xlseek __P_((int, off_t, int));
+extern int intrkey __P_((VOID_A));
X #else /* !FD */
X #ifndef       NOTZFILEH
X #include <tzfile.h>
X #endif
+static char *NEAR gendospath __P_((char *, int, int));
X static char *NEAR strdelim __P_((char *, int));
X static char *NEAR strrdelim __P_((char *, int));
X static char *NEAR strrdelim2 __P_((char *, char *));
@@ -208,8 +213,9 @@
X static int NEAR openunitbl __P_((char *));
X static u_int NEAR unifysjis __P_((u_int, int));
X static u_int NEAR cnvunicode __P_((u_int, int));
-#define        getword(s, n)   (((u_int)((s)[(n) + 1]) << 8) | (s)[n])
-#define        Xlseek          lseek
+#define        getword(s, n)   (((u_short)((s)[(n) + 1]) << 8) | (s)[n])
+#define        skread(f,o,s,n) (lseek(f, o, L_SET) >= (off_t)0 \
+                       && read(f, s, n) == n)
X #define       SJ_UDEF         0x81ac  /* GETA */
X #define       U2_UDEF         0x3013  /* GETA */
X #define       UNICODETBL      "fd-unicd.tbl"
@@ -517,6 +523,18 @@
X #endif
X 
X #ifndef       FD
+static char *NEAR gendospath(path, drive, c)
+char *path;
+int drive, c;
+{
+       *(path++) = drive;
+       *(path++) = ':';
+       if (c) *(path++) = c;
+       *path = '\0';
+
+       return(path);
+}
+
X static char *NEAR strdelim(s, d)
X char *s;
X int d;
@@ -939,16 +957,21 @@
X u_int wc;
X int russ;
X {
-       int i;
+       int n, min, max;
X 
X       wc &= 0xffff;
-       for (i = ((russ) ? 0 : EXCEPTRUSS); i < RSJISTBLSIZ; i++)
-               if (wc >= rsjistable[i].start
-               && wc < rsjistable[i].start + rsjistable[i].range)
+       min = ((russ) ? 0 : EXCEPTRUSS) - 1;
+       max = RSJISTBLSIZ;
+       for (;;) {
+               n = (min + max) / 2;
+               if (n <= min || n >= max) break;
+               if (wc >= rsjistable[n].start + rsjistable[n].range) min = n;
+               else if (wc < rsjistable[n].start) max = n;
+               else {
+                       wc -= rsjistable[n].start;
+                       wc += rsjistable[n].cnv;
X                       break;
-       if (i < RSJISTBLSIZ) {
-               wc -= rsjistable[i].start;
-               wc += rsjistable[i].cnv;
+               }
X       }
X 
X       return(wc);
@@ -959,12 +982,12 @@
X int encode;
X {
X       u_char *cp, buf[4];
-       u_int r, w, min, max, ofs;
+       u_int r, w, ofs, min, max;
X       int fd;
X 
X       wc &= 0xffff;
X       if (encode < 0) {
-               openunitbl(NULL);
+               VOID_C openunitbl(NULL);
X               return(0);
X       }
X 
@@ -1009,7 +1032,7 @@
X       ofs = min = max = 0;
X       if ((fd = openunitbl(UNICODETBL)) < 0) ofs = unitblent;
X       else if (encode) {
-               if (Xlseek(fd, (off_t)2, L_SET) < (off_t)0) ofs = unitblent;
+               if (lseek(fd, (off_t)2, L_SET) < (off_t)0) ofs = unitblent;
X               else for (ofs = 0; ofs < unitblent; ofs++) {
X                       if (read(fd, cp, 4) != 4) {
X                               ofs = unitblent;
@@ -1022,25 +1045,17 @@
X       else {
X               min = 0;
X               max = unitblent + 1;
-               ofs = unitblent / 2 + 1;
X               for (;;) {
-                       if (ofs == min || ofs == max) break;
-                       if (Xlseek(fd, (off_t)(ofs - 1) * 4 + 2, L_SET)
-                       < (off_t)0
-                       || read(fd, cp, 4) != 4) {
+                       ofs = (min + max) / 2;
+                       if (ofs <= min || ofs >= max) break;
+                       if (!skread(fd, (off_t)(ofs - 1) * 4 + 2, cp, 4)) {
X                               ofs = min = max = 0;
X                               break;
X                       }
X                       w = getword(cp, 0);
-                       if (wc == w) break;
-                       else if (wc < w) {
-                               max = ofs;
-                               ofs = (ofs + min) / 2;
-                       }
-                       else {
-                               min = ofs;
-                               ofs = (ofs + max) / 2;
-                       }
+                       if (wc > w) min = ofs;
+                       else if (wc < w) max = ofs;
+                       else break;
X               }
X       }
X 
@@ -1057,11 +1072,11 @@
X 
X #ifdef        USELLSEEK
X static _syscall5(int, _llseek,
-       unsigned int, fd,
-       unsigned long, ofs_h,
-       unsigned long, ofs_l,
+       u_int, fd,
+       u_long, ofs_h,
+       u_long, ofs_l,
X       l_off_t *, result,
-       unsigned int, whence);
+       u_int, whence);
X 
X static l_off_t NEAR Xllseek(fd, offset, whence)
X int fd;
@@ -2189,7 +2204,7 @@
X                       devp -> flags |= F_RONLY;
X               }
X # if  defined (LINUX) && defined (BLKFLSBUF)
-               ioctl(fd, BLKFLSBUF, 0);
+               VOID_C ioctl(fd, BLKFLSBUF, 0);
X # endif
X 
X               cc = 0;
@@ -2211,8 +2226,17 @@
X                               i = SLISTSIZ;
X                               break;
X                       }
-                       while ((cc = read(fd, buf, sectsizelist[i])) < 0
-                       && errno == EINTR);
+                       while ((cc = read(fd, buf, sectsizelist[i])) < 0) {
+# ifdef        FD
+                               if (intrkey()) {
+                                       close(fd);
+                                       doserrno = EINTR;
+                                       errno = duperrno;
+                                       return(-1);
+                               }
+# endif
+                               if (errno != EINTR) break;
+                       }
X                       if (cc >= 0) break;
X               }
X               if (i >= SLISTSIZ) {
@@ -3184,13 +3208,7 @@
X               return(NULL);
X       }
X 
-       if (resolved) {
-               resolved[0] = drive;
-               resolved[1] = ':';
-               resolved[2] = _SC_;
-               resolved[3] = '\0';
-               rlen = 3;
-       }
+       if (resolved) rlen = gendospath(resolved, drive, _SC_) - resolved;
X 
X       if (cp && (len = strlen(cp)) > 0) {
X               if (isdelim(cp, len - 1)) len--;
@@ -3598,10 +3616,7 @@
X               errno = ERANGE;
X               return(NULL);
X       }
-       pathname[0] = lastdrive;
-       pathname[1] = ':';
-       pathname[2] = _SC_;
-       strcpy(&(pathname[3]), cp);
+       strcpy(gendospath(pathname, lastdrive, _SC_), cp);
X 
X       return(pathname);
X }
@@ -3752,10 +3767,11 @@
X       u_int c;
X       int i, j, n, len, cnt, sum, ret, lfn;
X 
-       if ((i = parsepath(&(buf[2]), path, 1)) < 0) return(-1);
-       buf[0] = i;
+       if ((n = parsepath(&(buf[2]), path, 1)) < 0) return(-1);
+       buf[0] = n;
X       buf[1] = ':';
X       file = buf;
+
X       if (!(xdirp = splitpath(&file, NULL, 0))) {
X               if (doserrno == ENOENT) doserrno = ENOTDIR;
X               return(-1);
diff -urNP ../FD-2.08d/expfunc.c ./expfunc.c
--- ../FD-2.08d/expfunc.c       Tue Jun 13 00:00:00 2006
+++ ./expfunc.c Fri Jul 28 00:00:00 2006
@@ -4,11 +4,11 @@
X  *    function expander for the obsolete /bin/sh
X  */
X 
+#include "machine.h"
X #include <stdio.h>
X #include <string.h>
X #include <ctype.h>
X #include <sys/types.h>
-#include "machine.h"
X 
X #ifndef       NOUNISTDH
X #include <unistd.h>
@@ -24,16 +24,17 @@
X 
X extern VOID exit __P_((int));
X 
-static char *skipspace __P_((char *));
-static char *strndup2 __P_((char *, int));
-static char *isfunction __P_((char *));
-static int entryfunc __P_((char *));
-static char *checkhere __P_((char *));
-static int getargs __P_((char **, char *[]));
-static char *expargs __P_((char *, char *[]));
-static int searchfunc __P_((char *));
-static int evalline __P_((char *, char *[]));
-static char *getline __P_((FILE *));
+static char *NEAR skipspace __P_((char *));
+static char *NEAR strndup2 __P_((char *, int));
+static char *NEAR isfunction __P_((char *));
+static int NEAR entryfunc __P_((char *));
+static char *NEAR checkhere __P_((char *));
+static int NEAR getargs __P_((char **, char *[]));
+static char *NEAR expargs __P_((char *, char *[]));
+static int NEAR searchfunc __P_((char *));
+static int NEAR evalline __P_((char *, char *[]));
+static char *NEAR getline __P_((FILE *));
+int main __P_((int, char *[]));
X 
X static int funcno = 0;
X static char *func[MAXFUNCNO];
@@ -41,7 +42,7 @@
X static char *funcbody[MAXFUNCNO];
X 
X 
-static char *skipspace(s)
+static char *NEAR skipspace(s)
X char *s;
X {
X       while (*s == ' ' || *s == '\t') s++;
@@ -49,7 +50,7 @@
X       return(s);
X }
X 
-char *strndup2(s, n)
+static char *NEAR strndup2(s, n)
X char *s;
X int n;
X {
@@ -63,7 +64,7 @@
X       return(tmp);
X }
X 
-static char *isfunction(line)
+static char *NEAR isfunction(line)
X char *line;
X {
X       char *cp;
@@ -92,7 +93,7 @@
X       return(++cp);
X }
X 
-static int entryfunc(line)
+static int NEAR entryfunc(line)
X char *line;
X {
X       char *cp;
@@ -136,7 +137,7 @@
X       return(i);
X }
X 
-static char *checkhere(line)
+static char *NEAR checkhere(line)
X char *line;
X {
X       char *cp;
@@ -160,9 +161,8 @@
X       return(strndup2(cp, len));
X }
X 
-static int getargs(linep, args)
-char **linep;
-char *args[];
+static int NEAR getargs(linep, args)
+char **linep, *args[];
X {
X       char *cp, *new, *line, *buf;
X       int i, n, len, quote, size;
@@ -254,9 +254,8 @@
X       return(i);
X }
X 
-static char *expargs(line, args)
-char *line;
-char *args[];
+static char *NEAR expargs(line, args)
+char *line, *args[];
X {
X       char *cp, *buf, *tmp, *top;
X       int i, len, alen, vlen, rlen, quote;
@@ -304,7 +303,7 @@
X       return(buf);
X }
X 
-static int searchfunc(s)
+static int NEAR searchfunc(s)
X char *s;
X {
X       int i, len;
@@ -318,9 +317,8 @@
X       return(-1);
X }
X 
-static int evalline(line, args)
-char *line;
-char *args[];
+static int NEAR evalline(line, args)
+char *line, *args[];
X {
X       char *cp, *newargs[MAXARGS];
X       int i, quote;
@@ -352,7 +350,7 @@
X       return(i);
X }
X 
-static char *getline(fp)
+static char *NEAR getline(fp)
X FILE *fp;
X {
X       static char buf[MAXLINEBUF + 1];
diff -urNP ../FD-2.08d/fd.cat ./fd.cat
--- ../FD-2.08d/fd.cat  Tue Jun 13 00:00:00 2006
+++ ./fd.cat    Fri Jul 28 00:00:00 2006
@@ -726,7 +726,7 @@
X      コマンドリストの中では、改行文字は ;^H; と同じ意味を持ちます。
X 
X      また、コマンドリスト中の各々のコマンドは、以下のリダイレクト
-     記述子により入出力を切替えることが出来ます。リダイレクト記述
+     記述子により入出力を切替えることができます。リダイレクト記述
X      子は、コマンド文字列の中のどの位置にあっても構いません。
X         _^Hn<^H<_^Hf_^Hi_^Hl_^He    ファイルディスクリプタ _^Hn で表される入力をファイ
X                   ル _^Hf_^Hi_^Hl_^He からの入力に切替えます。_^Hn を省略すると、
@@ -2431,8 +2431,8 @@
X                        5^H5    紫
X                        6^H6    水色
X                        7^H7    白
-                       8^H8    文字の基本色
-                       9^H9    背景の基本色
+                       8^H8    文字の既定色
+                       9^H9    背景の既定色
X 
X                    色番号 8^H8 は変数 A^HAN^HNS^HSI^HIC^HCO^HOL^HLO^HOR^HR の値が 3^H3 の時に強制
X                    的に黒色になります。色番号 9^H9 は変数 A^HAN^HNS^HSI^HIC^HCO^HOL^HLO^HOR^HR
@@ -2454,7 +2454,7 @@
X                    応じてその値を自動的に置換えます。何も値が設定
X                    されていない場合は設定されないままです。
X 
-     C^HCO^HOM^HMS^HSP^HPE^HEC^HC*      バッチファイルを起動する場合に用いるシェルを指
+     C^HCO^HOM^HMS^HSP^HPE^HEC^HC       バッチファイルを起動する場合に用いるシェルを指
X                    定します。未指定時には環境変数 S^HSH^HHE^HEL^HLL^HL で定義さ
X                    れたシェルもしくは \COMMAND.COM が用いられます。
X                    (^H(D^HDO^HOS^HS)^H)
@@ -2484,7 +2484,7 @@
X                        H^HHE^HEX^HX, h^Hhe^Hex^Hx       HEX
X                        C^HCA^HAP^HP, c^Hca^Hap^Hp       CAP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
X                        デフォルト     変換しない
X 
X      D^HDI^HIR^HRC^HCO^HOU^HUN^HNT^HTL^HLI^HIM^HMI^HIT^HT ツリー表示モードで、ディレクトリ内のファイルを
@@ -2591,7 +2591,7 @@
X                        H^HHE^HEX^HX, h^Hhe^Hex^Hx       HEX
X                        C^HCA^HAP^HP, c^Hca^Hap^Hp       CAP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
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 で参照できるコマン
@@ -2636,7 +2636,7 @@
X                        S^HSJ^HJI^HIS^HS, s^Hsj^Hji^His^Hs     Shift JIS
X                        E^HEU^HUC^HC, e^Heu^Huc^Hc       EUC 漢字
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
X 
X      L^HLA^HAN^HNG^HGU^HUA^HAG^HGE^HE      表示する文字の言語を指定します。f^Hfd^Hd の出力する
X                    各種メッセージの他、漢字を含むファイル名に対す
@@ -2654,7 +2654,7 @@
X                        O^HOJ^HJI^HIS^HS8^H8, o^Hoj^Hji^His^Hs8^H8   8bit JIS (JIS C6226-1978 + roman)
X                        O^HOJ^HJU^HUN^HNE^HET^HT, o^Hoj^Hju^Hun^Hne^Het^Ht ISO-2022-JP (JIS C6226-1978 + roman)
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
X                        E^HEN^HNG^HG, e^Hen^Hng^Hg, C^HC    英語 (メッセージのみ)
X                        デフォルト     変換しない
X 
@@ -2792,7 +2792,7 @@
X                        S^HSJ^HJI^HIS^HS, s^Hsj^Hji^His^Hs     Shift JIS
X                        E^HEU^HUC^HC, e^Heu^Huc^Hc       EUC 漢字
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
X                        デフォルト     変換しない
X 
X      P^HPT^HTY^HYM^HME^HEN^HNU^HUK^HKE^HEY^HY    疑似端末を操作している最中に疑似端末メニューを
@@ -2811,7 +2811,7 @@
X      P^HPT^HTY^HYM^HMO^HOD^HDE^HE       外部コマンドの起動に疑似端末を用います。ウィン
X                    ドウ分割モードでは各ウィンドウ毎に独立した疑似
X                    端末を用いますので、同時に複数の外部コマンドを
-                   端末から操作することが出来ます。但し、使用して
+                   端末から操作することができます。但し、使用して
X                    いる端末が端末エミュレーションに必要な機能を備
X                    えていない場合は疑似端末が正しく機能しないこと
X                    があります。0^H0 かナル以外の値であれば、何を定義
@@ -2828,7 +2828,7 @@
X                        S^HSJ^HJI^HIS^HS, s^Hsj^Hji^His^Hs     Shift JIS
X                        E^HEU^HUC^HC, e^Heu^Huc^Hc       EUC 漢字
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  Mac OS X 用 UTF-8
X                        デフォルト     変換しない
X 
X      P^HPT^HTY^HYT^HTE^HER^HRM^HM       疑似端末を用いた場合に外部コマンドに渡す環境変
@@ -2885,7 +2885,7 @@
X                    で、その間は実時間とのずれが生じています。0^H0 か
X                    ナル以外の値であれば、何を定義しても有効です。
X 
-     S^HSH^HHE^HEL^HLL^HL*        ここで指定された値のファイル名部分が r^Hrf^Hfd^Hd また
+     S^HSH^HHE^HEL^HLL^HL         ここで指定された値のファイル名部分が r^Hrf^Hfd^Hd また
X                    は r^Hrf^Hfd^Hds^Hsh^Hh である場合には、起動時の -^H-r^Hr オプショ
X                    ンと同様、シェルの機能が一部制限されます。また、
X                    E^HEX^HXE^HEC^HCU^HUT^HTE^HE_S^HSH^HH コマンドから起動できるシェルを指定
diff -urNP ../FD-2.08d/fd.h ./fd.h
--- ../FD-2.08d/fd.h    Tue Jun 13 00:00:00 2006
+++ ./fd.h      Fri Jul 28 00:00:00 2006
@@ -414,6 +414,11 @@
X #define       _USEDOSPATH
X #endif
X 
+#if    !defined (_NOKANJICONV) && !defined (_NOUNICODE) \
+|| !defined (_NODOSDRIVE)
+#define        _USEUNICODE
+#endif
+
X #if   MSDOS
X #define       _USEDOSCOPY
X #endif
diff -urNP ../FD-2.08d/fd.man ./fd.man
--- ../FD-2.08d/fd.man  Tue Jun 13 00:00:00 2006
+++ ./fd.man    Fri Jul 28 00:00:00 2006
@@ -2,9 +2,9 @@
X .\" Copyright (C) 1995-2006 Takashi SHIRAI
X .\"                    <shirai@unixusers.net>
X .\"
-.\" @(#)fd.1   2.08d 06/13/06
+.\" @(#)fd.1   2.08e 07/28/06
X .\"   fd - File & Directory maintenance tool
-.TH FD 1 "June 13, 2006"
+.TH FD 1 "July 28, 2006"
X .de sh
X .br
X .PP
@@ -957,7 +957,7 @@
X 
X また、
X コマンドリスト中の各々のコマンドは、
-以下のリダイレクト記述子により入出力を切替えることが出来ます。
+以下のリダイレクト記述子により入出力を切替えることができます。
X リダイレクト記述子は、
X コマンド文字列の中のどの位置にあっても構いません。
X .RS 3
@@ -4062,8 +4062,8 @@
X \fB5\fP       紫
X \fB6\fP       水色
X \fB7\fP       白
-\fB8\fP        文字の基本色
-\fB9\fP        背景の基本色
+\fB8\fP        文字の既定色
+\fB9\fP        背景の既定色
X .fi
X .RE
X 
@@ -4108,7 +4108,7 @@
X 何らかの値が設定されていた場合、
X 画面サイズの変更に応じてその値を自動的に置換えます。
X 何も値が設定されていない場合は設定されないままです。
-.IP "\fBCOMSPEC\fP\(**"
+.IP "\fBCOMSPEC\fP"
X バッチファイルを起動する場合に用いるシェルを指定します。
X 未指定時には環境変数
X .B " SHELL"
@@ -4161,7 +4161,7 @@
X \fBHEX\fP, \fBhex\fP  HEX
X \fBCAP\fP, \fBcap\fP  CAP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
+\fBUTF8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
X デフォルト 変換しない
X .fi
X .RE
@@ -4320,7 +4320,7 @@
X \fBHEX\fP, \fBhex\fP  HEX
X \fBCAP\fP, \fBcap\fP  CAP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
+\fBUTF8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
X デフォルト 変換しない
X .fi
X .RE
@@ -4387,7 +4387,7 @@
X \fBSJIS\fP, \fBsjis\fP        Shift JIS
X \fBEUC\fP, \fBeuc\fP  EUC 漢字
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
+\fBUTF8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
X .fi
X .RE
X .IP "\fBLANGUAGE\fP"
@@ -4416,7 +4416,7 @@
X \fBOJIS8\fP, \fBojis8\fP      8bit JIS (JIS C6226-1978 + roman)
X \fBOJUNET\fP, \fBojunet\fP    ISO-2022-JP (JIS C6226-1978 + roman)
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
+\fBUTF8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
X \fBENG\fP, \fBeng\fP, \fBC\fP 英語 (メッセージのみ)
X デフォルト 変換しない
X .fi
@@ -4610,7 +4610,7 @@
X \fBSJIS\fP, \fBsjis\fP        Shift JIS
X \fBEUC\fP, \fBeuc\fP  EUC 漢字
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
+\fBUTF8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
X デフォルト 変換しない
X .fi
X .RE
@@ -4636,7 +4636,7 @@
X .IP "\fBPTYMODE\fP"
X 外部コマンドの起動に疑似端末を用います。
X ウィンドウ分割モードでは各ウィンドウ毎に独立した疑似端末を用いますので、
-同時に複数の外部コマンドを端末から操作することが出来ます。
+同時に複数の外部コマンドを端末から操作することができます。
X 但し、
X 使用している端末が端末エミュレーションに必要な機能を備えていない場合は疑似端末が正しく機能しないことがあります。
X .B 0
@@ -4659,7 +4659,7 @@
X \fBSJIS\fP, \fBsjis\fP        Shift JIS
X \fBEUC\fP, \fBeuc\fP  EUC 漢字
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
+\fBUTF8-mac\fP, \fBmac\fP      Mac OS X 用 UTF-8
X デフォルト 変換しない
X .fi
X .RE
@@ -4738,7 +4738,7 @@
X その間は実時間とのずれが生じています。
X .B 0
X かナル以外の値であれば、何を定義しても有効です。
-.IP "\fBSHELL\fP\(**"
+.IP "\fBSHELL\fP"
X ここで指定された値のファイル名部分が
X .B " rfd"
X または
diff -urNP ../FD-2.08d/fd_e.cat ./fd_e.cat
--- ../FD-2.08d/fd_e.cat        Tue Jun 13 00:00:00 2006
+++ ./fd_e.cat  Fri Jul 28 00:00:00 2006
@@ -11,13 +11,13 @@
X      f^Hfd^Hds^Hsh^Hh [ -^H-a^Hab^HbC^HCc^Hce^Hef^Hfh^Hhi^Hik^Hkl^Hlm^HmN^HNn^HnP^HPr^HrS^HSs^HsT^HTt^Htu^Huv^Hvx^Hx ] [ _^Ha_^Hr_^Hg_^Hs ]
X 
X D^HDE^HES^HSC^HCR^HRI^HIP^HPT^HTI^HIO^HON^HN
-     f^Hfd^Hd is a file & directory maintenance tool considered for the
+     F^HFd^Hd is a file & directory maintenance tool considered for the
X      text terminals on general UNIX.  It aims for a clone of the
X      same named utility which is made for the PC/AT compatible
X      machine and PC-9800 series.  In fact, it is upper compatible
X      functionally.
X 
-     f^Hfd^Hd shows the browser screen listing files when you have
+     F^HFd^Hd shows the browser screen listing files when you have
X      invoked it.  You can input some key which is bound each com-
X      mand, to execute various operations.
X 
@@ -78,7 +78,7 @@
X      of s^Hse^Het^Ht the builtin command are available.
X 
X      S^HSc^Hcr^Hre^Hee^Hen^Hn L^HLa^Hay^Hyo^Hou^Hut^Ht
-     f^Hfd^Hd has the 3 major screen modes.  In the browser screen, you
+     F^HFd^Hd has the 3 major screen modes.  In the browser screen, you
X      can select from the file list and execute each command.  In
X      the archive browser screen, files in the archive file are
X      listed separately by directory, and you can browse as well
@@ -439,7 +439,7 @@
X              the attribute on the position.  You should notice
X              that the attribute of the execution bit is not a
X              binary toggle but a triple toggle, which includes
-             setuid bit, setgid bit, and sticky bit respectively.
+             setuid bit, setgid bit and sticky bit respectively.
X              If the target is the marked files, [m^Hm](Mask) will
X              mask a bit on the cursor position with '*^H*', to keep
X              the value of the original file attribute.  When you
@@ -546,12 +546,11 @@
X         B^HBa^Hac^Hck^Hku^Hup^Hp t^Hta^Hap^Hpe^He (Backup)
X              Backup the file on the cursor position into the
X              specified storage device.  When the cursor position
-             indicates a directory, all of its contents are
-             backuped.  When some files are marked, the target is
-             not the file on the cursor position but the marked
-             files.
+             indicates a directory, all of its contents is back-
+             uped.  When some files are marked, the target is not
+             the file on the cursor position but the marked files.
X 
-             t^Hta^Har^Hr(1) is used for backup.  When you specify the
+             T^HTa^Har^Hr(1) is used for backup.  When you specify the
X              filename except special files indicates devices as
X              input of the device name, the archive file is
X              created with that filename.
@@ -565,7 +564,7 @@
X         P^HPa^Hac^Hck^Hk f^Hfi^Hil^Hle^He (Pack)
X              Pack the file on the cursor position into the speci-
X              fied archive file.  When the cursor position indi-
-             cates a directory, all of its contents are packed
+             cates a directory, all of its contents is packed
X              into the archive file.  When some files are marked,
X              the target is not the file on the cursor position
X              but the marked files.
@@ -868,7 +867,7 @@
X      can split a long line with this.
X 
X      B^HBu^Hui^Hil^Hlt^Hti^Hin^Hn C^HCo^Hom^Hmm^Hma^Han^Hnd^Hds^Hs
-     f^Hfd^Hd has the following builtin commands.  These builtin com-
+     F^HFd^Hd has the following builtin commands.  These builtin com-
X      mands can be used in E^HEX^HXE^HEC^HCU^HUT^HTE^HE_S^HSH^HH and the initial configura-
X      tion file.
X 
@@ -962,7 +961,7 @@
X                    redirection.
X 
X      .^H. _^Hf_^Hi_^Hl_^He
-     s^Hso^Hou^Hur^Hrc^Hce^He _^Hf_^Hi_^Hl_^He   Read and evaluate commands from _^Hf_^Hi_^Hl_^He.  _^Hf_^Hi_^Hl_^He
+     s^Hso^Hou^Hur^Hrc^Hce^He _^Hf_^Hi_^Hl_^He   Read and evaluate commands from _^Hf_^Hi_^Hl_^He.  _^HF_^Hi_^Hl_^He
X                    must exists on the directory which P^HPA^HAT^HTH^HH
X                    includes, or be described with pathname.  The
X                    each line format is based on the format of
@@ -1238,7 +1237,7 @@
X                    COMMAND.COM.)
X 
X      d^Hdi^Hir^Hrs^Hs          Display the list of the current directory
-                   stack.  p^Hpu^Hus^Hsh^Hhd^Hd and p^Hpo^Hop^Hpd^Hd the builtin command can
+                   stack.  P^HPu^Hus^Hsh^Hhd^Hd and p^Hpo^Hop^Hpd^Hd the builtin command can
X                    load/unload directories onto the directory
X                    stack.
X 
@@ -1264,7 +1263,7 @@
X                    Enable _^Ha_^Hr_^Hg as a builtin command.  When you
X                    specify -^H-n^Hn, it is disabled.  If _^Ha_^Hr_^Hg is omit-
X                    ted, all of the enabled or disabled builtin
-                   commands are listed.
+                   commands is listed.
X 
X      e^Hev^Hva^Hal^Hl [_^Ha_^Hr_^Hg ...]
X                    Evaluate _^Ha_^Hr_^Hg and execute the results.
@@ -1300,14 +1299,14 @@
X                    the value of _^HN_^HA_^HM_^HE the environment variable is
X                    defined as a null.  If no argument is speci-
X                    fied, all of the e^Hex^Hxp^Hpo^Hor^Hrt^Hted environment vari-
-                   ables are listed.  When you want to delete the
+                   ables is listed.  When you want to delete the
X                    definition of the environment variable, you
X                    can use u^Hun^Hns^Hse^Het^Ht the builtin command.
X 
X      f^Hfa^Hal^Hls^Hse^He         Only return with a 1^H1 exit status.
X 
X      f^Hfc^Hc [-^H-l^Hl | -^H-s^Hs [_^Ho_^Hl_^Hd=^H=_^Hn_^He_^Hw ...]] [-^H-n^Hnr^Hr ] [-^H-e^He _^He_^Hd_^Hi_^Ht_^Ho_^Hr] [_^Hf_^Hi_^Hr_^Hs_^Ht [_^Hl_^Ha_^Hs_^Ht]]
-                   List or edit command histories.  _^Hf_^Hi_^Hr_^Hs_^Ht and
+                   List or edit command histories.  _^HF_^Hi_^Hr_^Hs_^Ht and
X                    _^Hl_^Ha_^Hs_^Ht select the range of command histories.
X                    This specification can be described as a
X                    numeric value or a string.  A positive value
@@ -1432,7 +1431,7 @@
X                    result in the hash table.
X 
X                    When you specify -^H-r^Hr instead of _^Hc_^Ho_^Hm, all the
-                   memorized hash table are discarded.  If _^Hc_^Ho_^Hm is
+                   memorized hash table is discarded.  If _^Hc_^Ho_^Hm is
X                    omitted, the hash table information is listed.
X                    h^Hhi^Hit^Hts^Hs, c^Hco^Hos^Hst^Ht, c^Hco^Hom^Hmm^Hma^Han^Hnd^Hd indicate the number of
X                    times the command has been executed, the meas-
@@ -1449,7 +1448,7 @@
X                    history number.
X 
X                    If _^Hn is omitted, all of the memorized command
-                   histories are listed.
+                   histories is listed.
X 
X      j^Hjo^Hob^Hbs^Hs          List the running jobs.  (^H(U^HUN^HNI^HIX^HX)^H)
X 
@@ -1494,14 +1493,14 @@
X 
X                    If _^Hs_^Ht_^Hr is omitted, the key code sequence for _^Hc
X                    is displayed.  If both _^Hs_^Ht_^Hr and _^Hc are omitted,
-                   all of the mappings for special keys are
-                   listed.  When you specify _^Hs_^Ht_^Hr as "^H""^H", the key
-                   code mapping for _^Hc is canceled.
+                   all of the mappings for special keys is listed.
+                   When you specify _^Hs_^Ht_^Hr as "^H""^H", the key code map-
+                   ping for _^Hc is canceled.
X 
X      k^Hki^Hil^Hll^Hl [-^H-l^Hl | -^H-_^Hs_^Hi_^Hg_^Hn_^Ha_^Hl] [_^Hp_^Hi_^Hd | _^Hj_^Ho_^Hb ...]
X                    Send the signal indicated by _^Hs_^Hi_^Hg_^Hn_^Ha_^Hl to the
X                    process indicated by the process number _^Hp_^Hi_^Hd or
-                   to the job indicated by _^Hj_^Ho_^Hb.  _^Hs_^Hi_^Hg_^Hn_^Ha_^Hl is
+                   to the job indicated by _^Hj_^Ho_^Hb.  _^HS_^Hi_^Hg_^Hn_^Ha_^Hl is
X                    described as a numeric value or a signal name.
X 
X                    If _^Hs_^Hi_^Hg_^Hn_^Ha_^Hl is omitted, S^HSI^HIG^HGT^HTE^HER^HRM^HM is send.  When
@@ -1574,13 +1573,13 @@
X                    archive file which has _^He_^Hx_^Ht the extension.
X 
X                    If _^He_^Hx_^Ht is omitted, all of the registered
-                   archiver commands are listed.
+                   archiver commands is listed.
X 
X      p^Hpr^Hri^Hin^Hnt^Htb^Hbi^Hin^Hnd^Hd [_^Hc] Print the command binded to the key _^Hc.  You
X                    can specify the key as well as b^Hbi^Hin^Hnd^Hd.
X 
X                    If _^Hc is omitted, all of the registered key
-                   bindings are listed, which is defined not as
+                   bindings is listed, which is defined not as
X                    the internal command but as the command macro.
X                    The key bindings of internal commands can be
X                    referred in H^HHE^HEL^HLP^HP_M^HME^HES^HSS^HSA^HAG^HGE^HE.
SHAR_EOF
  : || $echo 'restore of' 'FD-2.08e.patch' 'failed'
fi
$echo 'End of' 'FD-2.08e.patch' 'part' '2'
$echo 'File' 'FD-2.08e.patch' 'is continued in part' '3'
echo 3 > _sh01537/seq
exit 0
-- 
                                               しらい たかし