しらいです。

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

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

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is `FD-2.08e.shar.05' (part 5 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" != 5; 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 
X TITLE = FD-
X VERMAJ        = 2
-VERSION        = 2.08d
+VERSION        = 2.08e
X PREFIX        = 
X CONFDIR       = 
X BUILD =
X MANSEC        = 1
X TOPDIR        = $(BUILD)$(PREFIX)
X BINDIR        = $(TOPDIR)\bin
-DATADIR        = $(TOPDIR)\share
+DATADIR        = $(TOPDIR)\share\fd
X MANDIR        = $(TOPDIR)\man\man$(MANSEC)
X CATDIR        = $(TOPDIR)\man\cat$(MANSEC)
X JMANDIR       = $(TOPDIR)\man\man$(MANSEC)
@@ -109,7 +109,7 @@
X CFLAGS        = -DPC98=1 -O $(DEBUG)
X HOSTCFLAGS = -DPC98=1 -O
X SLDFLAGS =  -lintlib -ltinymain.obj $(ALLOC)
-FDCFLAGS = $(CFLAGS) $(CPPFLAGS) -ml -h -k"-s 3c00" -DFD=$(VERMAJ)
+FDCFLAGS = $(CFLAGS) $(CPPFLAGS) -ml -h -k"-s 3800" -DFD=$(VERMAJ)
X SHCFLAGS = $(CFLAGS) $(CPPFLAGS) -mp -h -k"-s 8000" -DFDSH=$(VERMAJ)
X BSHCFLAGS = $(CFLAGS) $(CPPFLAGS) -ms -k"-s 8000" -DFDSH=$(VERMAJ) -DMINIMUMSHELL
X DEFCFLAGS = -DDEFRC=\\\"$(DOSRC)\\\"
@@ -123,7 +123,7 @@
X all: $(PROGRAM).exe $(PROGRAM).$(MANSEC) $(UNITBL)
X 
X $(PROGRAM).exe: $(OBJ1) $(OBJ2) $(OBJ3) $(ARGS)
-       $(CC) -ml -h -k"-s 3c00" -o $@ @$(ARGS) $(LDFLAGS)
+       $(CC) -ml -h -k"-s 3800" -o $@ @$(ARGS) $(LDFLAGS)
X #     ren $@ $(PROGRAM)
X #     aout2exe $(PROGRAM)
X #     del $(PROGRAM)
@@ -233,6 +233,7 @@
X               $(CHMOD) a+r-x $(BLDRC); \
X       fi
X       -if [ -f $(UNITBL) ]; then \
+               [ -d $(BINDIR) ] || mkdir $(BINDIR); \
X               $(INSTALL) $(UNITBL) $(BINDIR); \
X               $(CHMOD) a+r-x $(BINDIR)\$(UNITBL); \
X       fi
@@ -298,7 +299,7 @@
X       makedepend \
X               -s "# DO NOT DELETE THIS LINE -- make depend depends on it." \
X               -f Makefile.tmp -- $(CFLAGS) -- $(SRC)
-       rm -f Makefile.tmp.bak
+       -$(RM) Makefile.tmp.bak
X       $(SED) -e '\^# DO NOT DELETE THIS LINE\,$$d' Makefile.in.bak \
X               > Makefile.in
X       $(ECHO) "# DO NOT DELETE THIS LINE -- make depend depends on it." \
@@ -308,7 +309,8 @@
X               -e 's\\.o\\_\_OBJ\_\_\g' \
X               -e 's\ *$$\\' \
X               -e '\: *$$\d' Makefile.tmp >> Makefile.in
-       rm -f Makefile.in.bak Makefile.tmp
+       -$(RM) Makefile.in.bak
+       -$(RM) Makefile.tmp
X 
X 
X ############################################################
@@ -408,11 +410,11 @@
X       gzip -f $(TITLE)sh-$$VER.tar)
X 
X lzh: $(SOURCES)
-       rm -f $(TITLE)$(VERSION).lzh
+       -$(RM) $(TITLE)$(VERSION).lzh
X       lha a $(TITLE)$(VERSION).lzh $(SOURCES)
X 
X shar: $(SOURCES)
-       rm -f $(TITLE)$(VERSION).shar.[0-9][0-9]
+       -$(RM) $(TITLE)$(VERSION).shar.[0-9][0-9]
X       shar -L50 -apc -n $(TITLE)$(VERSION) -o $(TITLE)$(VERSION).shar \
X       -T $(SRCS) -C $(JSRCS)
X 
@@ -505,17 +507,26 @@
X       tar cf ..\ipk.tar .\debian-binary .\data.tar.gz .\control.tar.gz)
X       gzip .\ipk.tar
X       mv .\ipk.tar.gz .\fd_$(VERSION)-1_arm.ipk
-       -rm -rf $(IPKWDIR) $(IPKTDIR)
+       -$(RM) -r $(IPKWDIR) $(IPKTDIR)
X 
X clean:
-       -rm -f core *.obj
-       -rm -f funcno.h kanji.h
-       -rm -f kanjicnv$(EXE) expfunc$(EXE)
-       -rm -f mkfuncno$(EXE) mkunitbl$(EXE)
-       -rm -f fdsh$(EXE) fdbsh$(EXE)
-       -rm -f $(PROGRAM)$(EXE) $(PROGRAM).$(MANSEC) $(PROGRAM).$(MANSEC)c
-       -rm -f $(PROGRAM).eng $(PROGRAM).doc
-       -rm -f $(ARGS) $(UNITBL)
+       -$(RM) core
+       -$(RM) *.obj
+       -$(RM) funcno.h
+       -$(RM) kanji.h
+       -$(RM) kanjicnv$(EXE)
+       -$(RM) expfunc$(EXE)
+       -$(RM) mkfuncno$(EXE)
+       -$(RM) mkunitbl$(EXE)
+       -$(RM) fdsh$(EXE)
+       -$(RM) fdbsh$(EXE)
+       -$(RM) $(PROGRAM)$(EXE)
+       -$(RM) $(PROGRAM).$(MANSEC)
+       -$(RM) $(PROGRAM).$(MANSEC)c
+       -$(RM) $(PROGRAM).eng
+       -$(RM) $(PROGRAM).doc
+       -$(RM) $(ARGS)
+       -$(RM) $(UNITBL)
X # DO NOT DELETE THIS LINE -- make depend depends on it.
X 
X main.obj: fd.h
@@ -529,24 +540,31 @@
X printf.obj: printf.h
X printf.obj: kctype.h
X termio.obj: machine.h config.h
-termio.obj: printf.h termio.h
+termio.obj: printf.h
+termio.obj: termio.h
X term.obj: machine.h config.h
-term.obj: printf.h
-term.obj: kctype.h
+term.obj: printf.h kctype.h
X term.obj: termio.h
X term.obj: term.h
X pathname.obj: machine.h config.h
-pathname.obj: printf.h kctype.h
+pathname.obj: printf.h
+pathname.obj: kctype.h
X pathname.obj: pathname.h
-system.obj: machine.h config.h printf.h kctype.h
+system.obj: machine.h config.h
+system.obj: printf.h
+system.obj: kctype.h
X system.obj: pathname.h
X system.obj: system.h termio.h
X system.obj: wait.h
-posixsh.obj: machine.h config.h printf.h kctype.h
+posixsh.obj: machine.h config.h
+posixsh.obj: printf.h
+posixsh.obj: kctype.h
X posixsh.obj: pathname.h
X posixsh.obj: system.h termio.h
X posixsh.obj: wait.h
-doscom.obj: machine.h config.h printf.h kctype.h
+doscom.obj: machine.h config.h
+doscom.obj: printf.h
+doscom.obj: kctype.h
X doscom.obj: pathname.h
X doscom.obj: system.h termio.h
X doscom.obj: wait.h
@@ -661,9 +679,9 @@
X shell.obj: dosdisk.h kanji.h system.h termio.h
X shell.obj: wait.h
X shell.obj: termemu.h
-kanji.obj: machine.h config.h
-kanji.obj: kctype.h pathname.h
-kanji.obj: term.h
+kanji.obj: machine.h
+kanji.obj: config.h
+kanji.obj: printf.h kctype.h
X input.obj: fd.h
X input.obj: machine.h config.h
X input.obj: types.h
diff -urNP ../FD-2.08d/makefile.lpc ./makefile.lpc
--- ../FD-2.08d/makefile.lpc    Tue Jun 13 00:00:00 2006
+++ ./makefile.lpc      Fri Jul 28 00:00:00 2006
@@ -4,14 +4,14 @@
X 
X TITLE = FD-
X VERMAJ        = 2
-VERSION        = 2.08d
+VERSION        = 2.08e
X PREFIX        = 
X CONFDIR       = 
X BUILD =
X MANSEC        = 1
X TOPDIR        = $(BUILD)$(PREFIX)
X BINDIR        = $(TOPDIR)\bin
-DATADIR        = $(TOPDIR)\share
+DATADIR        = $(TOPDIR)\share\fd
X MANDIR        = $(TOPDIR)\man\man$(MANSEC)
X CATDIR        = $(TOPDIR)\man\cat$(MANSEC)
X JMANDIR       = $(TOPDIR)\man\man$(MANSEC)
@@ -109,7 +109,7 @@
X CFLAGS        = -DDOSV=1 -O $(DEBUG)
X HOSTCFLAGS = -DDOSV=1 -O
X SLDFLAGS =  -lintlib -ltinymain.obj $(ALLOC)
-FDCFLAGS = $(CFLAGS) $(CPPFLAGS) -ml -h -k"-s 3c00" -DFD=$(VERMAJ)
+FDCFLAGS = $(CFLAGS) $(CPPFLAGS) -ml -h -k"-s 3800" -DFD=$(VERMAJ)
X SHCFLAGS = $(CFLAGS) $(CPPFLAGS) -mp -h -k"-s 8000" -DFDSH=$(VERMAJ)
X BSHCFLAGS = $(CFLAGS) $(CPPFLAGS) -ms -k"-s 8000" -DFDSH=$(VERMAJ) -DMINIMUMSHELL
X DEFCFLAGS = -DDEFRC=\\\"$(DOSRC)\\\"
@@ -123,7 +123,7 @@
X all: $(PROGRAM).exe $(PROGRAM).$(MANSEC) $(UNITBL)
X 
X $(PROGRAM).exe: $(OBJ1) $(OBJ2) $(OBJ3) $(ARGS)
-       $(CC) -ml -h -k"-s 3c00" -o $@ @$(ARGS) $(LDFLAGS)
+       $(CC) -ml -h -k"-s 3800" -o $@ @$(ARGS) $(LDFLAGS)
X #     ren $@ $(PROGRAM)
X #     aout2exe $(PROGRAM)
X #     del $(PROGRAM)
@@ -233,6 +233,7 @@
X               $(CHMOD) a+r-x $(BLDRC); \
X       fi
X       -if [ -f $(UNITBL) ]; then \
+               [ -d $(BINDIR) ] || mkdir $(BINDIR); \
X               $(INSTALL) $(UNITBL) $(BINDIR); \
X               $(CHMOD) a+r-x $(BINDIR)\$(UNITBL); \
X       fi
@@ -298,7 +299,7 @@
X       makedepend \
X               -s "# DO NOT DELETE THIS LINE -- make depend depends on it." \
X               -f Makefile.tmp -- $(CFLAGS) -- $(SRC)
-       rm -f Makefile.tmp.bak
+       -$(RM) Makefile.tmp.bak
X       $(SED) -e '\^# DO NOT DELETE THIS LINE\,$$d' Makefile.in.bak \
X               > Makefile.in
X       $(ECHO) "# DO NOT DELETE THIS LINE -- make depend depends on it." \
@@ -308,7 +309,8 @@
X               -e 's\\.o\\_\_OBJ\_\_\g' \
X               -e 's\ *$$\\' \
X               -e '\: *$$\d' Makefile.tmp >> Makefile.in
-       rm -f Makefile.in.bak Makefile.tmp
+       -$(RM) Makefile.in.bak
+       -$(RM) Makefile.tmp
X 
X 
X ############################################################
@@ -408,11 +410,11 @@
X       gzip -f $(TITLE)sh-$$VER.tar)
X 
X lzh: $(SOURCES)
-       rm -f $(TITLE)$(VERSION).lzh
+       -$(RM) $(TITLE)$(VERSION).lzh
X       lha a $(TITLE)$(VERSION).lzh $(SOURCES)
X 
X shar: $(SOURCES)
-       rm -f $(TITLE)$(VERSION).shar.[0-9][0-9]
+       -$(RM) $(TITLE)$(VERSION).shar.[0-9][0-9]
X       shar -L50 -apc -n $(TITLE)$(VERSION) -o $(TITLE)$(VERSION).shar \
X       -T $(SRCS) -C $(JSRCS)
X 
@@ -505,17 +507,26 @@
X       tar cf ..\ipk.tar .\debian-binary .\data.tar.gz .\control.tar.gz)
X       gzip .\ipk.tar
X       mv .\ipk.tar.gz .\fd_$(VERSION)-1_arm.ipk
-       -rm -rf $(IPKWDIR) $(IPKTDIR)
+       -$(RM) -r $(IPKWDIR) $(IPKTDIR)
X 
X clean:
-       -rm -f core *.obj
-       -rm -f funcno.h kanji.h
-       -rm -f kanjicnv$(EXE) expfunc$(EXE)
-       -rm -f mkfuncno$(EXE) mkunitbl$(EXE)
-       -rm -f fdsh$(EXE) fdbsh$(EXE)
-       -rm -f $(PROGRAM)$(EXE) $(PROGRAM).$(MANSEC) $(PROGRAM).$(MANSEC)c
-       -rm -f $(PROGRAM).eng $(PROGRAM).doc
-       -rm -f $(ARGS) $(UNITBL)
+       -$(RM) core
+       -$(RM) *.obj
+       -$(RM) funcno.h
+       -$(RM) kanji.h
+       -$(RM) kanjicnv$(EXE)
+       -$(RM) expfunc$(EXE)
+       -$(RM) mkfuncno$(EXE)
+       -$(RM) mkunitbl$(EXE)
+       -$(RM) fdsh$(EXE)
+       -$(RM) fdbsh$(EXE)
+       -$(RM) $(PROGRAM)$(EXE)
+       -$(RM) $(PROGRAM).$(MANSEC)
+       -$(RM) $(PROGRAM).$(MANSEC)c
+       -$(RM) $(PROGRAM).eng
+       -$(RM) $(PROGRAM).doc
+       -$(RM) $(ARGS)
+       -$(RM) $(UNITBL)
X # DO NOT DELETE THIS LINE -- make depend depends on it.
X 
X main.obj: fd.h
@@ -529,24 +540,31 @@
X printf.obj: printf.h
X printf.obj: kctype.h
X termio.obj: machine.h config.h
-termio.obj: printf.h termio.h
+termio.obj: printf.h
+termio.obj: termio.h
X term.obj: machine.h config.h
-term.obj: printf.h
-term.obj: kctype.h
+term.obj: printf.h kctype.h
X term.obj: termio.h
X term.obj: term.h
X pathname.obj: machine.h config.h
-pathname.obj: printf.h kctype.h
+pathname.obj: printf.h
+pathname.obj: kctype.h
X pathname.obj: pathname.h
-system.obj: machine.h config.h printf.h kctype.h
+system.obj: machine.h config.h
+system.obj: printf.h
+system.obj: kctype.h
X system.obj: pathname.h
X system.obj: system.h termio.h
X system.obj: wait.h
-posixsh.obj: machine.h config.h printf.h kctype.h
+posixsh.obj: machine.h config.h
+posixsh.obj: printf.h
+posixsh.obj: kctype.h
X posixsh.obj: pathname.h
X posixsh.obj: system.h termio.h
X posixsh.obj: wait.h
-doscom.obj: machine.h config.h printf.h kctype.h
+doscom.obj: machine.h config.h
+doscom.obj: printf.h
+doscom.obj: kctype.h
X doscom.obj: pathname.h
X doscom.obj: system.h termio.h
X doscom.obj: wait.h
@@ -661,9 +679,9 @@
X shell.obj: dosdisk.h kanji.h system.h termio.h
X shell.obj: wait.h
X shell.obj: termemu.h
-kanji.obj: machine.h config.h
-kanji.obj: kctype.h pathname.h
-kanji.obj: term.h
+kanji.obj: machine.h
+kanji.obj: config.h
+kanji.obj: printf.h kctype.h
X input.obj: fd.h
X input.obj: machine.h config.h
X input.obj: types.h
diff -urNP ../FD-2.08d/mkfuncno.c ./mkfuncno.c
--- ../FD-2.08d/mkfuncno.c      Tue Jun 13 00:00:00 2006
+++ ./mkfuncno.c        Fri Jul 28 00:00:00 2006
@@ -12,6 +12,8 @@
X #include "types.h"
X #include "functabl.h"
X 
+int main __P_((int, char *[]));
+
X 
X /*ARGSUSED*/
X int main(argc, argv)
@@ -23,14 +25,14 @@
X 
X       if (!strcmp(argv[1], "-")) fp = stdout;
X       else if (!(fp = fopen(argv[1], "w"))) {
-               fprintf(stderr, "Cannot open file.\n");
+               fprintf(stderr, "%s: Cannot open.\n", argv[1]);
X               return(1);
X       }
X 
X       fprintf(fp, "/*\n");
X       fprintf(fp, " *\t%s\n", (fp != stdout) ? argv[1] : "STDOUT");
X       fprintf(fp, " *\n");
-       fprintf(fp, " *\tFunction No. Table\n");
+       fprintf(fp, " *\tfunction No. table\n");
X       fprintf(fp, " */\n");
X       fprintf(fp, "\n");
X 
diff -urNP ../FD-2.08d/mkmfdosb.sed ./mkmfdosb.sed
--- ../FD-2.08d/mkmfdosb.sed    Tue Jun 13 00:00:00 2006
+++ ./mkmfdosb.sed      Fri Jul 28 00:00:00 2006
@@ -3,10 +3,10 @@
X s:__CONFDIR__::
X s:__EXE__:.exe:g
X s:__OBJ__:.obj:g
-s:__OBJS__:unixemu.obj unixdisk.obj:
+s:__EMUOBJS__:unixemu.obj unixdisk.obj:
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:\\"$(DOSRC)\\":
-s:__UNITBLPATH__::
+s:__TBLPATH__::
X s:__DATADIR__:$(BINDIR):g
X s:    __RENAME__:#    ren:
X s:    __AOUT2EXE__:#  aout2exe:
diff -urNP ../FD-2.08d/mkmfdosd.sed ./mkmfdosd.sed
--- ../FD-2.08d/mkmfdosd.sed    Tue Jun 13 00:00:00 2006
+++ ./mkmfdosd.sed      Fri Jul 28 00:00:00 2006
@@ -3,10 +3,10 @@
X s:__CONFDIR__::
X s:__EXE__:.exe:g
X s:__OBJ__:.o:g
-s:__OBJS__:unixemu.o unixdisk.o:
+s:__EMUOBJS__:unixemu.o unixdisk.o:
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:'"'$(DOSRC)'"':
-s:__UNITBLPATH__::
+s:__TBLPATH__::
X s:__DATADIR__:$(BINDIR):g
X s:    __RENAME__:#    @ren:
X s:    __AOUT2EXE__:#  @aout2exe:
diff -urNP ../FD-2.08d/mkmfdosg.sed ./mkmfdosg.sed
--- ../FD-2.08d/mkmfdosg.sed    Tue Jun 13 00:00:00 2006
+++ ./mkmfdosg.sed      Fri Jul 28 00:00:00 2006
@@ -3,10 +3,10 @@
X s:__CONFDIR__::
X s:__EXE__:.exe:g
X s:__OBJ__:.o:g
-s:__OBJS__:unixemu.o unixdisk.o:
+s:__EMUOBJS__:unixemu.o unixdisk.o:
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:'"'$(DOSRC)'"':
-s:__UNITBLPATH__::
+s:__TBLPATH__::
X s:__DATADIR__:$(BINDIR):g
X s:__RENAME__:@ren:
X s:__AOUT2EXE__:@aout2exe:
diff -urNP ../FD-2.08d/mkmfdosl.sed ./mkmfdosl.sed
--- ../FD-2.08d/mkmfdosl.sed    Tue Jun 13 00:00:00 2006
+++ ./mkmfdosl.sed      Fri Jul 28 00:00:00 2006
@@ -3,10 +3,10 @@
X s:__CONFDIR__::
X s:__EXE__:.exe:g
X s:__OBJ__:.obj:g
-s:__OBJS__:unixemu.obj unixdisk.obj:
+s:__EMUOBJS__:unixemu.obj unixdisk.obj:
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:\\\\\\"$(DOSRC)\\\\\\":
-s:__UNITBLPATH__::
+s:__TBLPATH__::
X s:__DATADIR__:$(BINDIR):g
X s:    __RENAME__:#    ren:
X s:    __AOUT2EXE__:#  aout2exe:
@@ -23,7 +23,7 @@
X s:__HOSTCC__:$(CC):
X s:__HOSTCCOPTIONS__:-O:
X s:__FDSETSIZE__::
-s:__MEM__:-ml -h -k"-s 3c00":
+s:__MEM__:-ml -h -k"-s 3800":
X s:__SHMEM__:-mp -h -k"-s 8000":
X s:__BSHMEM__:-ms -k"-s 8000":
X s:__OUT__:-o $@:
diff -urNP ../FD-2.08d/mkmfsed.c ./mkmfsed.c
--- ../FD-2.08d/mkmfsed.c       Tue Jun 13 00:00:00 2006
+++ ./mkmfsed.c Fri Jul 28 00:00:00 2006
@@ -46,6 +46,8 @@
X #define       CCCOMMAND       "cc"
X #endif
X 
+int main __P_((int, char *[]));
+
X 
X /*ARGSUSED*/
X int main(argc, argv)
@@ -75,15 +77,15 @@
X       printf("s:__EXE__::g\n");
X #endif
X       printf("s:__OBJ__:.o:g\n");
-       printf("s:__OBJS__:dosemu.o:\n");
+       printf("s:__EMUOBJS__:dosemu.o:\n");
X       printf("s:__OBJLIST__:$(OBJ1) $(OBJ2) $(OBJ3):\n");
X       printf("s:__DEFRC__:'\"'$(DEFRC)'\"':\n");
X 
X #ifdef        USEDATADIR
-       printf("s:__UNITBLPATH__:-DDATADIR='\"'$(DATADIR)'\"':\n");
+       printf("s:__TBLPATH__:-DDATADIR='\"'$(DATADIR)'\"':\n");
X       printf("s:__DATADIR__:$(DATADIR):g\n");
X #else
-       printf("s:__UNITBLPATH__::\n");
+       printf("s:__TBLPATH__::\n");
X       printf("s:__DATADIR__:$(BINDIR):g\n");
X #endif
X 
diff -urNP ../FD-2.08d/mkunitbl.c ./mkunitbl.c
--- ../FD-2.08d/mkunitbl.c      Tue Jun 13 00:00:00 2006
+++ ./mkunitbl.c        Fri Jul 28 00:00:00 2006
@@ -4,8 +4,9 @@
X  *    Unicode table generator
X  */
X 
-#include <stdio.h>
X #include "machine.h"
+#include <stdio.h>
+#include <sys/types.h>
X 
X #ifndef       NOUNISTDH
X #include <unistd.h>
@@ -19,21 +20,24 @@
X #define       MAXNFLEN        4
X 
X typedef struct _convtable {
-       unsigned short unicode;
-       unsigned short org;
+       u_short unicode;
+       u_short org;
X } convtable;
X 
X typedef struct _nftable {
-       unsigned short unicode;
-       unsigned short normalization[MAXNFLEN + 1];
+       u_short unicode;
+       u_short normalization[MAXNFLEN + 1];
X } nftable;
X 
X static int cmpuni __P_((CONST VOID_P, CONST VOID_P));
X static int cmpnf __P_((CONST VOID_P, CONST VOID_P));
X static int NEAR fputbyte __P_((int, FILE *));
-static int NEAR fputword __P_((unsigned int, FILE *));
+static int NEAR fputword __P_((u_int, FILE *));
+static int NEAR fputunilist __P_((convtable [], u_int, FILE *));
+static int NEAR fputnflist __P_((nftable [], u_int, FILE *));
+int main __P_((int, char *[]));
X 
-static convtable unitable[] = {
+static convtable unilist[] = {
X       {0x00a7, 0x8198},
X       {0x00a8, 0x814e},
X       {0x00b0, 0x818b},
@@ -9246,9 +9250,9 @@
X       {0xffe4, 0xfa55},
X       {0xffe5, 0x818f},
X };
-#define        UNITBLSIZ       ((int)sizeof(unitable) / sizeof(convtable))
+#define        UNILISTSIZ      ((int)sizeof(unilist) / sizeof(convtable))
X 
-static nftable macunitable[] = {
+static nftable macunilist[] = {
X       {0x00c0, {0x0041, 0x0300, 0}},
X       {0x00c1, {0x0041, 0x0301, 0}},
X       {0x00c2, {0x0041, 0x0302, 0}},
@@ -10100,6 +10104,8 @@
X       {0x1ffb, {0x03a9, 0x0301, 0}},
X       {0x1ffc, {0x03a9, 0x0345, 0}},
X       {0x1ffd, {0x00b4, 0}},
+       {0x2015, {0x2014, 0}},
+       {0x2225, {0x2016, 0}},
X       {0x304c, {0x304b, 0x3099, 0}},
X       {0x304e, {0x304d, 0x3099, 0}},
X       {0x3050, {0x304f, 0x3099, 0}},
@@ -10191,8 +10197,13 @@
X       {0xfb4c, {0x05d1, 0x05bf, 0}},
X       {0xfb4d, {0x05db, 0x05bf, 0}},
X       {0xfb4e, {0x05e4, 0x05bf, 0}},
+       {0xff0d, {0x2212, 0}},
+       {0xff5e, {0x301c, 0}},
+       {0xffe0, {0x00a2, 0}},
+       {0xffe1, {0x00a3, 0}},
+       {0xffe2, {0x00ac, 0}},
X };
-#define        MACUNITBLSIZ    ((int)sizeof(macunitable) / sizeof(nftable))
+#define        MACUNILISTSIZ   ((int)sizeof(macunilist) / sizeof(nftable))
X 
X static int cmpuni(vp1, vp2)
X CONST VOID_P vp1;
@@ -10236,7 +10247,7 @@
X }
X 
X static int NEAR fputword(w, fp)
-unsigned int w;
+u_int w;
X FILE *fp;
X {
X       if (fputbyte((int)(w & 0xff), fp) < 0
@@ -10246,38 +10257,63 @@
X       return(0);
X }
X 
+static int NEAR fputunilist(list, max, fp)
+convtable list[];
+u_int max;
+FILE *fp;
+{
+       u_int n;
+
+       qsort(list, max, sizeof(convtable), cmpuni);
+       if (fputword(max, fp) < 0) return(-1);
+       for (n = 0; n < max; n++) {
+               if (fputword(list[n].unicode, fp) < 0
+               || fputword(list[n].org, fp) < 0)
+                       return(-1);
+       }
+
+       return(0);
+}
+
+static int NEAR fputnflist(list, max, fp)
+nftable list[];
+u_int max;
+FILE *fp;
+{
+       u_int n;
+       int i;
+
+       qsort(list, max, sizeof(nftable), cmpnf);
+       if (fputword(max, fp) < 0) return(-1);
+       for (n = 0; n < max; n++) {
+               if (fputword(list[n].unicode, fp) < 0) return(-1);
+               for (i = 0; i < MAXNFLEN; i++) {
+                       if (fputword(list[n].normalization[i], fp) < 0)
+                               return(-1);
+               }
+       }
+
+       return(0);
+}
+
X int main(argc, argv)
X int argc;
X char *argv[];
X {
X       FILE *fp;
-       int i, j;
X 
-       if (argc < 2 || (fp = fopen(argv[1], "wb")) == NULL) {
+       if (argc < 2 || !(fp = fopen(argv[1], "wb"))) {
X               fprintf(stderr, "Cannot open file.\n");
X               return(1);
X       }
X 
-       qsort(unitable, UNITBLSIZ, sizeof(convtable), cmpuni);
-       if (fputword(UNITBLSIZ, fp) < 0) return(1);
-       for (i = 0; i < UNITBLSIZ; i++) {
-               if (fputword(unitable[i].unicode, fp) < 0
-               || fputword(unitable[i].org, fp) < 0)
-                       return(1);
-       }
+       if (fputunilist(unilist, UNILISTSIZ, fp) < 0) return(1);
X 
X       if (fputbyte(1, fp) < 0) return(1);
X       if (fputbyte(MAXNFLEN, fp) < 0) return(1);
X 
-       qsort(macunitable, MACUNITBLSIZ, sizeof(nftable), cmpnf);
-       if (fputword(MACUNITBLSIZ, fp) < 0) return(1);
-       for (i = 0; i < MACUNITBLSIZ; i++) {
-               if (fputword(macunitable[i].unicode, fp) < 0) return(1);
-               for (j = 0; j < MAXNFLEN; j++) {
-                       if (fputword(macunitable[i].normalization[j], fp) < 0)
-                               return(1);
-               }
-       }
+       if (fputnflist(macunilist, MACUNILISTSIZ, fp) < 0) return(1);
+
X       fclose(fp);
X 
X       return(0);
diff -urNP ../FD-2.08d/parse.c ./parse.c
--- ../FD-2.08d/parse.c Tue Jun 13 00:00:00 2006
+++ ./parse.c   Fri Jul 28 00:00:00 2006
@@ -293,7 +293,7 @@
X                       hi = 0;
X                       if (!(flags & VF_UNSIGNED)) {
X                               mask = (MAXUTYPE(u_long_t) >> 1);
-                               if (u & ~mask) hi = 0xff;
+                               if (u & ~mask) hi = MAXUTYPE(char);
X                       }
X                       buf = va_arg(args, char *);
X                       memset(buf, hi, len);
diff -urNP ../FD-2.08d/pathname.c ./pathname.c
--- ../FD-2.08d/pathname.c      Tue Jun 13 00:00:00 2006
+++ ./pathname.c        Fri Jul 28 00:00:00 2006
@@ -7,13 +7,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>
@@ -22,6 +19,10 @@
X # ifndef      NOSTDLIBH
X # include <stdlib.h>
X # endif
+
+#include "printf.h"
+#include "kctype.h"
+#include "pathname.h"
X #endif        /* !FD */
X 
X #if   MSDOS
@@ -532,6 +533,18 @@
X #endif        /* !FD */
X 
X #if   MSDOS || (defined (FD) && !defined (_NODOSDRIVE))
+char *gendospath(path, drive, c)
+char *path;
+int drive, c;
+{
+       *(path++) = drive;
+       *(path++) = ':';
+       if (c) *(path++) = c;
+       *path = '\0';
+
+       return(path);
+}
+
X char *strdelim(s, d)
X char *s;
X int d;
@@ -1404,7 +1417,7 @@
X static void NEAR duplwild(dst, src)
X wild_t *dst, *src;
X {
-       memcpy(dst, src, sizeof(wild_t));
+       memcpy((char *)dst, (char *)src, sizeof(wild_t));
X       dst -> fixed.s = (char *)malloc2(src -> fixed.size);
X       memcpy(dst -> fixed.s, src -> fixed.s, src -> fixed.len + 1);
X       dst -> path.s = (char *)malloc2(src -> path.size);
@@ -1414,7 +1427,8 @@
X       if (src -> ino) {
X               dst -> ino = (devino_t *)malloc2(src -> nino
X                       * sizeof(devino_t));
-               memcpy(dst -> ino, src -> ino, src -> nino * sizeof(devino_t));
+               memcpy((char *)(dst -> ino), (char *)(src -> ino),
+                       src -> nino * sizeof(devino_t));
X       }
X #endif        /* !NODIRLOOP */
X }
@@ -2200,6 +2214,9 @@
X char ***argvp;
X int exe;
X {
+# if   MSDOS || (defined (FD) && !defined (_NODOSDRIVE))
+       char cwd[4];
+# endif
X       char *file, *dir;
X       int dlen;
X 
@@ -2221,8 +2238,14 @@
X       else if (*path == '~')
X               return(completeuser(&(path[1]), len - 1, argc, argvp, 1));
X # endif
-       else if (exe && dir == path)
-               return(completeexe(path, len, argc, argvp));
+# if   MSDOS || (defined (FD) && !defined (_NODOSDRIVE))
+       else if (dir != path) {
+               len -= dlen;
+               dlen = gendospath(cwd, *path, '.') - cwd;
+               return(completefile(dir, len, argc, argvp, cwd, dlen, exe));
+       }
+# endif
+       else if (exe) return(completeexe(path, len, argc, argvp));
X 
X       return(completefile(path, len, argc, argvp, curpath, 1, exe));
X }
diff -urNP ../FD-2.08d/pathname.h ./pathname.h
--- ../FD-2.08d/pathname.h      Tue Jun 13 00:00:00 2006
+++ ./pathname.h        Fri Jul 28 00:00:00 2006
@@ -196,6 +196,7 @@
X } gidtable;
X 
X #if   MSDOS || (defined (FD) && !defined (_NODOSDRIVE))
+extern char *gendospath __P_((char *, int, int));
X extern char *strdelim __P_((char *, int));
X extern char *strrdelim __P_((char *, int));
X #else
diff -urNP ../FD-2.08d/posixsh.c ./posixsh.c
--- ../FD-2.08d/posixsh.c       Tue Jun 13 00:00:00 2006
+++ ./posixsh.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 #if   MSDOS
diff -urNP ../FD-2.08d/printf.c ./printf.c
--- ../FD-2.08d/printf.c        Tue Jun 13 00:00:00 2006
+++ ./printf.c  Fri Jul 28 00:00:00 2006
@@ -9,6 +9,10 @@
X #include <string.h>
X #include <sys/types.h>
X 
+#ifndef        NOUNISTDH
+#include <unistd.h>
+#endif
+
X #ifndef       NOSTDLIBH
X #include <stdlib.h>
X #endif
@@ -41,7 +45,17 @@
X extern int getoutputkcode __P_((VOID_A));
X # endif
X extern char *restorearg __P_((char *));
-#endif
+#endif /* FD */
+
+#ifdef CODEEUC
+# ifdef        FD
+extern int strlen2 __P_((char *));
+# else
+static int NEAR strlen2 __P_((char *));
+# endif
+#else  /* !CODEEUC */
+#define        strlen2 strlen
+#endif /* !CODEEUC */
X 
X static int NEAR checkchar __P_((int, printbuf_t *));
X static int NEAR setint __P_((u_long_t, int, printbuf_t *, int, int));
@@ -76,6 +90,18 @@
X };
X 
X 
+#if    !defined (FD) && defined (CODEEUC)
+static int NEAR strlen2(s)
+char *s;
+{
+       int i, len;
+
+       for (i = len = 0; s[i]; i++, len++) if (isekana(s, i)) i++;
+
+       return(len);
+}
+#endif /* !FD && CODEEUC */
+
X int getnum(s, ptrp)
X CONST char *s;
X int *ptrp;
@@ -152,7 +178,7 @@
X       long_t n;
X       int i, c, len, ptr, sign, bit;
X 
-       memcpy(&n, &u, sizeof(n));
+       memcpy((char *)&n, (char *)&u, sizeof(n));
X       bit = 0;
X 
X #ifdef        MINIMUMSHELL
@@ -290,13 +316,7 @@
X {
X       int i, j, c, len, total;
X 
-       if (s) {
-#ifdef CODEEUC
-               for (i = len = 0; s[i]; i++, len++) if (isekana(s, i)) i++;
-#else
-               len = strlen(s);
-#endif
-       }
+       if (s) len = strlen2(s);
X       else {
X               s = "(null)";
X               len = strsize("(null)");
@@ -509,7 +529,7 @@
X # ifndef      HPUX
X       /*
X        * HP-UX always pushes arguments from lowest to uppermost,
-        * in spite of the CPU endien.
+        * in spite of the CPU endian.
X        */
X                               tmp = 0x5a;
X                               cp = (char *)(&tmp);
diff -urNP ../FD-2.08d/printf.h ./printf.h
--- ../FD-2.08d/printf.h        Tue Jun 13 00:00:00 2006
+++ ./printf.h  Fri Jul 28 00:00:00 2006
@@ -19,7 +19,7 @@
X       char *buf;
X       int ptr;
X       int size;
-       int flags;
+       u_short flags;
X } printbuf_t;
X 
X #define       VF_NEW          000001
diff -urNP ../FD-2.08d/pty.c ./pty.c
--- ../FD-2.08d/pty.c   Tue Jun 13 00:00:00 2006
+++ ./pty.c     Fri Jul 28 00:00:00 2006
@@ -53,6 +53,9 @@
X #ifndef       O_NOCTTY
X #define       O_NOCTTY        0
X #endif
+#ifndef        EPERM
+#define        EPERM           EACCES
+#endif
X 
X #ifndef       USEDEVPTMX
X static char pty_char1[] = "pqrstuvwxyzPQRST";
diff -urNP ../FD-2.08d/rockridg.c ./rockridg.c
--- ../FD-2.08d/rockridg.c      Tue Jun 13 00:00:00 2006
+++ ./rockridg.c        Fri Jul 28 00:00:00 2006
@@ -28,13 +28,13 @@
X #  ifdef      SVR4
X #  include <sys/sysmacros.h>
X #   ifndef    makedev
-#   define     makedev(ma, mi) (((((unsigned long)(ma)) & 0x3fff) << 18) \
-                               | (((unsigned long)(mi)) & 0x3ffff))
+#   define     makedev(ma, mi) (((((u_long)(ma)) & 0x3fff) << 18) \
+                               | (((u_long)(mi)) & 0x3ffff))
X #   endif
X #  else
X #   ifndef    makedev
-#   define     makedev(ma, mi) (((((unsigned)(ma)) & 0xff) << 8) \
-                               | (((unsigned)(mi)) & 0xff))
+#   define     makedev(ma, mi) (((((u_int)(ma)) & 0xff) << 8) \
+                               | (((u_int)(mi)) & 0xff))
X #   endif
X #  endif
X # endif
diff -urNP ../FD-2.08d/system.c ./system.c
--- ../FD-2.08d/system.c        Tue Jun 13 00:00:00 2006
+++ ./system.c  Fri Jul 28 00:00:00 2006
@@ -9,13 +9,10 @@
X #include "fd.h"
X #else /* !FD */
X #define       K_EXTERN
+#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>
@@ -25,6 +22,10 @@
X #include <stdlib.h>
X #endif
X 
+#include "printf.h"
+#include "kctype.h"
+#include "pathname.h"
+
X #ifdef        PATHNOCASE
X #define       TMPPREFIX       "TM"
X #else
@@ -111,6 +112,7 @@
X # endif
X extern VOID initfd __P_((char **));
X extern VOID prepareexitfd __P_((int));
+extern int savestdio __P_((int));
X extern int checkbuiltin __P_((char *));
X extern int checkinternal __P_((char *));
X extern int execbuiltin __P_((int, int, char *[]));
@@ -119,7 +121,7 @@
X extern int completebuiltin __P_((char *, int, int, char ***));
X extern int completeinternal __P_((char *, int, int, char ***));
X # endif
-extern VOID evalenv __P_((VOID_A));
+extern VOID evalenv __P_((char *, int));
X extern int underhome __P_((char *));
X extern int replaceargs __P_((int *, char ***, char **, int));
X extern int replacearg __P_((char **));
@@ -156,7 +158,7 @@
X # endif
X #else /* !FD */
X # ifdef       __TURBOC__
-extern unsigned _stklen = 0x8000;
+extern u_int _stklen = 0x8000;
X # endif
X # if  MSDOS
X # define      deftmpdir       _SS_
@@ -295,6 +297,9 @@
X #ifndef       UL_SETFSIZE
X #define       UL_SETFSIZE     2
X #endif
+#ifndef        EPERM
+#define        EPERM           EACCES
+#endif
X 
X #if   !defined (ENOTEMPTY) && defined (ENFSNOTEMPTY)
X #define       ENOTEMPTY       ENFSNOTEMPTY
@@ -408,6 +413,7 @@
X extern int chdir2 __P_((char *));
X extern int chdir3 __P_((char *, int));
X extern int setenv2 __P_((char *, char *, int));
+extern char *getenv2 __P_((char *));
X # ifdef       USESIGACTION
X extern sigcst_t signal2 __P_((int, sigcst_t));
X # else
@@ -610,6 +616,7 @@
X static VOID NEAR checkmail __P_((int));
X #endif
X static int NEAR searchvar __P_((char **, char *, int, int));
+static char *NEAR searchvar2 __P_((int, char **, char *, int));
X static char **NEAR expandvar __P_((char **, char *, int));
X static char *NEAR getvar __P_((char **, char *, int));
X static char **NEAR putvar __P_((char **, char *, int));
@@ -1228,7 +1235,12 @@
X #define       PRIMALVARSIZ    arraysize(primalvar)
X 
X static char *restrictvar[] = {
-       "PATH", "SHELL",
+       "PATH",
+#ifdef FD
+       "FD_SHELL",
+#else
+       "SHELL",
+#endif
X #ifndef       MINIMUMSHELL
X       "ENV",
X #endif
@@ -1237,17 +1249,20 @@
X 
X #if   MSDOS && !defined (BSPATHDELIM)
X static CONST char *adjustvar[] = {
-       "PATH", "HOME", "SHELL", "COMSPEC",
+       "PATH", "HOME",
X # ifndef      MINIMUMSHELL
X       "ENV",
X # endif
X # ifdef       FD
X       "PWD",
-       "FD_COMSPEC", "FD_TMPDIR",
-       "FD_PAGER", "FD_EDITOR",
+       "FD_TMPDIR",
+       "FD_PAGER", "FD_EDITOR", "FD_SHELL",
X #  ifndef     NOPOSIXUTIL
X       "FD_FCEDIT",
X #  endif
+#  if  MSDOS
+       "FD_COMSPEC",
+#  endif
X #  ifndef     _NOKANJIFCONV
X       "FD_HISTFILE", "FD_RRPATH", "FD_PRECEDEPATH",
X       "FD_SJISPATH", "FD_EUCPATH",
@@ -1256,7 +1271,12 @@
X       "FD_HEXPATH", "FD_CAPPATH", "FD_UTF8PATH", "FD_UTF8MACPATH",
X       "FD_NOCONVPATH",
X #  endif
-# endif        /* FD */
+# else /* !FD */
+       "SHELL",
+#  if  MSDOS
+       "COMSPEC",
+#  endif
+# endif        /* !FD */
X };
X #define       ADJUSTVARSIZ    arraysize(adjustvar)
X #endif        /* MSDOS && !BSPATHDELIM */
@@ -4256,6 +4276,29 @@
X       return(-1);
X }
X 
+static char *NEAR searchvar2(max, var, ident, len)
+int max;
+char **var, *ident;
+int len;
+{
+       int i;
+
+       if (!var) return(NULL);
+       for (i = 0; i < max; i++) {
+               if (!var[i]) continue;
+               if (!strnenvcmp(ident, var[i], len) && !var[i][len])
+                       return(var[i]);
+#ifdef FD
+               if (!strnenvcmp(var[i], FDENV, FDESIZ)
+               && !strnenvcmp(ident, &(var[i][FDESIZ]), len)
+               && !var[i][FDESIZ + len])
+                       return(&(var[i][FDESIZ]));
+#endif
+       }
+
+       return(NULL);
+}
+
X static char **NEAR expandvar(var, ident, len)
X char **var, *ident;
X int len;
@@ -4352,12 +4395,11 @@
X char *s;
X int len;
X {
-       int i;
+       char *cp;
X 
-       for (i = 0; i < PRIMALVARSIZ; i++)
-       if (primalvar[i]
-       && !strnenvcmp(s, primalvar[i], len) && !primalvar[i][len]) {
-               execerror(primalvar[i], ER_CANNOTUNSET, 0);
+       if ((cp = searchvar2(PRIMALVARSIZ, primalvar, s, len))) {
+               execerror(cp, ER_CANNOTUNSET, 0);
+               errno = EPERM;
X               return(-1);
X       }
X 
@@ -4368,13 +4410,13 @@
X char *s;
X int len;
X {
-       int i;
+       char *cp;
X 
X       if (!restricted) return(0);
X 
-       for (i = 0; i < RESTRICTVARSIZ; i++)
-       if (!strnenvcmp(s, restrictvar[i], len) && !restrictvar[i][len]) {
-               execerror(restrictvar[i], ER_RESTRICTED, 0);
+       if ((cp = searchvar2(RESTRICTVARSIZ, restrictvar, s, len))) {
+               execerror(cp, ER_RESTRICTED, 0);
+               errno = EPERM;
X               return(-1);
X       }
X 
@@ -4389,6 +4431,7 @@
X 
X       if ((i = searchvar(ronlylist, s, len, '\0')) >= 0) {
X               execerror(ronlylist[i], ER_ISREADONLY, 0);
+               errno = EACCES;
X               return(-1);
X       }
X 
@@ -4449,6 +4492,7 @@
X                       execerror(cp, ER_INVALTERMFD, 0);
X                       copykeyseq(keymap);
X                       freekeyseq(keymap);
+                       errno = EINVAL;
X                       return(-1);
X               }
X               freekeyseq(keymap);
@@ -4466,6 +4510,9 @@
X #endif
X 
X       shellvar = putvar(shellvar, s, len);
+#ifdef FD
+       evalenv(s, len);
+#endif
X 
X       return(0);
X }
@@ -4559,6 +4606,9 @@
X                       exportlist[i] = exportlist[i + 1];
X               exportlist[i] = NULL;
X       }
+#ifdef FD
+       evalenv(ident, len);
+#endif
X #if   defined (FD) && !defined (_NOPTY)
X       sendparent(TE_UNSET, ident, len);
X #endif
@@ -6279,7 +6329,11 @@
X       char *com;
X       int i;
X 
+# ifdef        FD
+       if (!(com = getenv2("FD_COMSPEC")) && !(com = getenv2("FD_SHELL")))
+# else
X       if (!(com = getconstvar("COMSPEC")) && !(com = getconstvar("SHELL")))
+# endif
X # ifdef       BSPATHDELIM
X               com = "\\COMMAND.COM";
X # else
@@ -8462,7 +8516,7 @@
X static int NEAR dotimes(trp)
X syntaxtree *trp;
X {
-       int usrtime, systime;
+       time_t usrtime, systime;
X #ifdef        USEGETRUSAGE
X       struct rusage ru;
X 
@@ -8481,11 +8535,12 @@
X       systime = buf.tms_cstime / clk;
X       if (buf.tms_cstime % clk > clk / 2) systime++;
X # else
-       usrtime = systime = 0;
+       usrtime = systime = (time_t)0;
X # endif
X #endif        /* !USEGETRUSAGE */
X       fprintf2(stdout, "%dm%ds %dm%ds",
-               usrtime / 60, usrtime % 60, systime / 60, systime % 60);
+               (int)(usrtime / 60), (int)(usrtime % 60),
+               (int)(systime / 60), (int)(systime % 60));
X       fputnl(stdout);
X 
X       return(RET_SUCCESS);
@@ -9899,8 +9954,8 @@
X       comm -> argc = argc;
X       freevar(comm -> argv);
X       comm -> argv = argv;
-#ifdef FD
-       evalenv();
+#if    !MSDOS && defined (FD)
+       if (autosavetty) savestdio(0);
X #endif
X 
X       return(ret);
@@ -10540,7 +10595,6 @@
X               restricted = duprestricted;
X #ifdef        FD
X               inruncom = 0;
-               evalenv();
X #endif
X       }
X       resetsignal(0);
@@ -10554,25 +10608,13 @@
X char **var;
X {
X       char *cp;
-       int i, j, len;
+       int i;
X 
X       if (!var) return;
X       for (i = 0; var[i]; i++) {
X               if (!(cp = strchr(var[i], '='))) continue;
-               len = cp - var[i];
-               for (j = 0; j < ADJUSTVARSIZ; j++) {
-                       if (strnenvcmp(var[i], adjustvar[j], len)
-                       && !adjustvar[j][len])
-                               break;
-# ifdef        FD
-                       if (strnenvcmp(adjustvar[j], FDENV, FDESIZ)
-                       && strnenvcmp(var[i], adjustvar[j] + FDESIZ, len)
-                       && !adjustvar[j][len + FDESIZ])
-                               break;
-# endif
-               }
-               if (j >= ADJUSTVARSIZ) continue;
-               adjustpname(cp);
+               if (searchvar2(ADJUSTVARSIZ, adjustvar, var[i], cp - var[i]))
+                       adjustpname(cp);
X       }
X }
X #endif        /* MSDOS && !BSPATHDELIM */
@@ -10665,7 +10707,6 @@
X #ifdef        FD
X       if (loginshell) execruncom(SH_RCFILE, verbose);
X       else execruncom(FD_RCFILE, verbose);
-       evalenv();
X # ifndef      _NOPTY
X       if (interactive) shptymode = tmpshptymode;
X # endif
@@ -10745,6 +10786,9 @@
X               doperror(NULL, NULL);
X               return(-1);
X       }
+#if    !MSDOS && defined (FD)
+       if (autosavetty) savestdio(0);
+#endif
X 
X       setnbuf(stdin);
X #if   !MSDOS
@@ -10991,8 +11035,14 @@
X       }
X 
X       if (!restricted) restricted = tmprestricted;
-       if (!restricted && (cp = getconstvar("SHELL")))
-               getshellname(getbasename(cp), NULL, &restricted);
+       if (!restricted) {
+#ifdef FD
+               cp = getenv2("FD_SHELL");
+#else
+               cp = getconstvar("SHELL");
+#endif
+               if (cp) getshellname(getbasename(cp), NULL, &restricted);
+       }
X #ifdef        FD
X       fd_restricted = restricted;
X #endif
diff -urNP ../FD-2.08d/term.c ./term.c
--- ../FD-2.08d/term.c  Tue Jun 13 00:00:00 2006
+++ ./term.c    Fri Jul 28 00:00:00 2006
@@ -4,11 +4,11 @@
X  *    terminal module
X  */
X 
+#include "machine.h"
X #include <stdio.h>
X #include <string.h>
X #include <signal.h>
X #include <fcntl.h>
-#include "machine.h"
X 
X #if   defined (DJGPP) && (DJGPP >= 2)
X #include <time.h>
@@ -49,8 +49,8 @@
X #include <sys/time.h>
X 
X typedef struct _kstree_t {
-       int key;
-       int num;
+       u_char key;
+       u_char num;
X       struct _kstree_t *next;
X } kstree_t;
X #endif        /* !MSDOS */
@@ -1385,6 +1385,7 @@
X               if (buf[i] == format[strsize(SIZEFMT) - 1]) break;
X       }
X       keyflush();
+       while (kbhit2(WAITKEYPAD * 1000L)) VOID_C getch2();
X       if (!i || buf[i] != format[strsize(SIZEFMT) - 1]) return(-1);
X       buf[++i] = '\0';
X 
@@ -1673,13 +1674,13 @@
X       if (!parent) n = 0;
X       else {
X               n = parent -> num;
-               parent -> num = num;
+               parent -> num = (u_char)num;
X               parent -> next = new;
X       }
X 
X       for (i = n; i < num; i++) {
-               new[i].key = -1;
-               new[i].num = 0;
+               new[i].key = (u_char)-1;
+               new[i].num = (u_char)0;
X               new[i].next = (kstree_t *)NULL;
X       }
X 
@@ -1693,7 +1694,8 @@
X       int i;
X 
X       if (!list) return(-1);
-       for (i = list[n].num - 1; i >= 0; i--) freekeyseqtree(list[n].next, i);
+       for (i = (int)(list[n].num) - 1; i >= 0; i--)
+               freekeyseqtree(list[n].next, i);
X       if (!n) free(list);
X 
X       return(0);
@@ -1736,7 +1738,7 @@
X                       }
X                       if (k >= p -> num) {
X                               newkeyseqtree(p, k + 1);
-                               p -> next[k].key = i;
+                               p -> next[k].key = (u_char)i;
X                       }
X                       p = &(p -> next[k]);
X               }
@@ -2153,7 +2155,8 @@
X                               keyseq[i].str =
X                                       (char *)malloc(list[i].len + 1);
X                               if (!keyseq[i].str) err2("malloc()");
-                               memcpy(keyseq[i].str, list[i].str, list[i].len);
+                               memcpy(keyseq[i].str, list[i].str,
+                                       list[i].len);
X                       }
X               }
X               sortkeyseq();
@@ -2817,7 +2820,7 @@
X {
X       if (ungetnum >= arraysize(ungetbuf) - 1) return(EOF);
X       if (ungetnum)
-               memmove(&(ungetbuf[1]), &(ungetbuf[0]),
+               memmove((char *)&(ungetbuf[1]), (char *)&(ungetbuf[0]),
X                       ungetnum * sizeof(u_char));
X       ungetbuf[0] = c;
X       ungetnum++;
@@ -3059,7 +3062,7 @@
X # else
X       if (ungetnum >= arraysize(ungetbuf) - 1) return(EOF);
X       if (ungetnum)
-               memmove(&(ungetbuf[1]), &(ungetbuf[0]),
+               memmove((char *)&(ungetbuf[1]), (char *)&(ungetbuf[0]),
X                       ungetnum * sizeof(u_char));
X       ungetbuf[0] = c;
X       ungetnum++;
diff -urNP ../FD-2.08d/termemu.h ./termemu.h
--- ../FD-2.08d/termemu.h       Tue Jun 13 00:00:00 2006
+++ ./termemu.h Fri Jul 28 00:00:00 2006
@@ -11,7 +11,7 @@
X       int pipe;
X       int status;
X #ifndef       _NOKANJICONV
-       char incode, outcode;
+       u_char incode, outcode;
X #endif
X } ptyinfo_t;
X 
diff -urNP ../FD-2.08d/termio.c ./termio.c
--- ../FD-2.08d/termio.c        Tue Jun 13 00:00:00 2006
+++ ./termio.c  Fri Jul 28 00:00:00 2006
@@ -4,12 +4,10 @@
X  *    terminal I/O
X  */
X 
+#include "machine.h"
X #include <stdio.h>
X #include <string.h>
X #include <fcntl.h>
-#include "machine.h"
-#include "printf.h"
-#include "termio.h"
X 
X #ifdef        USESELECTH
X #include <sys/select.h>
@@ -22,6 +20,9 @@
X #ifndef       NOSTDLIBH
X #include <stdlib.h>
X #endif
+
+#include "printf.h"
+#include "termio.h"
X 
X #include <errno.h>
X #ifdef        NOERRNO
diff -urNP ../FD-2.08d/types.h ./types.h
--- ../FD-2.08d/types.h Tue Jun 13 00:00:00 2006
+++ ./types.h   Fri Jul 28 00:00:00 2006
@@ -380,6 +380,28 @@
X #define       LCK_WRITE               1
X #define       LCK_UNLOCK              2
X 
+#define        CHK_OK                  0
+#define        CHK_EXIST               1
+#define        CHK_OVERWRITE           2
+#define        CHK_ERROR               (-1)
+#define        CHK_CANCEL              (-2)
+
+#define        APL_OK                  0
+#define        APL_IGNORE              1
+#define        APL_ERROR               (-1)
+#define        APL_CANCEL              (-2)
+
+#define        CPP_UPDATE              1
+#define        CPP_RENAME              2
+#define        CPP_OVERWRITE           3
+#define        CPP_NOCOPY              4
+#define        CPP_FORWUPDATE          5
+#define        CPP_FORWOVERWRITE       6
+
+#define        RMP_BIAS                2
+#define        RMP_REMOVEALL           (RMP_BIAS + CHK_OK)
+#define        RMP_KEEPALL             (RMP_BIAS + CHK_ERROR)
+
X #define       TCH_MODE                00001
X #define       TCH_UID                 00002
X #define       TCH_GID                 00004
diff -urNP ../FD-2.08d/unixdisk.c ./unixdisk.c
--- ../FD-2.08d/unixdisk.c      Tue Jun 13 00:00:00 2006
+++ ./unixdisk.c        Fri Jul 28 00:00:00 2006
@@ -4,10 +4,10 @@
X  *    UNIX-like disk accessing module
X  */
X 
+#include "machine.h"
X #include <stdio.h>
X #include <fcntl.h>
X #include <io.h>
-#include "machine.h"
X 
X #ifndef       NOUNISTDH
X #include <unistd.h>
@@ -38,6 +38,7 @@
X 
X #ifdef        FD
X extern int _dospath __P_((char *));
+extern char *gendospath __P_((char *, int, int));
X extern char *strdelim __P_((char *, int));
X extern char *strrdelim __P_((char *, int));
X extern int isdelim __P_((char *, int));
@@ -47,6 +48,7 @@
X extern char curpath[];
X #else
X static int NEAR _dospath __P_((char *));
+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 int NEAR isdelim __P_((char *, int));
@@ -151,6 +153,18 @@
X       return((isalpha2(*path) && path[1] == ':') ? *path : 0);
X }
X 
+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;
@@ -364,6 +378,9 @@
X int setcurdrv(drive, nodir)
X int drive, nodir;
X {
+#ifndef        _NODOSDRIVE
+       char tmp[3];
+#endif
X       struct SREGS sreg;
X       __dpmi_regs reg;
X       char *path;
@@ -382,11 +399,7 @@
X 
X #ifndef       _NODOSDRIVE
X       if (checkdrive(drv) > 0) {
-               char tmp[3];
-
-               tmp[0] = drive;
-               tmp[1] = ':';
-               tmp[2] = '\0';
+               VOID_C gendospath(tmp, drive, '\0');
X               return(doschdir(tmp));
X       }
X #endif
@@ -461,24 +474,21 @@
X {
X       struct SREGS sreg;
X       __dpmi_regs reg;
-       char drv[4], buf[128];
+       char drive, drv[4], buf[128];
X 
-       if (!path || !(drv[0] = _dospath(path))) drv[0] = getcurdrv();
+       if (!path || !(drive = _dospath(path))) drive = getcurdrv();
X #ifndef       _NODOSDRIVE
-       if (checkdrive(toupper2(drv[0]) - 'A') > 0) return(-2);
+       if (checkdrive(toupper2(drive) - 'A') > 0) return(-2);
X #endif
X       if (getdosver() < 7) {
X #ifndef       _NODOSDRIVE
-               if ((dosdrive & 1) && islower2(drv[0])) return(-1);
+               if ((dosdrive & 1) && islower2(drive)) return(-1);
X #endif
X               return(-3);
X       }
-       if (isupper2(drv[0])) return(0);
-
-       drv[1] = ':';
-       drv[2] = '\\';
-       drv[3] = '\0';
+       if (isupper2(drive)) return(0);
X 
+       VOID_C gendospath(drv, drive, _SC_);
X       reg.x.ax = 0x71a0;
X       reg.x.bx = 0;
X       reg.x.cx = sizeof(buf);
@@ -540,16 +550,9 @@
X       int drive;
X 
X       cp = path;
-       if ((drive = _dospath(path))) cp += 2;
-       else drive = getcurdrv();
-       buf[0] = drive;
-       buf[1] = ':';
-       if (!*cp) {
-               buf[2] = '.';
-               buf[3] = '\0';
-       }
-       else if (cp == &(path[2])) return(path);
-       else strcpy(&(buf[2]), cp);
+       if (!(drive = _dospath(path))) drive = getcurdrv();
+       else if (*(cp += 2)) return(path);
+       strcpy(gendospath(buf, drive, (*cp) ? '\0' : '.'), cp);
X 
X       return(buf);
X }
@@ -675,10 +678,7 @@
X                       resolved[j + 3] = '\0';
X               }
X               else {
-                       resolved[0] = i;
-                       resolved[1] = ':';
-                       resolved[2] = _SC_;
-                       resolved[3] = '\0';
+                       VOID_C gendospath(resolved, i, _SC_);
X                       if (path && *path == _SC_)
X                               strcpy(&(resolved[2]), path);
X               }
@@ -2141,14 +2141,9 @@
X       }
X       else
X #endif
-       if (!pathname && !(pathname = (char *)malloc(size))) return(NULL);
-       else {
-               pathname[0] = drive;
-               pathname[1] = ':';
-               pathname[2] = _SC_;
-
-               if (!unixgetcurdir(&(pathname[3]), 0)) return(NULL);
-       }
+       if ((!pathname && !(pathname = (char *)malloc(size)))
+       || !unixgetcurdir(gendospath(pathname, drive, _SC_), 0))
+               return(NULL);
X 
X       *pathname = (dos7access & D7_CAPITAL)
X               ? toupper2(*pathname) : tolower2(*pathname);
@@ -2467,13 +2462,15 @@
X       }
X #endif        /* !USEUTIME */
X       if (i <= 0) {
-               if ((fd = open(path, O_RDONLY, 0666)) < 0) return(-1);
-               reg.x.ax = 0x5701;
-               reg.x.bx = (u_short)fd;
-               putdostime(&(reg.x.dx), &(reg.x.cx), t);
-               i = int21call(&reg, &sreg);
-               close(fd);
-               return(i);
+               if ((fd = open(path, O_RDONLY, 0666)) >= 0) {
+                       reg.x.ax = 0x5701;
+                       reg.x.bx = (u_short)fd;
+                       putdostime(&(reg.x.dx), &(reg.x.cx), t);
+                       i = int21call(&reg, &sreg);
+                       close(fd);
+                       return(i);
+               }
+               if (i || errno != EACCES) return(-1);
X       }
X 
X       reg.x.ax = 0x7143;
diff -urNP ../FD-2.08d/unixemu.c ./unixemu.c
--- ../FD-2.08d/unixemu.c       Tue Jun 13 00:00:00 2006
+++ ./unixemu.c Fri Jul 28 00:00:00 2006
@@ -106,10 +106,7 @@
X               strcpy(tmp, cp);
X               cp = tmp;
X       }
-       if (*cp == _SC_) {
-               *(buf++) = drive;
-               *(buf++) = ':';
-       }
+       if (*cp == _SC_) buf = gendospath(buf, drive, '\0');
X       else {
X               if (!dosgetcwd(buf, MAXPATHLEN)) return(0);
X               buf = strcatdelim(buf);
diff -urNP ../FD-2.08d/version.h ./version.h
--- ../FD-2.08d/version.h       Tue Jun 13 00:00:00 2006
+++ ./version.h Fri Jul 28 00:00:00 2006
@@ -5,4 +5,4 @@
X  */
X 
X char *distributor = NULL;
-static char version[] = "@(#)fd.c  2.08d 06/13/06";
+static char version[] = "@(#)fd.c  2.08e 07/28/06";
SHAR_EOF
  $echo 'File' 'FD-2.08e.patch' 'is complete' &&
  $shar_touch -am 07270156106 'FD-2.08e.patch' &&
  chmod 0644 'FD-2.08e.patch' ||
  $echo 'restore of' 'FD-2.08e.patch' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'FD-2.08e.patch:' 'MD5 check failed'
4476a2e41aeeedecf07ce6589d88397c  FD-2.08e.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'FD-2.08e.patch'`"
    test 236466 -eq "$shar_count" ||
    $echo 'FD-2.08e.patch:' 'original size' '236466,' 'current size' "$shar_count!"
  fi
fi
$echo 'You have unpacked the last part'
rm -fr _sh01537
exit 0
-- 
                                               しらい たかし