しらいです。

 file & directory 管理ツール FDclone 2.09 の patch その 10
です。

Submitted-by: shirai@chandra2
Archive-name: FD-2.09.patch/part10

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is `FD-2.09.shar.10' (part 10 of FD-2.09.patch).
# Do not concatenate these parts, unpack them in order with `/bin/sh'.
# File `FD-2.09.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 _sh00904/seq; then
  $echo 'Please unpack part 1 first!'
  exit 1
fi
shar_sequence=`cat _sh00904/seq`
if test "$shar_sequence" != 10; then
  $echo 'Please unpack part' "$shar_sequence" 'next!'
  exit 1
fi
if test ! -f _sh00904/new; then
  $echo 'x -' 'STILL SKIPPING' 'FD-2.09.patch'
else
  $echo 'x -' 'continuing file' 'FD-2.09.patch'
  sed 's/^X//' << 'SHAR_EOF' >> FD-2.09.patch &&
+long dw;
+FILE *fp;
+{
+       if (fputword((u_int)(dw & 0xffff), fp) < 0
+       || fputword((u_int)((dw >> 16) & 0xffff), fp) < 0)
+               return(-1);
+
+       return(0);
+}
+
+static int NEAR writeindex(fp)
+FILE *fp;
+{
+       u_char *buf;
+       char tmp[4 + 1];
+       ALLOC_T ptr;
+       long i, j, n, max;
+       int len;
+
+       for (i = max = 0L; i < maxdict; i++) {
+               if (!(dictlist[i].size)) continue;
+               max++;
+               dictlist[i].max = 1;
+               for (j = 1L; i + j < maxdict; j++) {
+                       if (!(dictlist[i + j].size)) continue;
+                       n = cmpdict(&(dictlist[i + j - 1]),
+                               &(dictlist[i + j]));
+                       if (n < -2 || n > 2) break;
+                       dictlist[i].max++;
+                       dictlist[i + j].max = 0;
+                       if (!n) dictlist[i + j].size = (ALLOC_T)0;
+               }
+               i += j - 1;
+       }
+
+       if (fputdword(max, fp) < 0) return(-1);
+
+       ptr = (ALLOC_T)0;
+       for (i = 0L; i < maxdict; i++) {
+               if (!(dictlist[i].size)) continue;
+               if (fputdword(ptr, fp) < 0) return(-1);
+               ptr += dictlist[i].klen;
+               ptr++;
+               for (j = max = 0L; j < dictlist[i].max; j++) {
+                       if (!(dictlist[i + j].size)) continue;
+                       if (++max > MAXUTYPE(u_char)) {
+                               if (verbose) {
+                                       buf = &(strbuf[dictlist[i + j].ptr]);
+                                       len = *(buf++) * 2;
+                                       buf += len;
+                                       len = *(buf++) * 2;
+                                       while (len > 0) {
+                                               VOID_C jis2str(tmp,
+                                                       getword(buf, 0));
+                                               fprintf(stderr, "%s", tmp);
+                                               buf += 2;
+                                               len -= 2;
+                                       }
+                                       fprintf(stderr,
+               ": Too many entries for the same reading (ignored).\n");
+                               }
+                               continue;
+                       }
+                       ptr += dictlist[i + j].size;
+               }
+               i += dictlist[i].max - 1;
+       }
+       if (fputdword(ptr, fp) < 0) return(-1);
+
+       return(0);
+}
+
+static int NEAR writedict(fp)
+FILE *fp;
+{
+       u_char *buf;
+       long i, j, max;
+
+       for (i = 0L; i < maxdict; i++) {
+               if (!(dictlist[i].size)) continue;
+               buf = &(strbuf[dictlist[i].ptr]);
+               if (fwrite(buf, dictlist[i].klen, 1, fp) != 1) return(-1);
+               for (j = max = 0L; j < dictlist[i].max; j++)
+                       if (dictlist[i + j].size) max++;
+               if (max > MAXUTYPE(u_char)) max = MAXUTYPE(u_char);
+               if (fputbyte(max, fp) < 0) return(-1);
+               for (j = max = 0L; j < dictlist[i].max; j++) {
+                       if (!(dictlist[i + j].size)) continue;
+                       if (++max > MAXUTYPE(u_char)) break;
+
+                       buf = &(strbuf[dictlist[i + j].ptr]);
+                       buf += dictlist[i + j].klen;
+                       if (fwrite(buf, dictlist[i + j].size, 1, fp) != 1)
+                               return(-1);
+               }
+               i += dictlist[i].max - 1;
+       }
+
+       return(0);
+}
+
+static int NEAR writehinsiindex(fp)
+FILE *fp;
+{
+       ALLOC_T ptr;
+       long i;
+
+       if (fputword(maxdict, fp) < 0) return(-1);
+
+       ptr = (ALLOC_T)0;
+       for (i = 0L; i < maxdict; i++) {
+               if (fputword(ptr, fp) < 0) return(-1);
+               ptr += dictlist[i].size;
+       }
+       if (fputword(ptr, fp) < 0) return(-1);
+
+       return(0);
+}
+
+static int NEAR writehinsidict(fp)
+FILE *fp;
+{
+       u_char *buf;
+       long i;
+
+       for (i = 0L; i < maxdict; i++) {
+               buf = &(strbuf[dictlist[i].ptr]);
+               if (fwrite(buf, dictlist[i].size, 1, fp) != 1) return(-1);
+       }
+
+       return(0);
+}
+
+int main(argc, argv)
+int argc;
+char *argv[];
+{
+       FILE *fpin, *fpout;
+       struct stat st;
+       off_t size;
+       int i, c, n, max;
+
+       n = 1;
+       if (n < argc && !strcmp(argv[n], "-h")) {
+               needhinsi++;
+               n++;
+       }
+       if (n < argc && !strcmp(argv[n], "-v")) {
+               verbose++;
+               n++;
+       }
+
+       if (n >= argc) {
+               fprintf(stderr,
+                       "Usage: %s [-h] [-v] outfile [infile...]\n", argv[0]);
+               return(1);
+       }
+
+       if (!(fpout = fopen(argv[n], "wb"))) {
+               fprintf(stderr, "Cannot open file.\n");
+               return(1);
+       }
+
+       qsort(hinsilist, HINSILISTSIZ, sizeof(hinsitable), cmphinsi);
+       for (i = n + 1; i < argc; i++) {
+               size = (off_t)0;
+               if (verbose) {
+                       fprintf(stdout, "%s:\n", argv[i]);
+                       if (stat(argv[i], &st) >= 0) size = st.st_size;
+               }
+               if (!(fpin = fopen(argv[i], "rb"))) {
+                       fprintf(stderr, "%s: Cannot open file.\n", argv[i]);
+                       continue;
+               }
+               c = convdict(size, fpin);
+               fclose(fpin);
+               if (c < 0) break;
+       }
+
+       max = maxdict;
+       if (needhinsi && addhinsidict() < 0) {
+               needhinsi = 0;
+               maxdict = max;
+       }
+
+       if (verbose) {
+               fprintf(stdout, "sorting...");
+               fflush(stdout);
+       }
+       qsort(dictlist, maxdict, sizeof(dicttable), cmpdict);
+       if (verbose) {
+               fputs("  done.\n", stdout);
+               fprintf(stdout, "writing...");
+               fflush(stdout);
+       }
+
+       if (writeindex(fpout) < 0 || writedict(fpout) < 0) {
+               fprintf(stderr, "%s: Cannot write file.\n", argv[n]);
+               return(1);
+       }
+
+       if (!needhinsi) {
+               if (fputword(0, fpout) < 0) return(-1);
+       }
+       else {
+               if (genconlist() < 0) return(1);
+               if (writehinsiindex(fpout) < 0 || writehinsidict(fpout) < 0) {
+                       fprintf(stderr, "%s: Cannot write file.\n", argv[n]);
+                       return(1);
+               }
+       }
+
+       fclose(fpout);
+       if (verbose) fputs("  done.\n", stdout);
+
+       return(0);
+}
diff -urNP ../FD-2.08f/mkmfdosb.sed ./mkmfdosb.sed
--- ../FD-2.08f/mkmfdosb.sed    Tue Aug  8 00:00:00 2006
+++ ./mkmfdosb.sed      Tue Aug 22 00:00:00 2006
@@ -4,6 +4,10 @@
X s:__EXE__:.exe:g
X s:__OBJ__:.obj:g
X s:__EMUOBJS__:unixemu.obj unixdisk.obj:
+s:__IMEOBJS__::
+s:__DICTTBL__::
+s:__DICTSRC__::
+s:__MKDICTOPTION__::
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:\\"$(DOSRC)\\":
X s:__TBLPATH__::
diff -urNP ../FD-2.08f/mkmfdosd.sed ./mkmfdosd.sed
--- ../FD-2.08f/mkmfdosd.sed    Tue Aug  8 00:00:00 2006
+++ ./mkmfdosd.sed      Tue Aug 22 00:00:00 2006
@@ -4,6 +4,10 @@
X s:__EXE__:.exe:g
X s:__OBJ__:.o:g
X s:__EMUOBJS__:unixemu.o unixdisk.o:
+s:__IMEOBJS__::
+s:__DICTTBL__::
+s:__DICTSRC__::
+s:__MKDICTOPTION__::
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:'"'$(DOSRC)'"':
X s:__TBLPATH__::
diff -urNP ../FD-2.08f/mkmfdosg.sed ./mkmfdosg.sed
--- ../FD-2.08f/mkmfdosg.sed    Tue Aug  8 00:00:00 2006
+++ ./mkmfdosg.sed      Tue Aug 22 00:00:00 2006
@@ -4,6 +4,10 @@
X s:__EXE__:.exe:g
X s:__OBJ__:.o:g
X s:__EMUOBJS__:unixemu.o unixdisk.o:
+s:__IMEOBJS__::
+s:__DICTTBL__::
+s:__DICTSRC__::
+s:__MKDICTOPTION__::
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:'"'$(DOSRC)'"':
X s:__TBLPATH__::
diff -urNP ../FD-2.08f/mkmfdosl.sed ./mkmfdosl.sed
--- ../FD-2.08f/mkmfdosl.sed    Tue Aug  8 00:00:00 2006
+++ ./mkmfdosl.sed      Tue Aug 22 00:00:00 2006
@@ -4,6 +4,10 @@
X s:__EXE__:.exe:g
X s:__OBJ__:.obj:g
X s:__EMUOBJS__:unixemu.obj unixdisk.obj:
+s:__IMEOBJS__::
+s:__DICTTBL__::
+s:__DICTSRC__::
+s:__MKDICTOPTION__::
X s:__OBJLIST__:@$(ARGS):
X s:__DEFRC__:\\\\\\"$(DOSRC)\\\\\\":
X s:__TBLPATH__::
@@ -23,7 +27,7 @@
X s:__HOSTCC__:$(CC):
X s:__HOSTCCOPTIONS__:-O:
X s:__FDSETSIZE__::
-s:__MEM__:-ml -h -k"-s 3800":
+s:__MEM__:-ml -h -k"-s 3000":
X s:__SHMEM__:-mp -h -k"-s 8000":
X s:__BSHMEM__:-ms -k"-s 8000":
X s:__OUT__:-o $@:
diff -urNP ../FD-2.08f/mkmfsed.c ./mkmfsed.c
--- ../FD-2.08f/mkmfsed.c       Tue Aug  8 00:00:00 2006
+++ ./mkmfsed.c Tue Aug 22 00:00:00 2006
@@ -45,6 +45,9 @@
X #ifndef       CCCOMMAND
X #define       CCCOMMAND       "cc"
X #endif
+#ifndef        DICTSRC
+#define        DICTSRC         ""
+#endif
X 
X int main __P_((int, char *[]));
X 
@@ -78,6 +81,23 @@
X #endif
X       printf("s:__OBJ__:.o:g\n");
X       printf("s:__EMUOBJS__:dosemu.o:\n");
+#ifdef _NOIME
+       printf("s:__IMEOBJS__::\n");
+       printf("s:__DICTTBL__::\n");
+       printf("s:__DICTSRC__::\n");
+       printf("s:__MKDICTOPTION__::\n");
+#else  /* !_NOIME */
+       printf("s:__IMEOBJS__:ime.o roman.o dict.o:\n");
+       printf("s:__DICTTBL__:$(DICTTBL):\n");
+       if (DICTSRC[0]) {
+               printf("s:__DICTSRC__:%s:\n", DICTSRC);
+               printf("s:__MKDICTOPTION__:-h -v:\n");
+       }
+       else {
+               printf("s:__DICTSRC__:$(DICTTXT):\n");
+               printf("s:__MKDICTOPTION__::\n");
+       }
+#endif /* !_NOIME */
X       printf("s:__OBJLIST__:$(OBJ1) $(OBJ2) $(OBJ3):\n");
X       printf("s:__DEFRC__:'\"'$(DEFRC)'\"':\n");
X 
diff -urNP ../FD-2.08f/mktankan.c ./mktankan.c
--- ../FD-2.08f/mktankan.c      Thu Jan  1 09:00:00 1970
+++ ./mktankan.c        Tue Aug 22 00:00:00 2006
@@ -0,0 +1,724 @@
+/*
+ *     mktankan.c
+ *
+ *     Tan-Kanji translation table generator
+ */
+
+#include "machine.h"
+#include <stdio.h>
+
+#ifndef        NOUNISTDH
+#include <unistd.h>
+#endif
+
+#ifndef        NOSTDLIBH
+#include <stdlib.h>
+#endif
+
+#include "printf.h"
+#include "kctype.h"
+#include "roman.h"
+
+#define        MAXKANASTR      255
+#define        DEFFREQ         0
+#define        DEFTK(s,c)      {s, strsize(s), c}
+
+typedef struct _tankantable {
+       char *str;
+       ALLOC_T len;
+       u_short code;
+} tankantable;
+
+extern romantable *romanlist;
+
+static VOID NEAR roman2str __P_((char *, char *, ALLOC_T));
+int main __P_((int, char *[]));
+
+static u_short tankanstr[] = { 0x4331, 0x3441, 0x3b7a };
+static CONST tankantable tankanlist[] = {
+       DEFTK("a",    0x3021),
+       DEFTK("ai",   0x3025),
+       DEFTK("hou",  0x3029),        /* a + u */
+       DEFTK("aoi",  0x302a),
+       DEFTK("akane",        0x302b),
+       DEFTK("aki",  0x302c),
+       DEFTK("aku",  0x302d),
+       DEFTK("asahi",        0x3030),
+       DEFTK("asi",  0x3031),
+       DEFTK("aji",  0x3033),
+       DEFTK("azusa",        0x3034),
+       DEFTK("atu",  0x3035),
+       DEFTK("kyuu", 0x3037),        /* atsuka + u */
+       DEFTK("ate",  0x3038),
+       DEFTK("ane",  0x3039),
+       DEFTK("abu",  0x303a),
+       DEFTK("ame",  0x303b),
+       DEFTK("aya",  0x303c),
+       DEFTK("ayu",  0x303e),
+       DEFTK("aru",  0x303f),
+       DEFTK("awa",  0x3040),
+       DEFTK("awase",        0x3041),
+       DEFTK("an",   0x3042),
+
+       DEFTK("i",    0x304a),
+       DEFTK("iki",  0x3068),
+       DEFTK("iku",  0x3069),
+       DEFTK("iso",  0x306b),
+       DEFTK("iti",  0x306c),
+       DEFTK("itu",  0x306e),
+       DEFTK("ine",  0x3070),
+       DEFTK("ibara",        0x3071),
+       DEFTK("imo",  0x3072),
+       DEFTK("iwasi",        0x3073),
+       DEFTK("in",   0x3074),
+
+       DEFTK("u",    0x3126),
+       DEFTK("ki",   0x312e),        /* ukaga + u */
+       DEFTK("usi",  0x312f),
+       DEFTK("usu",  0x3130),
+       DEFTK("uzu",  0x3132),
+       DEFTK("uso",  0x3133),
+       DEFTK("uta",  0x3134),
+       DEFTK("utu",  0x3135),
+       DEFTK("unagi",        0x3137),
+       DEFTK("uba",  0x3138),
+       DEFTK("umaya",        0x3139),
+       DEFTK("ura",  0x313a),
+       DEFTK("uri",  0x313b),
+       DEFTK("uruu", 0x313c),
+       DEFTK("uwasa",        0x313d),
+       DEFTK("un",   0x313e),
+
+       DEFTK("e",    0x3141),
+       DEFTK("ei",   0x3143),
+       DEFTK("eki",  0x3155),
+       DEFTK("etu",  0x3159),
+       DEFTK("enoki",        0x315d),
+       DEFTK("en",   0x315e),
+
+       DEFTK("o",    0x3177),
+       DEFTK("oi",   0x3179),
+       DEFTK("ou",   0x317a),
+       DEFTK("oka",  0x322c),
+       DEFTK("oki",  0x322d),
+       DEFTK("ogi",  0x322e),
+       DEFTK("oku",  0x322f),
+       DEFTK("oke",  0x3233),
+       DEFTK("osu",  0x3234),
+       DEFTK("otu",  0x3235),
+       DEFTK("ore",  0x3236),
+       DEFTK("on",   0x3237),
+
+       DEFTK("ka",   0x323c),
+       DEFTK("ga",   0x3264),
+       DEFTK("kai",  0x3270),
+       DEFTK("gai",  0x332e),
+       DEFTK("kairi",        0x333d),
+       DEFTK("kaori",        0x333e),
+       DEFTK("kaeru",        0x333f),
+       DEFTK("kaki", 0x3340),
+       DEFTK("kagi", 0x3343),
+       DEFTK("kaku", 0x3344),
+       DEFTK("gaku", 0x3358),
+       DEFTK("kake", 0x335d),
+       DEFTK("kasa", 0x335e),
+       DEFTK("kasi", 0x335f),
+       DEFTK("kaji", 0x3361),
+       DEFTK("kajika",       0x3362),
+       DEFTK("kata", 0x3363),
+       DEFTK("katu", 0x3364),
+       DEFTK("katuo",        0x336f),
+       DEFTK("kanou",        0x3370),
+       DEFTK("kaba", 0x3371),
+       DEFTK("kaban",        0x3373),
+       DEFTK("kabu", 0x3374),
+       DEFTK("kabuto",       0x3375),
+       DEFTK("kago", 0x3376),
+       DEFTK("kama", 0x3377),
+       DEFTK("kamu", 0x337a),
+       DEFTK("kamo", 0x337b),
+       DEFTK("kasiwa",       0x337c),
+       DEFTK("kaya", 0x337d),
+       DEFTK("kayu", 0x3421),
+       DEFTK("kari", 0x3422),
+       DEFTK("kawara",       0x3424),
+       DEFTK("kan",  0x3425),
+       DEFTK("gan",  0x345d),
+
+       DEFTK("ki",   0x346b),
+       DEFTK("gi",   0x3536),
+       DEFTK("kiku", 0x3545),
+       DEFTK("kiti", 0x3548),
+       DEFTK("kitu", 0x3549),
+       DEFTK("kinuta",       0x354e),
+       DEFTK("kine", 0x354f),
+       DEFTK("kibi", 0x3550),
+       DEFTK("kyaku",        0x3551),
+       DEFTK("gyaku",        0x3554),
+       DEFTK("kyuu", 0x3556),
+       DEFTK("gyuu", 0x356d),
+       DEFTK("kyo",  0x356e),
+       DEFTK("gyo",  0x3579),
+       DEFTK("kyou", 0x357c),
+       DEFTK("gyou", 0x3644),
+       DEFTK("kyoku",        0x3649),
+       DEFTK("gyoku",        0x364c),
+       DEFTK("kiri", 0x364d),
+       DEFTK("kiro", 0x364e),
+       DEFTK("kin",  0x364f),
+       DEFTK("gin",  0x3663),
+
+       DEFTK("ku",   0x3665),
+       DEFTK("gu",   0x3671),
+       DEFTK("kuu",  0x3674),
+       DEFTK("guu",  0x3676),
+       DEFTK("kusi", 0x367a),
+       DEFTK("kusiro",       0x367c),
+       DEFTK("kuzu", 0x367d),
+       DEFTK("kutu", 0x367e),
+       DEFTK("kutuwa",       0x3725),
+       DEFTK("kubo", 0x3726),
+       DEFTK("kuma", 0x3727),
+       DEFTK("kume", 0x3729),
+       DEFTK("kuri", 0x372a),
+       DEFTK("kuwa", 0x372c),
+       DEFTK("kun",  0x372e),
+       DEFTK("gun",  0x3732),
+
+       DEFTK("ke",   0x3735),
+       DEFTK("kei",  0x3738),
+       DEFTK("gei",  0x375d),
+       DEFTK("geki", 0x3760),
+       DEFTK("keta", 0x3765),
+       DEFTK("ketu", 0x3766),
+       DEFTK("getu", 0x376e),
+       DEFTK("ken",  0x376f),
+       DEFTK("gen",  0x3835),
+
+       DEFTK("ko",   0x3843),
+       DEFTK("go",   0x385e),
+       DEFTK("kotu", 0x3870),        /* ko + i */
+       DEFTK("koi",  0x3871),
+       DEFTK("kou",  0x3872),
+       DEFTK("gou",  0x3964),
+       DEFTK("kouji",        0x396d),
+       DEFTK("koku", 0x396e),
+       DEFTK("goku", 0x3976),
+       DEFTK("roku", 0x3977),        /* ko + si */
+       DEFTK("kosi", 0x3978),
+       DEFTK("kosiki",       0x3979),
+       DEFTK("kotu", 0x397a),
+       DEFTK("koma", 0x397d),
+       DEFTK("komi", 0x397e),
+       DEFTK("kono", 0x3a21),
+       DEFTK("koro", 0x3a22),
+       DEFTK("kon",  0x3a23),
+
+       DEFTK("sa",   0x3a33),
+       DEFTK("za",   0x3a41),
+       DEFTK("sai",  0x3a44),
+       DEFTK("zai",  0x3a5e),
+       DEFTK("go",   0x3a63),        /* sa + eru */
+       DEFTK("saka", 0x3a64),
+       DEFTK("sakai",        0x3a66),
+       DEFTK("sakaki",       0x3a67),
+       DEFTK("sakana",       0x3a68),
+       DEFTK("saki", 0x3a69),
+       DEFTK("sagi", 0x3a6d),
+       DEFTK("saku", 0x3a6e),
+       DEFTK("sakura",       0x3a79),
+       DEFTK("sake", 0x3a7a),
+       DEFTK("sasa", 0x3a7b),
+       DEFTK("saji", 0x3a7c),
+       DEFTK("satu", 0x3a7d),
+       DEFTK("zatu", 0x3b28),
+       DEFTK("satuki",       0x3b29),
+       DEFTK("saba", 0x3b2a),
+       DEFTK("betu", 0x3b2b),        /* saba + ku */
+       DEFTK("sabi", 0x3b2c),
+       DEFTK("same", 0x3b2d),
+       DEFTK("sara", 0x3b2e),
+       DEFTK("sarasi",       0x3b2f),
+       DEFTK("san",  0x3b30),
+       DEFTK("zan",  0x3b42),
+
+       DEFTK("si",   0x3b45),
+       DEFTK("ji",   0x3b76),
+       DEFTK("sio",  0x3c2e),
+       DEFTK("sika", 0x3c2f),
+       DEFTK("siki", 0x3c30),
+       DEFTK("sigi", 0x3c32),
+       DEFTK("jiku", 0x3c33),
+       DEFTK("sisi", 0x3c35),
+       DEFTK("sizuku",       0x3c36),
+       DEFTK("siti", 0x3c37),
+       DEFTK("situ", 0x3c38),
+       DEFTK("jitu", 0x3c42),
+       DEFTK("sitomi",       0x3c43),
+       DEFTK("sino", 0x3c44),
+       DEFTK("si",   0x3c45),        /* sino + bu */
+       DEFTK("siba", 0x3c46),
+       DEFTK("sibe", 0x3c49),
+       DEFTK("sima", 0x3c4a),
+       DEFTK("sha",  0x3c4b),
+       DEFTK("ja",   0x3c58),
+       DEFTK("shaku",        0x3c5a),
+       DEFTK("jaku", 0x3c63),
+       DEFTK("shu",  0x3c67),
+       DEFTK("ju",   0x3c74),
+       DEFTK("shuu", 0x3c7c),
+       DEFTK("juu",  0x3d3a),
+       DEFTK("shuku",        0x3d47),
+       DEFTK("juku", 0x3d4e),
+       DEFTK("shutu",        0x3d50),
+       DEFTK("jutu", 0x3d51),
+       DEFTK("shun", 0x3d53),
+       DEFTK("jun",  0x3d5a),
+       DEFTK("sho",  0x3d68),
+       DEFTK("jo",   0x3d75),
+       DEFTK("shou", 0x3d7d),
+       DEFTK("jou",  0x3e65),
+       DEFTK("shoku",        0x3e7c),
+       DEFTK("joku", 0x3f2b),
+       DEFTK("siri", 0x3f2c),
+       DEFTK("sin",  0x3f2d),
+       DEFTK("jin",  0x3f4d),
+
+       DEFTK("su",   0x3f5a),
+       DEFTK("zu",   0x3f5e),
+       DEFTK("sui",  0x3f61),
+       DEFTK("zui",  0x3f6f),
+       DEFTK("suu",  0x3f72),
+       DEFTK("sue",  0x3f78),
+       DEFTK("sugi", 0x3f79),
+       DEFTK("suge", 0x3f7b),
+       DEFTK("ha",   0x3f7c),        /* sukobu + ru */
+       DEFTK("suzume",       0x3f7d),
+       DEFTK("suso", 0x3f7e),
+       DEFTK("chou", 0x4021),        /* su + mu */
+       DEFTK("suri", 0x4022),
+       DEFTK("sun",  0x4023),
+
+       DEFTK("se",   0x4024),
+       DEFTK("ze",   0x4027),
+       DEFTK("sei",  0x4028),
+       DEFTK("zei",  0x4047),
+       DEFTK("seki", 0x4049),
+       DEFTK("setu", 0x405a),
+       DEFTK("zetu", 0x4064),
+       DEFTK("semi", 0x4066),
+       DEFTK("sen",  0x4067),
+       DEFTK("zen",  0x4130),
+       DEFTK("senti",        0x4138),
+
+       DEFTK("so",   0x4139),
+       DEFTK("sou",  0x414e),
+       DEFTK("zou",  0x417c),
+       DEFTK("soku", 0x4225),
+       DEFTK("zoku", 0x422f),
+       DEFTK("sotu", 0x4234),
+       DEFTK("sode", 0x4235),
+       DEFTK("sono", 0x4236),
+       DEFTK("sen",  0x4237),        /* soro + u */
+       DEFTK("son",  0x4238),
+
+       DEFTK("ta",   0x423e),
+       DEFTK("da",   0x4242),
+       DEFTK("tai",  0x424e),
+       DEFTK("dai",  0x4265),
+       DEFTK("taka", 0x426b),
+       DEFTK("taki", 0x426c),
+       DEFTK("taku", 0x426e),
+       DEFTK("daku", 0x4279),
+       DEFTK("take", 0x427b),
+       DEFTK("tako", 0x427c),
+       DEFTK("tada", 0x427e),
+       DEFTK("kou",  0x4321),        /* tata + ku */
+       DEFTK("tan",  0x4322),        /* tada + si */
+       DEFTK("tatu", 0x4323),
+       DEFTK("datu", 0x4325),
+       DEFTK("tatumi",       0x4327),
+       DEFTK("tate", 0x4328),
+       DEFTK("ten",  0x4329),        /* tado + ru */
+       DEFTK("tana", 0x432a),
+       DEFTK("tani", 0x432b),
+       DEFTK("tanuki",       0x432c),
+       DEFTK("tara", 0x432d),
+       DEFTK("taru", 0x432e),
+       DEFTK("dare", 0x432f),
+       DEFTK("tan",  0x4330),
+       DEFTK("dan",  0x4344),
+
+       DEFTK("ti",   0x434d),
+       DEFTK("tiku", 0x435b),
+       DEFTK("titu", 0x4361),
+       DEFTK("cha",  0x4363),
+       DEFTK("chaku",        0x4364),
+       DEFTK("chuu", 0x4366),
+       DEFTK("cho",  0x4374),
+       DEFTK("chou", 0x437a),
+       DEFTK("choku",        0x443c),
+       DEFTK("tin",  0x443f),
+
+       DEFTK("tu",   0x4445),
+       DEFTK("tui",  0x4446),
+       DEFTK("tuu",  0x444b),
+       DEFTK("tuka", 0x444d),
+       DEFTK("tuga", 0x444e),
+       DEFTK("kaku", 0x444f),        /* tuka + mu */
+       DEFTK("tuki", 0x4450),
+       DEFTK("tukuda",       0x4451),
+       DEFTK("tuke", 0x4452),
+       DEFTK("tuge", 0x4453),
+       DEFTK("tuji", 0x4454),
+       DEFTK("tuta", 0x4455),
+       DEFTK("tuduri",       0x4456),
+       DEFTK("tuba", 0x4457),
+       DEFTK("tubaki",       0x4458),
+       DEFTK("kai",  0x4459),        /* tubu + su */
+       DEFTK("tubo", 0x445a),
+       DEFTK("tuma", 0x445c),
+       DEFTK("tumugi",       0x445d),
+       DEFTK("tume", 0x445e),
+       DEFTK("turi", 0x445f),
+       DEFTK("turu", 0x4461),
+
+       DEFTK("tei",  0x4462),
+       DEFTK("dei",  0x4525),
+       DEFTK("teki", 0x4526),
+       DEFTK("deki", 0x452e),
+       DEFTK("tetu", 0x452f),
+       DEFTK("ten",  0x4535),
+       DEFTK("den",  0x4541),
+
+       DEFTK("to",   0x4546),
+       DEFTK("do",   0x4558),
+       DEFTK("tou",  0x455d),
+       DEFTK("dou",  0x462f),
+       DEFTK("touge",        0x463d),
+       DEFTK("toki", 0x463e),
+       DEFTK("toku", 0x463f),
+       DEFTK("doku", 0x4647),
+       DEFTK("toti", 0x464a),
+       DEFTK("totu", 0x464c),
+       DEFTK("todo", 0x464e),
+       DEFTK("todoke",       0x464f),
+       DEFTK("tobi", 0x4650),
+       DEFTK("toma", 0x4651),
+       DEFTK("tora", 0x4652),
+       DEFTK("tori", 0x4653),
+       DEFTK("toro", 0x4654),
+       DEFTK("ton",  0x4655),
+       DEFTK("don",  0x465d),
+
+       DEFTK("na",   0x4660),
+       DEFTK("nai",  0x4662),
+       DEFTK("nagara",       0x4663),
+       DEFTK("nagi", 0x4664),
+       DEFTK("nazo", 0x4666),
+       DEFTK("nada", 0x4667),
+       DEFTK("natu", 0x4668),
+       DEFTK("nabe", 0x4669),
+       DEFTK("nara", 0x466a),
+       DEFTK("nare", 0x466b),
+       DEFTK("nawa", 0x466c),
+       DEFTK("nawate",       0x466d),
+       DEFTK("nan",  0x466e),
+       DEFTK("nanji",        0x4672),
+
+       DEFTK("ni",   0x4673),
+       DEFTK("nioi", 0x4677),
+       DEFTK("sin",  0x4678),        /* nigi + wau */
+       DEFTK("niku", 0x4679),
+       DEFTK("niji", 0x467a),
+       DEFTK("nijuu",        0x467b),
+       DEFTK("niti", 0x467c),
+       DEFTK("nyuu", 0x467d),
+       DEFTK("nyo",  0x4721),
+       DEFTK("nyou", 0x4722),
+       DEFTK("nira", 0x4723),
+       DEFTK("nin",  0x4724),
+
+       DEFTK("nure", 0x4728),
+
+       DEFTK("ne",   0x4729),
+       DEFTK("nei",  0x472b),
+       DEFTK("negi", 0x472c),
+       DEFTK("neko", 0x472d),
+       DEFTK("netu", 0x472e),
+       DEFTK("nen",  0x472f),
+
+       DEFTK("no",   0x4735),
+       DEFTK("nou",  0x4739),
+       DEFTK("si",   0x4741),        /* nozo + ku */
+       DEFTK("nomi", 0x4742),
+
+       DEFTK("ha",   0x4743),
+       DEFTK("ba",   0x474c),
+       DEFTK("hai",  0x4750),
+       DEFTK("bai",  0x475c),
+       DEFTK("sha",  0x4767),        /* ha + u */
+       DEFTK("hae",  0x4768),
+       DEFTK("hakari",       0x4769),
+       DEFTK("sin",  0x476a),        /* ha + gu */
+       DEFTK("hagi", 0x476b),
+       DEFTK("haku", 0x476c),
+       DEFTK("baku", 0x4778),
+       DEFTK("hako", 0x4821),
+       DEFTK("hazama",       0x4823),
+       DEFTK("hasi", 0x4824),
+       DEFTK("hajime",       0x4825),
+       DEFTK("hazu", 0x4826),
+       DEFTK("haze", 0x4827),
+       DEFTK("hata", 0x4828),
+       DEFTK("hada", 0x4829),
+       DEFTK("hatake",       0x482a),
+       DEFTK("hati", 0x482c),
+       DEFTK("hatu", 0x482e),
+       DEFTK("batu", 0x4832),
+       DEFTK("hato", 0x4837),
+       DEFTK("hanasi",       0x4838),
+       DEFTK("haniwa",       0x4839),
+       DEFTK("hamaguri",     0x483a),
+       DEFTK("hayabusa",     0x483b),
+       DEFTK("han",  0x483c),
+       DEFTK("ban",  0x4854),
+
+       DEFTK("hi",   0x485b),
+       DEFTK("bi",   0x4877),
+       DEFTK("hiiragi",      0x4922),
+       DEFTK("hie",  0x4923),
+       DEFTK("hiki", 0x4924),
+       DEFTK("hige", 0x4926),
+       DEFTK("hiko", 0x4927),
+       DEFTK("hiza", 0x4928),
+       DEFTK("hisi", 0x4929),
+       DEFTK("hiji", 0x492a),
+       DEFTK("hitu", 0x492b),
+       DEFTK("hinoki",       0x4930),
+       DEFTK("hime", 0x4931),
+       DEFTK("himo", 0x4933),
+       DEFTK("hyaku",        0x4934),
+       DEFTK("byuu", 0x4935),
+       DEFTK("hyou", 0x4936),
+       DEFTK("byou", 0x4940),
+       DEFTK("hiru", 0x4947),
+       DEFTK("hire", 0x4949),
+       DEFTK("hin",  0x494a),
+       DEFTK("bin",  0x4952),
+
+       DEFTK("fu",   0x4954),
+       DEFTK("bu",   0x496e),
+       DEFTK("fuu",  0x4975),
+       DEFTK("fuki", 0x4978),
+       DEFTK("fuku", 0x497a),
+       DEFTK("futi", 0x4a25),
+       DEFTK("futu", 0x4a26),
+       DEFTK("butu", 0x4a29),
+       DEFTK("funa", 0x4a2b),
+       DEFTK("fun",  0x4a2c),
+       DEFTK("bun",  0x4a38),
+
+       DEFTK("hei",  0x4a3a),
+       DEFTK("bei",  0x4a46),
+       DEFTK("pe-ji",        0x4a47),
+       DEFTK("heki", 0x4a48),
+       DEFTK("betu", 0x4a4c),
+       DEFTK("hera", 0x4a4f),
+       DEFTK("hen",  0x4a50),
+       DEFTK("ben",  0x4a58),
+
+       DEFTK("ho",   0x4a5d),
+       DEFTK("bo",   0x4a67),
+       DEFTK("hou",  0x4a6f),
+       DEFTK("bou",  0x4b33),
+       DEFTK("bai",  0x4b4a),        /* ho + eru */
+       DEFTK("hoo",  0x4b4b),
+       DEFTK("hoku", 0x4b4c),
+       DEFTK("boku", 0x4b4d),
+       DEFTK("botan",        0x4b55),
+       DEFTK("botu", 0x4b56),
+       DEFTK("hotondo",      0x4b58),
+       DEFTK("hori", 0x4b59),
+       DEFTK("horo", 0x4b5a),
+       DEFTK("hon",  0x4b5b),
+       DEFTK("bon",  0x4b5e),
+
+       DEFTK("ma",   0x4b60),
+       DEFTK("mai",  0x4b64),
+       DEFTK("mairu",        0x4b69),
+       DEFTK("maki", 0x4b6a),
+       DEFTK("maku", 0x4b6b),
+       DEFTK("makura",       0x4b6d),
+       DEFTK("maguro",       0x4b6e),
+       DEFTK("masa", 0x4b6f),
+       DEFTK("masu", 0x4b70),
+       DEFTK("mata", 0x4b72),
+       DEFTK("matu", 0x4b75),
+       DEFTK("made", 0x4b78),
+       DEFTK("mama", 0x4b79),
+       DEFTK("mayu", 0x4b7a),
+       DEFTK("maro", 0x4b7b),
+       DEFTK("man",  0x4b7c),
+
+       DEFTK("mi",   0x4c23),
+       DEFTK("misaki",       0x4c28),
+       DEFTK("mitu", 0x4c29),
+       DEFTK("minato",       0x4c2b),
+       DEFTK("mino", 0x4c2c),
+       DEFTK("nen",  0x4c2d),        /* mino + ru */
+       DEFTK("myaku",        0x4c2e),
+       DEFTK("myou", 0x4c2f),
+       DEFTK("miri", 0x4c30),
+       DEFTK("min",  0x4c31),
+
+       DEFTK("mu",   0x4c33),
+       DEFTK("muku", 0x4c3a),
+       DEFTK("muko", 0x4c3b),
+       DEFTK("musume",       0x4c3c),
+
+       DEFTK("mei",  0x4c3d),
+       DEFTK("mesu", 0x4c46),
+       DEFTK("metu", 0x4c47),
+       DEFTK("men",  0x4c48),
+
+       DEFTK("mo",   0x4c4e),
+       DEFTK("mou",  0x4c51),
+       DEFTK("cho",  0x4c59),        /* mou + keru */
+       DEFTK("moku", 0x4c5a),
+       DEFTK("moti", 0x4c5e),
+       DEFTK("mottomo",      0x4c60),
+       DEFTK("rei",  0x4c61),        /* modo + ru */
+       DEFTK("momi", 0x4c62),
+       DEFTK("morai",        0x4c63),
+       DEFTK("mon",  0x4c64),
+       DEFTK("monme",        0x4c68),
+
+       DEFTK("ya",   0x4c69),
+       DEFTK("yaku", 0x4c71),
+       DEFTK("yasu", 0x4c77),
+       DEFTK("yanagi",       0x4c78),
+       DEFTK("yabu", 0x4c79),
+       DEFTK("yari", 0x4c7a),
+
+       DEFTK("yu",   0x4c7b),
+       DEFTK("yui",  0x4d23),
+       DEFTK("yuu",  0x4d24),
+
+       DEFTK("yo",   0x4d3d),
+       DEFTK("you",  0x4d43),
+       DEFTK("yoku", 0x4d5d),
+       DEFTK("yodo", 0x4d64),
+
+       DEFTK("ra",   0x4d65),
+       DEFTK("rai",  0x4d68),
+       DEFTK("raku", 0x4d6c),
+       DEFTK("ran",  0x4d70),
+
+       DEFTK("ri",   0x4d78),
+       DEFTK("riku", 0x4e26),
+       DEFTK("ritu", 0x4e27),
+       DEFTK("ryaku",        0x4e2b),
+       DEFTK("ryuu", 0x4e2d),
+       DEFTK("ryo",  0x4e37),
+       DEFTK("ryou", 0x4e3b),
+       DEFTK("ryoku",        0x4e4f),
+       DEFTK("rin",  0x4e51),
+
+       DEFTK("ru",   0x4e5c),
+       DEFTK("rui",  0x4e5d),
+
+       DEFTK("rei",  0x4e61),
+       DEFTK("reki", 0x4e71),
+       DEFTK("retu", 0x4e73),
+       DEFTK("ren",  0x4e77),
+
+       DEFTK("ro",   0x4f24),
+       DEFTK("rou",  0x4f2b),
+       DEFTK("roku", 0x4f3b),
+       DEFTK("ron",  0x4f40),
+
+       DEFTK("wa",   0x4f41),
+       DEFTK("wai",  0x4f44),
+       DEFTK("waki", 0x4f46),
+       DEFTK("waku", 0x4f47),
+       DEFTK("wasi", 0x4f49),
+       DEFTK("wataru",       0x4f4a),
+       DEFTK("sen",  0x4f4b),        /* wata + ru */
+       DEFTK("wani", 0x4f4c),
+       DEFTK("wabi", 0x4f4d),
+       DEFTK("wara", 0x4f4e),
+       DEFTK("warabi",       0x4f4f),
+       DEFTK("wan",  0x4f50),
+
+       DEFTK(NULL,     0x4f54),
+};
+#define        TANKANLISTSIZ   arraysize(tankanlist)
+
+
+static VOID NEAR roman2str(buf, s, size)
+char *buf, *s;
+ALLOC_T size;
+{
+       ALLOC_T ptr, len;
+       int i, n;
+
+       ptr = (ALLOC_T)0;
+       while (size) {
+#ifdef FAKEUNINIT
+               n = 0;          /* fake for -Wuninitialized */
+#endif
+               for (len = size; len > (ALLOC_T)0; len--)
+                       if ((n = searchroman(s, len)) >= 0) break;
+               if (len <= (ALLOC_T)0) {
+                       if (*s == 'n') ptr += jis2str(&(buf[ptr]), J_NN);
+                       else if (*s == '-') ptr += jis2str(&(buf[ptr]), J_CHO);
+                       else if (*s == *(s + 1))
+                               ptr += jis2str(&(buf[ptr]), J_TSU);
+
+                       s++;
+                       size--;
+                       continue;
+               }
+
+               for (i = 0; i < R_MAXKANA; i++) {
+                       if (!romanlist[n].code[i]) break;
+                       ptr += jis2str(&(buf[ptr]), romanlist[n].code[i]);
+               }
+               s += len;
+               size -= len;
+       }
+       buf[ptr] = '\0';
+}
+
+int main(argc, argv)
+int argc;
+char *argv[];
+{
+       FILE *fp;
+       char buf[MAXKANASTR + 1], kbuf[4 + 1], tbuf[sizeof(tankanstr) + 1];
+       u_short code;
+       int n, len;
+
+       if (argc < 2 || !(fp = fopen(argv[1], "wb"))) {
+               fprintf(stderr, "Cannot open file.\n");
+               return(1);
+       }
+
+       initroman();
+       for (n = len = 0; n < arraysize(tankanstr); n++)
+               len += jis2str(&(tbuf[len]), tankanstr[n]);
+       for (n = 0; n < TANKANLISTSIZ - 1; n++) {
+               if (!tankanlist[n].str) continue;
+               roman2str(buf, tankanlist[n].str, tankanlist[n].len);
+               code = tankanlist[n].code;
+               while (code < tankanlist[n + 1].code) {
+                       VOID_C jis2str(kbuf, code++);
+                       fprintf(fp, "%s %s %s %d\n", buf, kbuf, tbuf, DEFFREQ);
+                       while (!VALIDJIS(code)) if (++code >= J_MAX) break;
+               }
+       }
+       fclose(fp);
+
+       return(0);
+}
diff -urNP ../FD-2.08f/mkunitbl.c ./mkunitbl.c
--- ../FD-2.08f/mkunitbl.c      Tue Aug  8 00:00:00 2006
+++ ./mkunitbl.c        Tue Aug 22 00:00:00 2006
@@ -10206,6 +10206,16 @@
X };
X #define       MACUNILISTSIZ   arraysize(macunilist)
X 
+static nftable iconvunilist[] = {
+       {0x2225, {0x2016, 0}},
+       {0xff0d, {0x2212, 0}},
+       {0xff5e, {0x301c, 0}},
+       {0xffe0, {0x00a2, 0}},
+       {0xffe1, {0x00a3, 0}},
+       {0xffe2, {0x00ac, 0}},
+};
+#define        ICONVUNILISTSIZ arraysize(iconvunilist)
+
X static int cmpuni(vp1, vp2)
X CONST VOID_P vp1;
X CONST VOID_P vp2;
@@ -10315,10 +10325,11 @@
X 
X       if (fputunilist(unilist, UNILISTSIZ, fp) < 0) return(1);
X 
-       if (fputbyte(1, fp) < 0) return(1);
+       if (fputbyte(2, fp) < 0) return(1);
X       if (fputbyte(MAXNFLEN, fp) < 0) return(1);
X 
X       if (fputnflist(macunilist, MACUNILISTSIZ, fp) < 0) return(1);
+       if (fputnflist(iconvunilist, ICONVUNILISTSIZ, fp) < 0) return(1);
X 
X       fclose(fp);
X 
diff -urNP ../FD-2.08f/roman.c ./roman.c
--- ../FD-2.08f/roman.c Thu Jan  1 09:00:00 1970
+++ ./roman.c   Tue Aug 22 00:00:00 2006
@@ -0,0 +1,413 @@
+/*
+ *     roman.c
+ *
+ *     Roman translation
+ */
+
+#include "machine.h"
+#include <stdio.h>
+#include <string.h>
+
+#ifndef        NOUNISTDH
+#include <unistd.h>
+#endif
+
+#ifndef        NOSTDLIBH
+#include <stdlib.h>
+#endif
+
+#include "printf.h"
+#include "kctype.h"
+#include "roman.h"
+
+#define        R_MAXVOWEL      5
+#define        DEFRM(s,c)      {s, strsize(s), {((c) >> 8) & 0xff, (c) & 0xff}}
+#define        DEFRM2(s,c1,c2) {s, strsize(s), {(c1), (c2)}}
+
+typedef struct _voweltable {
+       int key;
+       u_char code[R_MAXVOWEL];
+} voweltable;
+
+#ifndef        CODEEUC
+extern char *kanjiconv2 __P_((char *, char *, int, int, int, int));
+#endif
+
+static int cmproman __P_((CONST VOID_P, CONST VOID_P));
+static int NEAR chgroman __P_((char *, int, u_short *));
+static int NEAR catroman __P_((int, int, CONST char *));
+static u_int NEAR jis2defcode __P_((u_int));
+static u_int NEAR defcode2jis __P_((char *));
+
+romantable *romanlist = NULL;
+int maxromanlist = 0;
+
+static CONST voweltable vowellist[] = {
+       {'\0', {'a', 'i', 'u', 'e', 'o'}},
+       {'y', {0x63, 0x23, 0x65, 0x27, 0x67}},
+       {'h', {0x63, 0x00, 0x65, 0x27, 0x67}},
+       {'l', {0x21, 0x23, 0x00, 0x27, 0x29}},
+       {'w', {0x21, 0x23, 0x25, 0x27, 0x29}},
+};
+#define        VOWELLISTSIZ    arraysize(vowellist)
+static CONST romantable origromanlist[] = {
+       DEFRM("a", 0x2200),
+       DEFRM("i", 0x2400),
+       DEFRM("u", 0x2600),
+       DEFRM("e", 0x2800),
+       DEFRM("o", 0x2a00),
+
+       DEFRM("ka", 0x2b00),  DEFRM("ga", 0x2c00),
+       DEFRM("ki", 0x2d00),  DEFRM("gi", 0x2e00),
+       DEFRM("ku", 0x2f00),  DEFRM("gu", 0x3000),
+       DEFRM("ke", 0x3100),  DEFRM("ge", 0x3200),
+       DEFRM("ko", 0x3300),  DEFRM("go", 0x3400),
+
+       DEFRM("sa", 0x3500),  DEFRM("za", 0x3600),
+       DEFRM("si", 0x3700),  DEFRM("zi", 0x3800),
+       DEFRM("su", 0x3900),  DEFRM("zu", 0x3a00),
+       DEFRM("se", 0x3b00),  DEFRM("ze", 0x3c00),
+       DEFRM("so", 0x3d00),  DEFRM("zo", 0x3e00),
+
+       DEFRM("ta", 0x3f00),  DEFRM("da", 0x4000),
+       DEFRM("ti", 0x4100),  DEFRM("di", 0x4200),
+       DEFRM("tu", 0x4400),  DEFRM("du", 0x4500),
+       DEFRM("te", 0x4600),  DEFRM("de", 0x4700),
+       DEFRM("to", 0x4800),  DEFRM("do", 0x4900),
+
+       DEFRM("na", 0x4a00),
+       DEFRM("ni", 0x4b00),
+       DEFRM("nu", 0x4c00),
+       DEFRM("ne", 0x4d00),
+       DEFRM("no", 0x4e00),
+
+       DEFRM("ha", 0x4f00),  DEFRM("ba", 0x5000),  DEFRM("pa", 0x5100),
+       DEFRM("hi", 0x5200),  DEFRM("bi", 0x5300),  DEFRM("pi", 0x5400),
+       DEFRM("hu", 0x5500),  DEFRM("bu", 0x5600),  DEFRM("pu", 0x5700),
+       DEFRM("he", 0x5800),  DEFRM("be", 0x5900),  DEFRM("pe", 0x5a00),
+       DEFRM("ho", 0x5b00),  DEFRM("bo", 0x5c00),  DEFRM("po", 0x5d00),
+
+       DEFRM("ma", 0x5e00),
+       DEFRM("mi", 0x5f00),
+       DEFRM("mu", 0x6000),
+       DEFRM("me", 0x6100),
+       DEFRM("mo", 0x6200),
+
+       DEFRM("ya", 0x6400),
+       DEFRM("yi", 0x2400),
+       DEFRM("yu", 0x6600),
+       DEFRM("ye", 0x2427),
+       DEFRM("yo", 0x6800),
+
+       DEFRM("ra", 0x6900),
+       DEFRM("ri", 0x6a00),
+       DEFRM("ru", 0x6b00),
+       DEFRM("re", 0x6c00),
+       DEFRM("ro", 0x6d00),
+
+       DEFRM("wa", 0x6f00),  DEFRM("wya", 0x6f63),
+       DEFRM("wi", 0x2623),  DEFRM("wyi", 0x7000),
+       DEFRM("wu", 0x2600),  DEFRM("wyu", 0x6f65),
+       DEFRM("we", 0x2627),  DEFRM("wye", 0x7100),
+       DEFRM("wo", 0x7200),  DEFRM("wyo", 0x6f67),
+
+       DEFRM("nn", 0x7300),  DEFRM("xn", 0x7300),
+       DEFRM("n'", 0x7300),
+       DEFRM("xtu", 0x4300), DEFRM("ltu", 0x4300),
+       DEFRM("xtsu", 0x4300),        DEFRM("ltsu", 0x4300),
+       DEFRM("xwa", 0x6e00), DEFRM("lwa", 0x6e00),
+
+       DEFRM2("xka", 0x2575, 0x00),  DEFRM2("lka", 0x2575, 0x00),
+       DEFRM2("xke", 0x2576, 0x00),  DEFRM2("lke", 0x2576, 0x00),
+
+       DEFRM("ca", 0x2b00),
+       DEFRM("ci", 0x3700),
+       DEFRM("cu", 0x2f00),
+       DEFRM("ce", 0x3b00),
+       DEFRM("co", 0x3300),
+};
+#define        ROMANLISTSIZ    arraysize(origromanlist)
+static CONST romantable catromanlist[] = {
+       {"ky",        'y', {0x242d}}, {"gy",        'y', {0x242e}},
+       {"sy",        'y', {0x2437}}, {"zy",        'y', {0x2438}},
+       {"ty",        'y', {0x2441}}, {"dy",        'y', {0x2442}},
+       {"ny",        'y', {0x244b}},
+       {"hy",        'y', {0x2452}}, {"by",        'y', {0x2453}}, {"py",        'y', {0x2454}},
+       {"my",        'y', {0x245f}},
+       {"xy",        'y', {0x0000}}, {"ly",        'y', {0x0000}},
+       {"ry",        'y', {0x246a}},
+       {"sh",        'h', {0x2437}}, {"j", 'h', {0x2438}},
+       {"jy",        'y', {0x2438}},
+       {"ch",        'h', {0x2441}},
+       {"cy",        'y', {0x2441}},
+       {"ts",        'l', {0x2444}},
+       {"th",        'y', {0x2446}}, {"dh",        'y', {0x2447}},
+       {"wh",        'l', {0x2426}},
+       {"f", 'l', {0x2455}}, {"v", 'l', {0x2574}},
+       {"fy",        'y', {0x2455}}, {"vy",        'y', {0x2574}},
+       {"q", 'l', {0x242f}},
+       {"qy",        'y', {0x242f}},
+       {"x", 'w', {0x0000}}, {"l", 'w', {0x0000}},
+       {"kw",        'w', {0x242f}}, {"gw",        'w', {0x2430}},
+       {"qw",        'w', {0x242f}},
+       {"sw",        'w', {0x2439}}, {"zw",        'w', {0x243a}},
+       {"tw",        'w', {0x2448}}, {"dw",        'w', {0x2449}},
+       {"hw",        'w', {0x2455}}, {"bw",        'w', {0x2456}}, {"pw",        'w', {0x2457}},
+       {"fw",        'w', {0x2455}}, {"vw",        'w', {0x2574}},
+};
+#define        CATROMANLISTSIZ arraysize(catromanlist)
+
+
+int code2kanji(buf, c)
+char *buf;
+u_int c;
+{
+       int n;
+
+       n = 0;
+       if ((buf[n] = ((c >> 8) & 0xff))) n++;
+       buf[n++] = (c & 0xff);
+       buf[n] = '\0';
+
+       return(n);
+}
+
+static int cmproman(vp1, vp2)
+CONST VOID_P vp1;
+CONST VOID_P vp2;
+{
+       romantable *rp1, *rp2;
+
+       rp1 = (romantable *)vp1;
+       rp2 = (romantable *)vp2;
+
+       return(strcmp(rp1 -> str, rp2 -> str));
+}
+
+int searchroman(s, len)
+char *s;
+int len;
+{
+       int i, n, min, max;
+
+       min = -1;
+       max = maxromanlist;
+       for (;;) {
+               n = (min + max) / 2;
+               if (n <= min || n >= max) return(-1);
+               if ((i = strncmp(s, romanlist[n].str, len)) > 0) min = n;
+               else if (i < 0 || len < romanlist[n].len) max = n;
+               else break;
+       }
+
+       return(n);
+}
+
+static int NEAR chgroman(str, len, kbuf)
+char *str;
+int len;
+u_short *kbuf;
+{
+       romantable *tmp;
+       int n;
+
+       if ((n = searchroman(str, len)) < 0) {
+               n = maxromanlist;
+               tmp = (romantable *)realloc(romanlist,
+                       (maxromanlist + 1) * sizeof(romantable));
+               if (!tmp) return(-1);
+               romanlist = tmp;
+               maxromanlist++;
+       }
+       else if (!kbuf) {
+               memmove((char *)(&romanlist[n]), (char *)(&romanlist[n + 1]),
+                       (--maxromanlist - n) * sizeof(romantable));
+               return(0);
+       }
+
+       strcpy(romanlist[n].str, str);
+       romanlist[n].len = len;
+       memcpy((char *)romanlist[n].code, (char *)kbuf,
+               R_MAXKANA * sizeof(u_short));
+
+       return(0);
+}
+
+static int NEAR catroman(key, top, s)
+int key, top;
+CONST char *s;
+{
+       u_short kbuf[R_MAXKANA];
+       char str[R_MAXROMAN + 1];
+       int i, j, n, len;
+
+       for (n = 1; n < VOWELLISTSIZ; n++) if (key == vowellist[n].key) break;
+       if (n >= VOWELLISTSIZ) return(-1);
+
+       for (i = 0; s[i]; i++) {
+               if (i >= sizeof(str) - 2) break;
+               str[i] = s[i];
+       }
+       len = i;
+       str[len + 1] = '\0';
+
+       for (i = 0; i < R_MAXVOWEL; i++) {
+               str[len] = vowellist[0].code[i];
+               memset((char *)kbuf, 0, sizeof(kbuf));
+               j = 0;
+               if (top) kbuf[j++] = top;
+               kbuf[j] = vowellist[n].code[i];
+               if (kbuf[j]) kbuf[j] |= 0x2400;
+
+               if (chgroman(str, len + 1, kbuf) < 0) return(-1);
+       }
+
+       return(0);
+}
+
+VOID initroman(VOID_A)
+{
+       int i, n;
+
+       if (romanlist) return;
+       if (!(romanlist = (romantable *)malloc(sizeof(origromanlist)))) return;
+
+       memcpy((char *)romanlist, (char *)origromanlist,
+               sizeof(origromanlist));
+       for (n = 0; n < ROMANLISTSIZ; n++) {
+               for (i = 0; i < R_MAXKANA; i++) {
+                       if (!romanlist[n].code[i]) continue;
+                       if (romanlist[n].code[i] & ~0xff) continue;
+                       romanlist[n].code[i] |= 0x2400;
+               }
+       }
+
+       maxromanlist = ROMANLISTSIZ;
+       for (i = 0; i < CATROMANLISTSIZ; i++) {
+               n = catroman(catromanlist[i].len,
+                       catromanlist[i].code[0], catromanlist[i].str);
+               if (n < 0) break;
+       }
+
+       qsort(romanlist, maxromanlist, sizeof(romantable), cmproman);
+}
+
+static u_int NEAR jis2defcode(c)
+u_int c;
+{
+#ifndef        CODEEUC
+       char *cp, buf[2 + 1], tmp[2 + 1];
+#endif
+
+       if (!(c & ~0xff)) {
+#ifdef CODEEUC
+               if (iskana2(c)) c |= (C_EKANA << 8);
+#endif
+               return(c);
+       }
+
+#ifdef CODEEUC
+       return(c | 0x8080);
+#else
+       VOID_C code2kanji(tmp, c | 0x8080);
+       cp = kanjiconv2(buf, tmp, 2, EUC, DEFCODE, L_INPUT);
+       if (kanjierrno) return(0);
+
+       return(((u_char)(cp[0]) << 8) | (u_char)(cp[1]));
+#endif /* !CODEEUC */
+}
+
+static u_int NEAR defcode2jis(buf)
+char *buf;
+{
+#ifndef        CODEEUC
+       char tmp[2 + 1];
+
+       buf = kanjiconv2(tmp, buf, 2, DEFCODE, EUC, L_INPUT);
+       if (kanjierrno) return((u_int)0);
+#endif
+       return((((u_char)(buf[0]) << 8) | (u_char)(buf[1])) & ~0x8080);
+}
+
+int jis2str(buf, c)
+char *buf;
+u_int c;
+{
+       int n;
+
+       if ((c & 0x8080) != 0x8080) n = 0;
+       else {
+               n = code2kanji(buf, jis2defcode((c >> 8) & 0xff));
+               c &= 0xff;
+       }
+       n += code2kanji(&(buf[n]), jis2defcode(c));
+
+       return(n);
+}
+
+int str2jis(kbuf, max, buf)
+u_short *kbuf;
+int max;
+char *buf;
+{
+       u_short w;
+       int i, j;
+
+       for (i = j = 0; buf[i] && j < max; i++) {
+               if (iskanji1(buf, i)) w = defcode2jis(&(buf[i++]));
+#ifdef CODEEUC
+               else if (isekana(buf, i)) w = buf[++i];
+#endif
+               else w = buf[i];
+               kbuf[j++] = w;
+       }
+
+       return(j);
+}
+
+int addroman(s, buf)
+char *s, *buf;
+{
+       char str[R_MAXROMAN + 1];
+       u_short kbuf[R_MAXKANA];
+       int i, j, len;
+
+       initroman();
+
+       if (!s) return(-1);
+       for (i = j = 0; s[i]; i++) {
+               if (!isprint2(s[i])) continue;
+               if (j >= sizeof(str) - 1) break;
+               str[j++] = tolower2(s[i]);
+       }
+       if (!j) return(-1);
+       str[j] = '\0';
+       len = j;
+
+       if (!buf) chgroman(str, len, NULL);
+       else {
+               memset((char *)kbuf, 0, sizeof(kbuf));
+               if (!str2jis(kbuf, arraysize(kbuf), buf)) return(-1);
+               chgroman(str, len, kbuf);
+       }
+
+       qsort(romanlist, maxromanlist, sizeof(romantable), cmproman);
+       return(0);
+}
+
+VOID freeroman(n)
+int n;
+{
+       romantable *tmp;
+
+       maxromanlist = 0;
+       if (n) {
+               tmp = (romantable *)realloc(romanlist, n * sizeof(romantable));
+               if (tmp) romanlist = tmp;
+       }
+       else if (romanlist) {
+               tmp = romanlist;
+               romanlist = NULL;
+               free(tmp);
+       }
+}
diff -urNP ../FD-2.08f/roman.h ./roman.h
--- ../FD-2.08f/roman.h Thu Jan  1 09:00:00 1970
+++ ./roman.h   Tue Aug 22 00:00:00 2006
@@ -0,0 +1,29 @@
+/*
+ *     roman.h
+ *
+ *     Roman translation tables
+ */
+
+#define        R_MAXROMAN      4
+#define        R_MAXKANA       2
+#define        J_MIN           0x2121
+#define        J_MAX           0x7e7e
+#define        J_CHO           0x213c
+#define        J_TSU           0x2443
+#define        J_NN            0x2473
+#define        VALIDJIS(c)     (iseuc((((c) >> 8) & 0xff) ^ 0x80) \
+                       && iseuc(((c) & 0xff) ^ 0x80))
+
+typedef struct _romantable {
+       char str[R_MAXROMAN + 1];
+       ALLOC_T len;
+       u_short code[R_MAXKANA];
+} romantable;
+
+extern int code2kanji __P_((char *, u_int));
+extern int searchroman __P_((char *, int));
+extern VOID initroman __P_((VOID_A));
+extern int jis2str __P_((char *, u_int));
+extern int str2jis __P_((u_short *, int, char *));
+extern int addroman __P_((char *, char *));
+extern VOID freeroman __P_((int));
diff -urNP ../FD-2.08f/shell.c ./shell.c
--- ../FD-2.08f/shell.c Tue Aug  8 00:00:00 2006
+++ ./shell.c   Tue Aug 22 00:00:00 2006
@@ -88,10 +88,10 @@
X #endif
X char *promptstr = NULL;
X char **history[2] = {NULL, NULL};
-char *histfile = NULL;
+char *histfile[2] = {NULL, NULL};
X short histsize[2] = {0, 0};
X short histno[2] = {0, 0};
-int savehist = 0;
+short savehist[2] = {0, 0};
X int n_args = 0;
X 
X static short histbufsize[2] = {0, 0};
@@ -665,6 +665,7 @@
X                               else if (c == 'C') code = CAP;
X                               else if (c == 'U') code = UTF8;
X                               else if (c == 'M') code = M_UTF8;
+                               else if (c == 'I') code = I_UTF8;
X #  ifndef     _NOKANJIFCONV
X                               else if (c == 'A') code = -1;
X #  endif
@@ -1633,8 +1634,8 @@
X       char *line;
X       int i, j, size;
X 
-       if (!histfile || !histfile[0]) return(0);
-       lck = lockfopen(histfile, "r", O_TEXT | O_RDONLY);
+       if (!histfile[n] || !histfile[n][0]) return(0);
+       lck = lockfopen(histfile[n], "r", O_TEXT | O_RDONLY);
X       if (!lck || !(lck -> fp)) {
X               lockclose(lck);
X               return(-1);
@@ -1683,15 +1684,17 @@
X       lockbuf_t *lck;
X       int i, size;
X 
-       if (!histfile || !histfile[0] || savehist <= 0) return(0);
+       if (!histfile[n] || !histfile[n][0] || savehist[n] <= 0) return(0);
X       if (!history[n] || !history[n][0]) return(-1);
-       lck = lockfopen(histfile, "w", O_TEXT | O_WRONLY | O_CREAT | O_TRUNC);
+       lck = lockfopen(histfile[n], "w",
+               O_TEXT | O_WRONLY | O_CREAT | O_TRUNC);
X       if (!lck || !(lck -> fp)) {
X               lockclose(lck);
X               return(-1);
X       }
X 
-       size = (savehist > (int)histsize[n]) ? (int)histsize[n] : savehist;
+       size = (savehist[n] > histsize[n])
+               ? (int)histsize[n] : (int)savehist[n];
X       for (i = size - 1; i >= 0; i--) convhistory(history[n][i], lck -> fp);
X       lockclose(lck);
X 
diff -urNP ../FD-2.08f/system.c ./system.c
--- ../FD-2.08f/system.c        Tue Aug  8 00:00:00 2006
+++ ./system.c  Tue Aug 22 00:00:00 2006
@@ -585,6 +585,9 @@
X #define       Kopen           Xopen
X #endif
X static VOID NEAR syntaxerror __P_((char *));
+#if    !MSDOS && defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+static VOID NEAR addmychild __P_((p_id_t));
+#endif
X #if   !MSDOS
X static VOID NEAR setstopsig __P_((int));
X static p_id_t NEAR makechild __P_((int, p_id_t, int));
@@ -975,6 +978,9 @@
X #endif
X static int isshellbuiltin = 0;
X static int execerrno = 0;
+#if    !MSDOS && defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+static p_id_t *mychildren = (p_id_t *)NULL;
+#endif
X 
X static CONST char *syntaxerrstr[] = {
X       NULL,
@@ -1276,7 +1282,8 @@
X       "FD_SJISPATH", "FD_EUCPATH",
X       "FD_JISPATH", "FD_JIS8PATH", "FD_JUNETPATH",
X       "FD_OJISPATH", "FD_OJIS8PATH", "FD_OJUNETPATH",
-       "FD_HEXPATH", "FD_CAPPATH", "FD_UTF8PATH", "FD_UTF8MACPATH",
+       "FD_HEXPATH", "FD_CAPPATH",
+       "FD_UTF8PATH", "FD_UTF8MACPATH", "FD_UTF8ICONVPATH",
X       "FD_NOCONVPATH",
X #  endif
X # else        /* !FD */
@@ -2041,6 +2048,9 @@
X static int NEAR trap_common(sig)
X int sig;
X {
+#if    !MSDOS && defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+       int n;
+#endif
X #if   !MSDOS
X       sigmask_t mask, omask;
X #endif
@@ -2090,7 +2100,7 @@
X               }
X #endif        /* SIGINT */
X       }
-       else if ((flags & TR_STAT) == TR_TERM) trapped = -1;
+       else if ((flags & TR_STAT) == TR_TERM) trapped = -1;
X 
X       if (trapped > 0) {
X               trapmode[sig] |= TR_CATCH;
@@ -2101,6 +2111,19 @@
X               fputnl(stderr);
X       }
X 
+#if    !MSDOS && defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+       if (mychildren && (flags & TR_STAT) == TR_TERM) {
+               for (n = 0; mychildren[n] >= (p_id_t)0; n++) {
+                       VOID_C kill(mychildren[n], sig);
+# ifdef        SIGCONT
+                       VOID_C kill(mychildren[n], SIGCONT);
+# endif
+               }
+               free(mychildren);
+               mychildren = NULL;
+       }
+#endif /* !MSDOS && FD && !_NOPTY && CYGWIN */
+
X       if (trapped < 0) {
X #if   !MSDOS
X               Xsigsetmask(omask);
@@ -2798,6 +2821,20 @@
X       return(ret);
X }
X 
+#if    !MSDOS && defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+static VOID NEAR addmychild(pid)
+p_id_t pid;
+{
+       int n;
+
+       n = 0;
+       if (mychildren) while (mychildren[n] >= (p_id_t)0) n++;
+       mychildren = (p_id_t *)realloc2(mychildren, (n + 2) * sizeof(p_id_t));
+       mychildren[n++] = pid;
+       mychildren[n] = (p_id_t)-1;
+}
+#endif /* !MSDOS && FD && !_NOPTY && CYGWIN */
+
X static VOID NEAR setstopsig(valid)
X int valid;
X {
@@ -2862,6 +2899,9 @@
X       if (pid) {
X               if (jobok) VOID_C setpgroup(pid, childpgrp);
X               if (tty && ttypgrp >= (p_id_t)0) ttypgrp = childpgrp;
+# if   defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+               if (parentfd >= 0) addmychild(pid);
+# endif
X       }
X       else {
X               if (jobok && setpgroup(mypid, childpgrp) < 0) {
@@ -2870,6 +2910,10 @@
X                       Xexit(RET_FATALERR);
X               }
X               if (tty) gettermio(childpgrp, jobok);
+# if   defined (FD) && !defined (_NOPTY) && defined (CYGWIN)
+               if (mychildren) free(mychildren);
+               mychildren = NULL;
+# endif
X       }
X # endif       /* !NOJOB */
X 
@@ -2889,7 +2933,7 @@
X #  endif
X       termioctl_t tty;
X       int i, j;
-# endif
+# endif        /* !NOJOB */
X       wait_pid_t w;
X       int ret;
X 
diff -urNP ../FD-2.08f/term.c ./term.c
--- ../FD-2.08f/term.c  Tue Aug  8 00:00:00 2006
+++ ./term.c    Tue Aug 22 00:00:00 2006
@@ -1364,7 +1364,7 @@
X 
X       buf[0] = '\0';
X       do {
-               if (!kbhit2(1000000L * 5)) break;
+               if (!kbhit2(WAITKEYPAD * 10000L)) break;
X # if  MSDOS
X               buf[0] = bdos(0x07, 0x00, 0);
X # else
diff -urNP ../FD-2.08f/termemu.c ./termemu.c
--- ../FD-2.08f/termemu.c       Tue Aug  8 00:00:00 2006
+++ ./termemu.c Tue Aug 22 00:00:00 2006
@@ -40,6 +40,7 @@
X char *ptytmpfile = NULL;
X 
X static VOID NEAR doscroll __P_((int, int, int, int));
+static VOID NEAR closeallpty __P_((int));
X static int NEAR genbackend __P_((VOID_A));
X static VOID NEAR sendvar __P_((int, char **));
X #ifndef       _NOORIGSHELL
@@ -143,6 +144,17 @@
X       return(readselect(max, fds, result, t));
X }
X 
+static VOID NEAR closeallpty(n)
+int n;
+{
+       int i;
+
+       for (i = 0; i < n; i++) {
+               safeclose(ptylist[i].fd);
+               ptylist[i].fd = -1;
+       }
+}
+
X static int NEAR genbackend(VOID_A)
X {
X       char path[MAXPATHLEN];
@@ -166,11 +178,10 @@
X       if (i < MAXWINDOWS || (pid = Xfork()) < (p_id_t)0) {
X               safeclose(fds[0]);
X               safeclose(fds[1]);
+               closeallpty(i);
X               while (--i >= 0) {
X                       free(ptylist[i].path);
X                       ptylist[i].path = NULL;
-                       safeclose(ptylist[i].fd);
-                       ptylist[i].fd = -1;
X               }
X               return(-1);
X       }
@@ -190,17 +201,18 @@
X               resetptyterm(i, 1);
X 
X               backend();
-               for (i = 0; i < MAXWINDOWS; i++) safeclose(ptylist[i].fd);
+               closeallpty(MAXWINDOWS);
X               _exit(0);
X       }
X 
X       safeclose(fds[0]);
X       emufd = newdup(fds[1]);
X       emupid = pid;
-       for (i = 0; i < MAXWINDOWS; i++) {
-               safeclose(ptylist[i].fd);
-               ptylist[i].fd = -1;
-       }
+#ifdef CYGWIN
+       for (i = 0; i < MAXWINDOWS; i++) ptylist[i].fd = newdup(ptylist[i].fd);
+#else
+       closeallpty(MAXWINDOWS);
+#endif
X 
X       return(0);
X }
@@ -536,6 +548,9 @@
X #if   !defined (_NOORIGSHELL) && !defined (NOJOB)
X               case TE_CHANGESTATUS:
X #endif
+#ifndef        _NOIME
+               case TE_FREEROMAN:
+#endif
X                       n = va_arg(args, int);
X                       sendbuf(fd, &n, sizeof(n));
X                       break;
@@ -583,6 +598,14 @@
X                       sendbuf(fd, &val, sizeof(val));
X                       if (n >= 0 && duptty[n]) sendbuf(fd, duptty[n], val);
X                       break;
+#ifndef        _NOIME
+               case TE_ADDROMAN:
+                       cp = va_arg(args, char *);
+                       func1 = va_arg(args, char *);
+                       sendstring(fd, cp);
+                       sendstring(fd, func1);
+                       break;
+#endif
X               case TE_INTERNAL:
X                       n = va_arg(args, int);
X                       cp = va_arg(args, char *);
@@ -673,17 +696,19 @@
X {
X       int i, n;
X 
-       if (parentfd < 0 && emufd < 0) {
+       if (parentfd < 0) {
+               changewin(MAXWINDOWS, (p_id_t)-1);
X               if (ptymode) {
X                       hideclock = 2;
X                       warning(0, NOPTY_K);
X               }
+               killpty(win, NULL);
X               for (i = 0; i < MAXWINDOWS; i++) if (ptylist[i].pid) break;
X               if (i < MAXWINDOWS) {
X                       hideclock = 2;
X                       if (!yesno(KILL_K)) return(-1);
-                       killallpty();
X               }
+               killallpty();
X       }
X 
X       if (flags & F_DOSYSTEM) n = dosystem(command);
@@ -699,6 +724,9 @@
X char *command, *arg;
X int flags;
X {
+#if    !defined (_NOORIGSHELL) && !defined (NOJOB)
+       char *command2, *arg2;
+#endif
X       p_id_t pid;
X       char *tty, *ws, path[MAXPATHLEN], buf[TIO_BUFSIZ + TIO_WINSIZ];
X       u_char uc;
@@ -763,6 +791,9 @@
X #ifndef       _NOORIGSHELL
X               mypid = getpid();
X #endif
+#ifdef CYGWIN
+               closeallpty(MAXWINDOWS);
+#endif
X               if (Xlogin_tty(ptylist[win].path, tty, ws) < 0) _exit(1);
X #ifndef       _NOORIGSHELL
X               if (isshptymode()) /*EMPTY*/;
@@ -799,6 +830,9 @@
X               uc = '\n';
X               sendbuf(parentfd, &uc, sizeof(uc));
X 
+#if    !defined (_NOORIGSHELL) && !defined (NOJOB)
+               command2 = arg2 = NULL;
+#endif
X               for (;;) {
X                       syncptyout(-1, -1);
X                       setlinecol();
@@ -811,7 +845,9 @@
X                       if (i >= maxjobs) break;
X                       VOID_C signal2(SIGHUP, (sigcst_t)trap_hup);
X                       sendparent(TE_CHANGESTATUS, n);
-                       if (recvmacro(&command, &arg, &flags) < 0) break;
+                       if (recvmacro(&command2, &arg2, &flags) < 0) break;
+                       command = command2;
+                       arg = arg2;
X #endif        /* !_NOORIGSHELL && !NOJOB */
X               }
X 
@@ -843,8 +879,9 @@
X               VOID_C waitstatus(ptylist[n].pid, 0, statusp);
X               ptylist[n].pid = (p_id_t)0;
X               ptylist[n].status = 0;
-               changewin(n, (p_id_t)0);
X       }
+       changewin(n, (p_id_t)0);
+       changewin(MAXWINDOWS, (p_id_t)-1);
X 
X       safeclose(ptylist[n].pipe);
X       ptylist[n].pipe = -1;
@@ -862,6 +899,9 @@
X               }
X       }
X 
+#ifdef CYGWIN
+       closeallpty(MAXWINDOWS);
+#endif
X       if (emupid) {
X               VOID_C kill(emupid, SIGHUP);
X #ifdef        SIGCONT
@@ -889,7 +929,6 @@
X       if (waitstatus(ptylist[n].pid, WNOHANG, &status) < 0) return(0);
X       ptylist[n].pid = (p_id_t)0;
X       ptylist[n].status = status;
-       changewin(n, (p_id_t)0);
X       killpty(n, &status);
X 
X       return(-1);
@@ -901,11 +940,7 @@
X 
X       n = 0;
X       for (i = 0; i < MAXWINDOWS; i++) if (checkpty(i) < 0) n = -1;
-       if (n < 0) {
-               changewin(MAXWINDOWS, (p_id_t)-1);
-               return(-1);
-       }
X 
-       return(0);
+       return(n);
X }
X #endif        /* !_NOPTY */
diff -urNP ../FD-2.08f/termemu.h ./termemu.h
--- ../FD-2.08f/termemu.h       Tue Aug  8 00:00:00 2006
+++ ./termemu.h Tue Aug 22 00:00:00 2006
@@ -64,5 +64,7 @@
X #define       TE_LOCKFRONT            25
X #define       TE_UNLOCKFRONT          26
X #define       TE_SAVETTYIO            27
-#define        TE_INTERNAL             28
+#define        TE_ADDROMAN             28
+#define        TE_FREEROMAN            29
+#define        TE_INTERNAL             30
X #define       TE_CHANGESTATUS         99
diff -urNP ../FD-2.08f/types.h ./types.h
--- ../FD-2.08f/types.h Tue Aug  8 00:00:00 2006
+++ ./types.h   Tue Aug 22 00:00:00 2006
@@ -281,10 +281,13 @@
X 
X extern winvartable winvar[];
X #ifdef        _NOSPLITWIN
-#define        win                     0
X #define       windows                 1
X #else
X extern int windows;
+#endif
+#if    defined (_NOSPLITWIN) && defined (_NOPTY)
+#define        win                     0
+#else
X extern int win;
X #endif
X #ifndef       _NOARCHIVE
diff -urNP ../FD-2.08f/version.h ./version.h
--- ../FD-2.08f/version.h       Tue Aug  8 00:00:00 2006
+++ ./version.h Tue Aug 22 00:00:00 2006
@@ -5,4 +5,4 @@
X  */
X 
X char *distributor = NULL;
-static char version[] = "@(#)fd.c  2.08f 08/08/06";
+static char version[] = "@(#)fd.c  2.09 08/22/06";
SHAR_EOF
  $echo 'File' 'FD-2.09.patch' 'is complete' &&
  $shar_touch -am 08210025106 'FD-2.09.patch' &&
  chmod 0644 'FD-2.09.patch' ||
  $echo 'restore of' 'FD-2.09.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.09.patch:' 'MD5 check failed'
e91c348bb87b1c91a948c4ee3fbb58b6  FD-2.09.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'FD-2.09.patch'`"
    test 493669 -eq "$shar_count" ||
    $echo 'FD-2.09.patch:' 'original size' '493669,' 'current size' "$shar_count!"
  fi
fi
$echo 'You have unpacked the last part'
rm -fr _sh00904
exit 0
-- 
                                               しらい たかし