しらいです。

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

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

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is `FD-2.08e.shar.03' (part 3 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" != 3; 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 &&
@@ -1590,7 +1589,7 @@
X                    registered for the drive name _^Hc.  (^H(U^HUN^HNI^HIX^HX)^H)
X 
X                    If _^Hc is omitted, all of the registered floppy
-                   drives are listed.
+                   drives is listed.
X 
X      p^Hpr^Hri^Hin^Hnt^Htl^Hla^Hau^Hun^Hnc^Hch^Hh [_^He_^Hx_^Ht]
X                    Print the command macro registered as the
@@ -1599,7 +1598,7 @@
X                    for listing is also printed.
X 
X                    If _^He_^Hx_^Ht is omitted, all of the registered
-                   launchers are listed.
+                   launchers is listed.
X 
X      p^Hpu^Hus^Hsh^Hhd^Hd [_^Hd_^Hi_^Hr]   Load the current directory onto the directory
X                    stack, and change the current directory in f^Hfd^Hd
@@ -1656,7 +1655,7 @@
X                    the value of _^HN_^HA_^HM_^HE the internal variable is
X                    defined as a null.  If no argument is
X                    specified, all of the readonly internal vari-
-                   ables are listed.
+                   ables is listed.
X 
X      r^Hrd^Hd _^Hd_^Hi_^Hr        Delete the directory _^Hd_^Hi_^Hr.  You cannot delete
X                    the non-empty directory.
@@ -1767,7 +1766,7 @@
X                              Same as -^H-x^Hx.
X                         If _^Ho_^Hp_^Ht_^Hi_^Ho_^Hn is omitted, the values of the
X                         current options are displayed.
-                   -^H-P^HP   c^Hcd^Hd and p^Hpw^Hwd^Hd the builtin command use the
+                   -^H-P^HP   C^HCd^Hd and p^Hpw^Hwd^Hd the builtin command use the
X                         physical directory structure instead of
X                         the logical directory structure following
X                         symbolic links.
@@ -1850,7 +1849,7 @@
X                    specify _^Hc_^Ho_^Hm as a null, the signal ignored.
X                    When you specify _^Hn as 0^H0, the command _^Hc_^Ho_^Hm is
X                    executed on exit.  If both _^Hc_^Ho_^Hm and _^Hn are omit-
-                   ted, all of the registered traps are listed.
+                   ted, all of the registered traps is listed.
X 
X      t^Htr^Hru^Hue^He          Only return with a 0^H0 exit status.
X 
@@ -1870,7 +1869,7 @@
X                    When you don't specify neither of them, both
X                    limits are set.  If _^Hn is omitted, the current
X                    limit is displayed.  When you specify -^H-a^Ha, all
-                   of the resource limits are displayed.
+                   of the resource limits is displayed.
X 
X                    When you specify the following options, the
X                    each resource limit is individually set or
@@ -1893,9 +1892,9 @@
X 
X      u^Hun^Hna^Hal^Hli^Hia^Has^Hs _^Hn_^Ha_^Hm_^He  Cancel the definition of the alias _^Hn_^Ha_^Hm_^He.  You
X                    can use the wildcard in _^Hn_^Ha_^Hm_^He, in this case,
-                   all of the matched alias definitions are can-
-                   celed.  When you specify "*", all of the alias
-                   definitions are invalid.
+                   all of the matched alias definitions is cancel-
+                   ed.  When you specify "*", all of the alias
+                   definitions is invalid.
X 
X      u^Hun^Hns^Hse^Het^Ht [_^HN_^HA_^HM_^HE ...]
X                    Delete the defined internal variable or func-
@@ -1907,7 +1906,7 @@
X      u^Hun^Hns^Hse^Het^Htd^Hdr^Hrv^Hv _^Hc _^Hd_^He_^Hv_^Hi_^Hc_^He _^Hh_^Hd _^Hs_^Hc _^Hc_^Hl
X                    Delete the registered floppy drive.  Only the
X                    registration with which all of _^Hd_^He_^Hv_^Hi_^Hc_^He, _^Hh_^Hd, _^Hs_^Hc,
-                   _^Hc_^Hl are corresponded is deleted, then you
+                   _^Hc_^Hl is corresponded is deleted, then you
X                    should confirm to delete very well.  (^H(U^HUN^HNI^HIX^HX)^H)
X 
X                    When it is registered as H^HHD^HDD^HD or H^HHD^HDD^HD9^H98^H8 in
@@ -2289,17 +2288,17 @@
X      The following is replaced only in the shell which is exe-
X      cuted by E^HEX^HXE^HEC^HCU^HUT^HTE^HE_S^HSH^HH and E^HEX^HXE^HEC^HCU^HUT^HTE^HE_F^HFI^HIL^HLE^HE.
X 
-     `^H`_^Hl_^Hi_^Hs_^Ht`^H`  _^Hl_^Hi_^Hs_^Ht is executed and this string is replaced by its
+     `^H`_^Hl_^Hi_^Hs_^Ht`^H`  _^HL_^Hi_^Hs_^Ht is executed and this string is replaced by its
X              standard output.
X 
-     $^H$(^H(_^Hl_^Hi_^Hs_^Ht)^H) _^Hl_^Hi_^Hs_^Ht is executed and this string is replaced by its
+     $^H$(^H(_^Hl_^Hi_^Hs_^Ht)^H) _^HL_^Hi_^Hs_^Ht is executed and this string is replaced by its
X              standard output like as `^H`_^Hl_^Hi_^Hs_^Ht`^H`.  This differs from
X              `^H`_^Hl_^Hi_^Hs_^Ht`^H` in the point that nested expressions are
X              allowed.  And any meta-characters such as quotes in
X              _^Hl_^Hi_^Hs_^Ht are evaluated as it is.
X 
X      $^H$(^H((^H(_^He_^Hx_^Hp_^Hr_^He_^Hs_^Hs_^Hi_^Ho_^Hn)^H))^H)
-             _^He_^Hx_^Hp_^Hr_^He_^Hs_^Hs_^Hi_^Ho_^Hn the arithmetic expression is evaluated
+             _^HE_^Hx_^Hp_^Hr_^He_^Hs_^Hs_^Hi_^Ho_^Hn the arithmetic expression is evaluated
X              and this string is replaced by its result value.
X              You can specify numeric values, variables and
X              integral calculations with the following operators
@@ -2362,7 +2361,7 @@
X                  ^^H^M^HM   = R^HRe^Het^Htu^Hur^Hrn^Hn  ^^H^I^HI   = T^HTa^Hab^Hb     ^^H^H^HH   = B^HBs^Hs
X                  ^^H^[^H[   = E^HEs^Hsc^Hc
X 
-     v^Hvi^Hi      v^Hvi^Hi mode has the 2 local modes: "insert mode" and
+     v^Hvi^Hi      V^HVi^Hi mode has the 2 local modes: "insert mode" and
X              "command mode", and the function of keys are quite
X              different with each mode.  You are in the command
X              mode when you start to input, then you must input
@@ -2713,7 +2712,7 @@
X                    ing the screen size.  If no value is set, this
X                    value will remain unset.
X 
-     C^HCO^HOM^HMS^HSP^HPE^HEC^HC*      Specify the shell used to invoke a batch file.
+     C^HCO^HOM^HMS^HSP^HPE^HEC^HC       Specify the shell used to invoke a batch file.
X                    If undefined, the shell defined by S^HSH^HHE^HEL^HLL^HL the
X                    environment variable or \COMMAND.COM is used.
X                    (^H(D^HDO^HOS^HS)^H)
@@ -2745,7 +2744,7 @@
X                        H^HHE^HEX^HX, h^Hhe^Hex^Hx       HEX
X                        C^HCA^HAP^HP, c^Hca^Hap^Hp       CAP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X                        default        no convert
X 
X      D^HDI^HIR^HRC^HCO^HOU^HUN^HNT^HTL^HLI^HIM^HMI^HIT^HT Specify the maximum number of files read from
@@ -2861,7 +2860,7 @@
X                        H^HHE^HEX^HX, h^Hhe^Hex^Hx       HEX
X                        C^HCA^HAP^HP, c^Hca^Hap^Hp       CAP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X                        default        no convert
X 
X      H^HHI^HIS^HST^HTF^HFI^HIL^HLE^HE      Specify the name of the command history file
@@ -2911,7 +2910,7 @@
X                        S^HSJ^HJI^HIS^HS, s^Hsj^Hji^His^Hs     Shift JIS
X                        E^HEU^HUC^HC, e^Heu^Huc^Hc       EUC-JP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X 
X      L^HLA^HAN^HNG^HGU^HUA^HAG^HGE^HE      Specify the language for display character.
X                    It means not only each messages displayed by
@@ -2931,7 +2930,7 @@
X                        O^HOJ^HJI^HIS^HS8^H8, o^Hoj^Hji^His^Hs8^H8   8bit JIS (JIS C6226-1978 + roman)
X                        O^HOJ^HJU^HUN^HNE^HET^HT, o^Hoj^Hju^Hun^Hne^Het^Ht ISO-2022-JP (JIS C6226-1978 + roman)
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X                        E^HEN^HNG^HG, e^Hen^Hng^Hg, C^HC    English (message only)
X                        default        no convert
X 
@@ -3079,7 +3078,7 @@
X                        S^HSJ^HJI^HIS^HS, s^Hsj^Hji^His^Hs     Shift JIS
X                        E^HEU^HUC^HC, e^Heu^Huc^Hc       EUC-JP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X                        default        no convert
X 
X      P^HPT^HTY^HYM^HME^HEN^HNU^HUK^HKE^HEY^HY    Specify the key to open the pseudo terminal
@@ -3089,13 +3088,13 @@
X                    items in the pseudo terminal menu: "SendAsIs",
X                    "InputCode", "Break" and "NextWindow".  Each
X                    item means respectively: sending the pseudo
-                   terminal menu key as is, inputing the key name
-                   to be sent like as b^Hbi^Hin^Hnd^Hd command, terminating
-                   forcedly the process running in the pseudo ter-
-                   minal, changing to the next window.  But you
-                   cannot select "NextWindow" in the non-split
-                   window mode.  The default value is not speci-
-                   fied.  (^H(U^HUN^HNI^HIX^HX)^H)
+                   terminal menu key as is, inputting the key
+                   name to be sent like as b^Hbi^Hin^Hnd^Hd command, terminat-
+                   ing forcedly the process running in the pseudo
+                   terminal, changing to the next window.  But
+                   you cannot select "NextWindow" in the non-
+                   split window mode.  The default value is not
+                   specified.  (^H(U^HUN^HNI^HIX^HX)^H)
X 
X      P^HPT^HTY^HYM^HMO^HOD^HDE^HE       Use the pseudo terminal to invoke external com-
X                    mands.  In the split window mode, the independ-
@@ -3121,7 +3120,7 @@
X                        S^HSJ^HJI^HIS^HS, s^Hsj^Hji^His^Hs     Shift JIS
X                        E^HEU^HUC^HC, e^Heu^Huc^Hc       EUC-JP
X                        U^HUT^HTF^HF8^H8, u^Hut^Htf^Hf8^H8     UTF-8
-                       u^Hut^Htf^Hf8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
+                       U^HUT^HTF^HF8^H8-^H-m^Hma^Hac^Hc, m^Hma^Hac^Hc  UTF-8 for Mac OS X
X                        default        no convert
X 
X      P^HPT^HTY^HYT^HTE^HER^HRM^HM       Specify the value of T^HTE^HER^HRM^HM the environment vari-
@@ -3183,7 +3182,7 @@
X                    time will be occurred in this span.  Any value
X                    except 0^H0 and null effects valid.
X 
-     S^HSH^HHE^HEL^HLL^HL*        When the filename part of this specified value
+     S^HSH^HHE^HEL^HLL^HL         When the filename part of this specified value
X                    is r^Hrf^Hfd^Hd or r^Hrf^Hfd^Hds^Hsh^Hh, the shell becomes a res-
X                    tricted shell as well as -^H-r^Hr option when
X                    invoked.  This variable also specify the shell
@@ -3236,11 +3235,11 @@
X                    strange terminal display and key input.
X 
X      T^HTH^HHR^HRU^HUA^HAR^HRG^HGS^HS      Pass through the pathnames as is, which is
-                   specified as the startup arguments.  f^Hfd^Hd ex-
+                   specified as the startup arguments.  F^HFd^Hd ex-
X                    pands the meta character such as ~^H~ and $^H${^H{#^H#}^H} in
X                    the given pathname by itself, because the ob-
X                    solete low-level shell cannot support these
-                   expansion extended by POSIX.  f^Hfd^Hd can sometimes
+                   expansion extended by POSIX.  F^HFd^Hd can sometimes
X                    expand the pathname given by the shell into
X                    the unexpected string as a result of duplicate
X                    expansion, because the latest high-level shell
@@ -3329,7 +3328,7 @@
X                    specified by default.  (^H(U^HUN^HNI^HIX^HX)^H)
X 
X M^HMU^HUL^HLT^HTI^HI L^HLA^HAN^HNG^HGU^HUA^HAG^HGE^HE S^HSU^HUP^HPP^HPO^HOR^HRT^HT
-     f^Hfd^Hd processes the Kanji character-set to input/output as
+     F^HFd^Hd processes the Kanji character-set to input/output as
X      "EUC-JP" or "Shift JIS" according to setting in compile.
X      The the pathname including Kanji is displayed in considera-
X      tion for the 2nd byte character in Kanji.  You can dynami-
@@ -3355,7 +3354,7 @@
X      Takashi SHIRAI <shirai@unixusers.net>
X      The original "FD" for MS-DOS was created and released by
X      A.Idei <SDI00544@niftyserve.or.jp> for the first time, in
-     1989.  f^Hfd^Hd was created for UNIX from scratch following that
+     1989.  F^HFd^Hd was created for UNIX from scratch following that
X      implementation, in 1995.
X 
X F^HFI^HIL^HLE^HES^HS
diff -urNP ../FD-2.08d/fd_e.man ./fd_e.man
--- ../FD-2.08d/fd_e.man        Tue Jun 13 00:00:00 2006
+++ ./fd_e.man  Fri Jul 28 00:00:00 2006
@@ -2,9 +2,9 @@
X .\" Copyright (C) 1995-2006 Takashi SHIRAI
X .\"                    <shirai@unixusers.net>
X .\"
-.\" @(#)fd.1   2.08d 06/13/06
+.\" @(#)fd.1   2.08e 07/28/06
X .\"   fd - File & Directory maintenance tool
-.TH FD 1 "June 13, 2006"
+.TH FD 1 "July 28, 2006"
X .de sh
X .br
X .PP
@@ -32,14 +32,14 @@
X .I args
X ]
X .SH DESCRIPTION
-.B fd
+.B Fd
X is a file & directory maintenance tool
X considered for the text terminals on general UNIX.
X It aims for a clone of the same named utility
X which is made for the PC/AT compatible machine and PC-9800 series.
X In fact, it is upper compatible functionally.
X 
-.B fd
+.B Fd
X shows the browser screen listing files when you have invoked it.
X You can input some key which is bound each command,
X to execute various operations.
@@ -147,7 +147,7 @@
X .B set
X the builtin command are available.
X .SS Screen Layout
-.B fd
+.B Fd
X has the 3 major screen modes.
X In the browser screen,
X you can select from the file list and execute each command.
@@ -539,7 +539,7 @@
X reverses the attribute on the position.
X You should notice that
X the attribute of the execution bit is not a binary toggle but a triple toggle,
-which includes setuid bit, setgid bit, and sticky bit respectively.
+which includes setuid bit, setgid bit and sticky bit respectively.
X If the target is the marked files,
X .RB [ m ](Mask)
X will mask a bit on the cursor position with
@@ -664,11 +664,11 @@
X .IP "\fBBackup tape\fP (Backup)"
X Backup the file on the cursor position into the specified storage device.
X When the cursor position indicates a directory,
-all of its contents are backuped.
+all of its contents is backuped.
X When some files are marked,
X the target is not the file on the cursor position but the marked files.
X 
-.BR tar (1)
+.BR Tar (1)
X is used for backup.
X When you specify the filename except special files indicates devices
X as input of the device name,
@@ -684,7 +684,7 @@
X .IP "\fBPack file\fP (Pack)"
X Pack the file on the cursor position into the specified archive file.
X When the cursor position indicates a directory,
-all of its contents are packed into the archive file.
+all of its contents is packed into the archive file.
X When some files are marked,
X the target is not the file on the cursor position but the marked files.
X 
@@ -1126,7 +1126,7 @@
X it is referred as continuing into the next line,
X so that you can split a long line with this.
X .SS Builtin Commands
-.B fd
+.B Fd
X has the following builtin commands.
X These builtin commands can be used in
X .B EXECUTE_SH
@@ -1331,7 +1331,7 @@
X .PD
X Read and evaluate commands from
X .IR file .
-.I file
+.I File
X must exists on the directory which
X .B PATH
X includes,
@@ -1843,7 +1843,7 @@
X .RE
X .IP "\fBdirs\fP"
X Display the list of the current directory stack.
-.B pushd
+.B Pushd
X and
X .B popd
X the builtin command can load/unload directories onto the directory stack.
@@ -1892,7 +1892,7 @@
X If
X .I arg
X is omitted,
-all of the enabled or disabled builtin commands are listed.
+all of the enabled or disabled builtin commands is listed.
X .IP "\fBeval\fP [\fIarg\fR .\|.\|.]"
X Evaluate
X .I arg
@@ -1952,7 +1952,7 @@
X If no argument is specified,
X all of the
X .BR export ed
-environment variables are listed.
+environment variables is listed.
X When you want to delete the definition of the environment variable,
X you can use
X .B unset
@@ -1963,7 +1963,7 @@
X exit status.
X .IP "\fBfc\fP [\fB\-l\fP | \fB\-s\fP [\fIold\fR\fB=\fP\fInew\fR .\|.\|.]] [\fB\-nr \fP] [\fB\-e\fP \fIeditor\fR] [\fIfirst\fR [\fIlast\fR]]"
X List or edit command histories.
-.I first
+.I First
X and
X .I last
X select the range of command histories.
@@ -2216,7 +2216,7 @@
X .B \-r
X instead of
X .IR com ,
-all the memorized hash table are discarded.
+all the memorized hash table is discarded.
X If
X .I com
X is omitted,
@@ -2244,7 +2244,7 @@
X If
X .I n
X is omitted,
-all of the memorized command histories are listed.
+all of the memorized command histories is listed.
X .IP "\fBjobs\fP"
X List the running jobs.
X .B (UNIX)
@@ -2332,7 +2332,7 @@
X and
X .I c
X are omitted,
-all of the mappings for special keys are listed.
+all of the mappings for special keys is listed.
X When you specify
X .I str
X as \fB"\|"\fP,
@@ -2348,7 +2348,7 @@
X or
X to the job indicated by
X .IR job .
-.I signal
+.I Signal
X is described as a numeric value or a signal name.
X 
X If
@@ -2480,7 +2480,7 @@
X If
X .I ext
X is omitted,
-all of the registered archiver commands are listed.
+all of the registered archiver commands is listed.
X .IP "\fBprintbind\fP [\fIc\fR]"
X Print the command binded to the key
X .IR c .
@@ -2490,7 +2490,7 @@
X If
X .I c
X is omitted,
-all of the registered key bindings are listed,
+all of the registered key bindings is listed,
X which is defined not as the internal command but as the command macro.
X The key bindings of internal commands can be referred in
X .BR HELP_MESSAGE .
@@ -2503,7 +2503,7 @@
X If
X .I c
X is omitted,
-all of the registered floppy drives are listed.
+all of the registered floppy drives is listed.
X .IP "\fBprintlaunch\fP [\fIext\fR]"
X Print the command macro registered as the launcher for
X .I ext
@@ -2514,7 +2514,7 @@
X If
X .I ext
X is omitted,
-all of the registered launchers are listed.
+all of the registered launchers is listed.
X .IP "\fBpushd\fP [\fIdir\fR]"
X Load the current directory onto the directory stack,
X and change the current directory in
@@ -2603,7 +2603,7 @@
X .I NAME
X the internal variable is defined as a null.
X If no argument is specified,
-all of the readonly internal variables are listed.
+all of the readonly internal variables is listed.
X .IP "\fBrd\fP \fIdir\fR"
X Delete the directory
X .IR dir .
@@ -2778,7 +2778,7 @@
X the values of the current options are displayed.
X .RE
X .IP "\fB\-P\fP"
-.B cd
+.B Cd
X and
X .B pwd
X the builtin command use the physical directory structure
@@ -2917,7 +2917,7 @@
X and
X .I n
X are omitted,
-all of the registered traps are listed.
+all of the registered traps is listed.
X .IP "\fBtrue\fP"
X Only return with a
X .B 0
@@ -2953,7 +2953,7 @@
X the current limit is displayed.
X When you specify
X .BR \-a ,
-all of the resource limits are displayed.
+all of the resource limits is displayed.
X 
X When you specify the following options,
X the each resource limit is individually set or displayed.
@@ -2999,9 +2999,9 @@
X You can use the wildcard in
X .IR name ,
X in this case,
-all of the matched alias definitions are canceled.
+all of the matched alias definitions is canceled.
X When you specify "\(**",
-all of the alias definitions are invalid.
+all of the alias definitions is invalid.
X .IP "\fBunset\fP [\fINAME\fR .\|.\|.]"
X Delete the defined internal variable or function for each
X .IR NAME .
@@ -3023,7 +3023,7 @@
X .IR hd ,
X .IR sc ,
X .I cl
-are corresponded is deleted,
+is corresponded is deleted,
X then you should confirm to delete very well.
X .B (UNIX)
X 
@@ -3665,11 +3665,11 @@
X and
X .BR EXECUTE_FILE .
X .IP "\fB`\fP\fIlist\fR\fB`\fP" 8
-.I list
+.I List
X is executed
X and this string is replaced by its standard output.
X .IP "\fB$(\fP\fIlist\fR\fB)\fP"
-.I list
+.I List
X is executed
X and this string is replaced by its standard output like as \fB`\fP\fIlist\fR\fB`\fP.
X This differs from
@@ -3679,7 +3679,7 @@
X .I list
X are evaluated as it is.
X .IP "\fB$((\fP\fIexpression\fR\fB))\fP"
-.I expression
+.I Expression
X the arithmetic expression is evaluated
X and this string is replaced by its result value.
X You can specify numeric values,
@@ -3778,7 +3778,7 @@
X .fi
X .RE
X .IP "\fBvi\fP"
-.B vi
+.B Vi
X mode has the 2 local modes: "insert mode" and "command mode",
X and the function of keys are quite different with each mode.
X You are in the command mode when you start to input,
@@ -4281,7 +4281,7 @@
X according to changing the screen size.
X If no value is set,
X this value will remain unset.
-.IP "\fBCOMSPEC\fP\(**"
+.IP "\fBCOMSPEC\fP"
X Specify the shell used to invoke a batch file.
X If undefined,
X the shell defined by
@@ -4335,7 +4335,7 @@
X \fBHEX\fP, \fBhex\fP  HEX
X \fBCAP\fP, \fBcap\fP  CAP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
+\fBUTF8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
X default       no convert
X .fi
X .RE
@@ -4493,7 +4493,7 @@
X \fBHEX\fP, \fBhex\fP  HEX
X \fBCAP\fP, \fBcap\fP  CAP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
+\fBUTF8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
X default       no convert
X .fi
X .RE
@@ -4567,7 +4567,7 @@
X \fBSJIS\fP, \fBsjis\fP        Shift JIS
X \fBEUC\fP, \fBeuc\fP  EUC-JP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
+\fBUTF8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
X .fi
X .RE
X .IP "\fBLANGUAGE\fP"
@@ -4595,7 +4595,7 @@
X \fBOJIS8\fP, \fBojis8\fP      8bit JIS (JIS C6226-1978 + roman)
X \fBOJUNET\fP, \fBojunet\fP    ISO-2022-JP (JIS C6226-1978 + roman)
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
+\fBUTF8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
X \fBENG\fP, \fBeng\fP, \fBC\fP English (message only)
X default       no convert
X .fi
@@ -4790,7 +4790,7 @@
X \fBSJIS\fP, \fBsjis\fP        Shift JIS
X \fBEUC\fP, \fBeuc\fP  EUC-JP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
+\fBUTF8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
X default       no convert
X .fi
X .RE
@@ -4803,7 +4803,7 @@
X "SendAsIs", "InputCode", "Break" and "NextWindow".
X Each item means respectively:
X sending the pseudo terminal menu key as is,
-inputing the key name to be sent like as
+inputting the key name to be sent like as
X .B bind
X command,
X terminating forcedly the process running in the pseudo terminal,
@@ -4837,7 +4837,7 @@
X \fBSJIS\fP, \fBsjis\fP        Shift JIS
X \fBEUC\fP, \fBeuc\fP  EUC-JP
X \fBUTF8\fP, \fButf8\fP        UTF-8
-\fButf8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
+\fBUTF8-mac\fP, \fBmac\fP      UTF-8 for Mac OS X
X default       no convert
X .fi
X .RE
@@ -4915,7 +4915,7 @@
X Any value except
X .B 0
X and null effects valid.
-.IP "\fBSHELL\fP\(**"
+.IP "\fBSHELL\fP"
X When the filename part of this specified value is
X .B rfd
X or
@@ -4991,15 +4991,16 @@
X then you can re-specify the suitable one as this value after invoked
X for some strange terminal display and key input.
X .IP "\fBTHRUARGS\fP"
-Pass through the pathnames as is, which is specified as the startup arguments.
-.B fd
+Pass through the pathnames as is,
+which is specified as the startup arguments.
+.B Fd
X expands the meta character such as
X .B ~
X and
X .B ${#}
X in the given pathname by itself,
X because the obsolete low-level shell cannot support these expansion extended by POSIX.
-.B fd
+.B Fd
X can sometimes expand the pathname given by the shell into the unexpected string
X as a result of duplicate expansion,
X because the latest high-level shell generally support these expansion.
@@ -5119,7 +5120,7 @@
X No pathname is specified by default.
X .B (UNIX)
X .SH MULTI LANGUAGE SUPPORT
-.B fd
+.B Fd
X processes the Kanji character-set to input/output
X as "EUC-JP" or "Shift JIS" according to setting in compile.
X The the pathname including Kanji is displayed
@@ -5160,7 +5161,7 @@
X The original "FD" for MS-DOS was created and released by
X A.Idei <SDI00544@niftyserve.or.jp>
X for the first time, in 1989.
-.B fd
+.B Fd
X was created for UNIX from scratch following that implementation, in 1995.
X .SH FILES
X .PD 0
diff -urNP ../FD-2.08d/file.c ./file.c
--- ../FD-2.08d/file.c  Tue Jun 13 00:00:00 2006
+++ ./file.c    Fri Jul 28 00:00:00 2006
@@ -1019,15 +1019,18 @@
X static int dounlink(path)
X char *path;
X {
-       return(Xunlink(path));
+       if (Xunlink(path) < 0) return(APL_ERROR);
+
+       return(APL_OK);
X }
X 
X static int dormdir(path)
X char *path;
X {
-       if (isdotdir(path)) return(0);
+       if (isdotdir(path)) return(APL_OK);
+       if (Xrmdir(path) < 0) return(APL_ERROR);
X 
-       return(Xrmdir(path));
+       return(APL_OK);
X }
X 
X VOID removetmp(dir, file)
@@ -1042,7 +1045,8 @@
X               warning(-1, dir);
X               *dir = '\0';
X       }
-       else if (!file) applydir(NULL, dounlink, NULL, dormdir, 3, NULL);
+       else if (!file) VOID_C applydir(NULL, dounlink,
+               NULL, dormdir, ORD_NOPREDIR, NULL);
X       else if (Xunlink(nodospath(path, file)) < 0) warning(-1, file);
X 
X #ifndef       _NODOSDRIVE
@@ -1172,9 +1176,7 @@
X       char tmp[MAXPATHLEN];
X # endif
X 
-       path[0] = drive;
-       path[1] = ':';
-       strcpy(&(path[2]), file);
+       strcpy(gendospath(path, drive, '\0'), file);
X # if  !MSDOS
X       file = nodospath(tmp, file);
X # endif
diff -urNP ../FD-2.08d/frontend.c ./frontend.c
--- ../FD-2.08d/frontend.c      Tue Jun 13 00:00:00 2006
+++ ./frontend.c        Fri Jul 28 00:00:00 2006
@@ -233,20 +233,14 @@
X {
X       va_list args;
X       char *buf;
-       int n, len;
+       int n;
X 
X       VA_START(args, fmt);
X       n = vasprintf2(&buf, fmt, args);
X       va_end(args);
X       if (n < 0) error("malloc()");
X 
-       if (!emupid) VOID_C cputs2(buf);
-       else {
-               sendword(emufd, TE_CPUTS2);
-               len = strlen(buf);
-               sendword(emufd, len);
-               sendbuf(emufd, buf, len);
-       }
+       Xcputs2(buf);
X       free(buf);
X 
X       return(n);
@@ -369,7 +363,7 @@
X 
X VOID changeinkcode(VOID_A)
X {
-       ptylist[win].incode = ptyinkcode;
+       ptylist[win].incode = (u_char)ptyinkcode;
X       if (!emupid) return;
X 
X       sendword(emufd, TE_CHANGEINKCODE);
@@ -379,7 +373,7 @@
X 
X VOID changeoutkcode(VOID_A)
X {
-       ptylist[win].outcode = ptyoutkcode;
+       ptylist[win].outcode = (u_char)ptyoutkcode;
X       if (!emupid) return;
X 
X       sendword(emufd, TE_CHANGEOUTKCODE);
@@ -672,7 +666,6 @@
X                       setenv2(cp, func1, n);
X                       free(cp);
X                       if (func1) free(func1);
-                       evalenv();
X                       break;
X               case TE_ADDFUNCTION:
X                       if (recvvar(fd, &var) < 0) break;
@@ -693,21 +686,18 @@
X                       || recvstring(fd, &cp) < 0 || !cp)
X                               break;
X                       if (putexportvar(cp, n) < 0) free(cp);
-                       evalenv();
X                       break;
X               case TE_PUTSHELLVAR:
X                       if (recvbuf(fd, &n, sizeof(n)) < 0
X                       || recvstring(fd, &cp) < 0 || !cp)
X                               break;
X                       if (putshellvar(cp, n) < 0) free(cp);
-                       evalenv();
X                       break;
X               case TE_UNSET:
X                       if (recvbuf(fd, &n, sizeof(n)) < 0
X                       || recvstring(fd, &cp) < 0 || !cp)
X                               break;
X                       VOID_C unset(cp, n);
-                       evalenv();
X                       free(cp);
X                       break;
X               case TE_SETEXPORT:
diff -urNP ../FD-2.08d/func.h ./func.h
--- ../FD-2.08d/func.h  Tue Jun 13 00:00:00 2006
+++ ./func.h    Fri Jul 28 00:00:00 2006
@@ -340,7 +340,11 @@
X extern char *strcpy2 __P_((char *, char *));
X extern char *strncpy2 __P_((char *, char *, int));
X extern int strncpy3 __P_((char *, char *, int *, int));
+#ifdef CODEEUC
X extern int strlen2 __P_((char *));
+#else
+#define        strlen2 strlen
+#endif
X extern int strlen3 __P_((char *));
X extern int atoi2 __P_((char *));
X extern char *asprintf3 __P_((CONST char *, ...));
@@ -415,6 +419,7 @@
X #endif
X 
X /* apply.c */
+extern VOID prepareremove __P_((VOID_A));
X extern int rmvfile __P_((char *));
X extern int rmvdir __P_((char *));
X extern int findfile __P_((char *));
@@ -602,17 +607,21 @@
X extern int sjis2ujis __P_((char *, u_char *, int));
X extern int ujis2sjis __P_((char *, u_char *, int));
X #endif
-#if    !defined (_NOKANJICONV) || !defined (_NODOSDRIVE)
+#ifdef _USEUNICODE
X extern VOID readunitable __P_((int));
X extern VOID discardunitable __P_((VOID_A));
X extern u_int unifysjis __P_((u_int, int));
X extern u_int cnvunicode __P_((u_int, int));
X #endif
X #ifndef       _NOKANJICONV
+# ifdef        _USEUNICODE
+extern int ucs2toutf8 __P_((char *, int, u_int));
+extern u_int ucs2fromutf8 __P_((u_char *, int *));
+# endif
X extern int kanjiconv __P_((char *, char *, int, int, int, int));
X extern char *kanjiconv2 __P_((char *, char *, int, int, int, int));
X extern char *newkanjiconv __P_((char *, int, int, int));
-#endif
+#endif /* !_NOKANJICONV */
X #ifndef       _NOKANJIFCONV
X extern int getkcode __P_((char *));
X #endif
@@ -677,7 +686,8 @@
X #endif
X 
X /* custom.c */
-extern VOID evalenv __P_((VOID_A));
+extern VOID initenv __P_((VOID_A));
+extern VOID evalenv __P_((char *, int));
X #ifdef        DEBUG
X extern VOID freeenvpath __P_((VOID_A));
X #endif
diff -urNP ../FD-2.08d/info.c ./info.c
--- ../FD-2.08d/info.c  Tue Jun 13 00:00:00 2006
+++ ./info.c    Fri Jul 28 00:00:00 2006
@@ -208,6 +208,7 @@
X extern VOID warning __P_((int, char *));
X #ifdef        _USEDOSPATH
X extern int dospath __P_((char *, char *));
+extern char *gendospath __P_((char *, int, int));
X #endif
X #if   MSDOS && !defined (_NOUSELFN)
X extern int supportLFN __P_((char *));
@@ -442,8 +443,8 @@
X       return(y);
X }
X 
-VOID help(mode)
-int mode;
+VOID help(arch)
+int arch;
X {
X       char buf[(KEYWID + 1 + 1) * 2 + 1];
X       int i, j, c, x, y, yy;
@@ -468,7 +469,7 @@
X               Xlocate(x * (n_column / 2), yy + y);
X               if (x ^= 1) Xputterm(L_CLEAR);
X               else y++;
-               if (mode && !(funclist[i].status & FN_ARCHIVE)) continue;
+               if (arch && !(funclist[i].status & FN_ARCHIVE)) continue;
X 
X               c = 0;
X               buf[0] = '\0';
@@ -770,10 +771,7 @@
X       if (!mntbuf) mntbuf = &mnt;
X 
X       mntbuf -> mnt_fsname = "MSDOS";
-       mntbuf -> mnt_dir[0] = dospath(path, NULL);
-       mntbuf -> mnt_dir[1] = ':';
-       mntbuf -> mnt_dir[2] = _SC_;
-       mntbuf -> mnt_dir[3] = '\0';
+       VOID_C gendospath(mntbuf -> mnt_dir, dospath(path, NULL), _SC_);
X # ifdef       _NOUSELFN
X       mntbuf -> mnt_type = MNTTYPE_PC;
X # else        /* !_NOUSELFN */
diff -urNP ../FD-2.08d/input.c ./input.c
--- ../FD-2.08d/input.c Tue Jun 13 00:00:00 2006
+++ ./input.c   Fri Jul 28 00:00:00 2006
@@ -112,9 +112,8 @@
X static char *NEAR truncstr __P_((char *));
X static int NEAR yesnomes __P_((char *));
X static int NEAR selectcnt __P_((int, char **, int));
-static int NEAR selectadj __P_((int, int, char **, char **, int [], int));
-static VOID NEAR selectmes __P_((int, int, int,
-               char *[], int [], int [], int));
+static int NEAR selectadj __P_((int, int, char **, char **, int *, int));
+static VOID NEAR selectmes __P_((int, int, int, char *[], int [], int *, int));
X 
X int subwindow = 0;
X int win_x = 0;
@@ -1432,7 +1431,7 @@
X                       if (cxp != &rptr && rptr > *qedp) rptr--;
X                       if (cxp2 != &vptr && vptr > cx2) vptr--;
X                       inputlen--;
-                       *qedp = 0;
+                       *qedp = -1;
X                       return(0);
X               }
X               *qtopp = *cxp;
@@ -1542,7 +1541,7 @@
X       dupcolumns = curcolumns;
X       dupdispmode = dispmode;
X       minfilename = n_column;
-       dispmode = 2;
+       dispmode = F_FILETYPE;
X 
X       if (argv) {
X               selectlist = (namelist *)malloc2(argc * sizeof(namelist));
@@ -1722,6 +1721,9 @@
X               }
X # endif
X               else if (pc != PC_NORMAL) /*EMPTY*/;
+# ifdef        _USEDOSPATH
+               else if (i == top && _dospath(&(inputbuf[i]))) i++;
+# endif
X               else if (inputbuf[i] == ':' || inputbuf[i] == '='
X               || strchr(CMDLINE_DELIM, inputbuf[i]))
X                       top = i + 1;
@@ -1764,7 +1766,7 @@
X               i = (s_isdir(&(selectlist[tmpfilepos]))) ? 1 : 0;
X               argv[0] = (char *)malloc2(n + i + 1);
X               memcpy(argv[0], selectlist[tmpfilepos].name, n);
-               if (i) argv[0][n] = '/';
+               if (i) argv[0][n] = _SC_;
X               argv[0][n + i] = '\0';
X               argc = 1;
X       }
@@ -2003,7 +2005,7 @@
X               kanjiconv(buf, tmpkanji, 2, code, DEFCODE, L_INPUT);
X               return(1);
X       }
-       if (code == UTF8 || code == M_UTF8) {
+       if (code >= UTF8) {
X               if ((ch & 0xff00) || !ismsb(ch)) /*EMPTY*/;
X               else if ((ch2 = getch3()) == EOF) {
X                       buf[0] = '\0';
@@ -2026,7 +2028,7 @@
X                       tmpkanji[1] = ch2;
X                       tmpkanji[2] = n;
X                       tmpkanji[3] = '\0';
-                       n = kanjiconv(buf, tmpkanji, 3,
+                       n = kanjiconv(buf, tmpkanji, 2,
X                               code, DEFCODE, L_INPUT);
X # ifdef       CODEEUC
X                       if (isekana(buf, 0)) n = 1;
@@ -3381,7 +3383,7 @@
X static int NEAR selectadj(max, x, str, tmpstr, xx, multi)
X int max, x;
X char **str, **tmpstr;
-int xx[], multi;
+int *xx, multi;
X {
X       char *cp;
X       int i, len, maxlen;
@@ -3438,7 +3440,7 @@
X static VOID NEAR selectmes(num, max, x, str, val, xx, multi)
X int num, max, x;
X char *str[];
-int val[], xx[], multi;
+int val[], *xx, multi;
X {
X       int i;
X 
diff -urNP ../FD-2.08d/kanji.c ./kanji.c
--- ../FD-2.08d/kanji.c Tue Jun 13 00:00:00 2006
+++ ./kanji.c   Fri Jul 28 00:00:00 2006
@@ -10,12 +10,9 @@
X #ifdef        FD
X #include "fd.h"
X #else /* !FD */
+#include "machine.h"
X #include <stdio.h>
X #include <string.h>
-#include "machine.h"
-#include "kctype.h"
-#include "pathname.h"
-#include "term.h"
X 
X #ifndef       NOUNISTDH
X #include <unistd.h>
@@ -25,6 +22,9 @@
X #include <stdlib.h>
X #endif
X 
+#include "printf.h"
+#include "kctype.h"
+
X #if   MSDOS
X #include "unixemu.h"
X #else
@@ -51,12 +51,8 @@
X extern int parentfd;
X # endif
X #else /* !FD */
-#define        realpath2(p, r, l)      realpath(p, r)
+# ifdef        _USEUNICODE
X extern char *malloc2 __P_((ALLOC_T));
-extern char *strncpy2 __P_((char *, char *, int));
-#define        Xlseek  lseek
-# ifndef       _NOKANJIFCONV
-extern char *includepath __P_((char *, char *));
X # endif
X #endif        /* !FD */
X 
@@ -110,14 +106,14 @@
X || (!defined (_NOENGMES) && !defined (_NOJPNMES))
X typedef struct _langtable {
X       char *ident;
-       int lang;
+       u_char lang;
X } langtable;
X #endif
X 
X #ifndef       _NOKANJIFCONV
X typedef struct _kpathtable {
X       char **path;
-       u_short code;
+       u_char code;
X } kpathtable;
X #endif
X 
@@ -130,28 +126,32 @@
X static VOID NEAR sj2j __P_((char *, u_char *));
X static VOID NEAR j2sj __P_((char *, u_char *));
X #endif
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+#ifdef _USEUNICODE
X static int NEAR openunitbl __P_((char *));
-static u_char * NEAR tblmalloc __P_((ALLOC_T));
-#define        getword(s, n)   (((u_int)((s)[(n) + 1]) << 8) | (s)[n])
+static u_char *NEAR newunitbl __P_((ALLOC_T));
+#define        getword(s, n)   (((u_short)((s)[(n) + 1]) << 8) | (s)[n])
+#define        skread(f,o,s,n) (lseek(f, o, L_SET) >= (off_t)0 \
+                       && read(f, s, n) == n)
X #endif
X #ifndef       _NOKANJICONV
+# ifdef        _USEUNICODE
X static int NEAR opennftbl __P_((char *, int, u_int *));
+# endif
X static int NEAR toenglish __P_((char *, u_char *, int));
X static int NEAR tojis7 __P_((char *, u_char *, int, int, int, int));
X static int NEAR fromjis __P_((char *, u_char *, int, int));
X static int NEAR tojis8 __P_((char *, u_char *, int, int, int, int));
X static int NEAR tojunet __P_((char *, u_char *, int, int, int, int));
-static VOID NEAR ucs2normalization __P_((u_int *, int *, int, u_int, int));
-static u_int NEAR ucs2denormalization __P_((u_int *, int *, int));
+# ifdef        _USEUNICODE
+static VOID NEAR ucs2normalization __P_((u_short *, int *, int, u_int, int));
+static u_int NEAR ucs2denormalization __P_((u_short *, int *, int));
X static u_int NEAR toucs2 __P_((u_char *, int *));
X static VOID NEAR fromucs2 __P_((char *, int *, u_int));
-static VOID NEAR ucs2toutf8 __P_((char *, int *, u_int));
-static u_int NEAR ucs2fromutf8 __P_((u_char *, int *));
X static int NEAR toutf8 __P_((char *, u_char *, int));
X static int NEAR fromutf8 __P_((char *, u_char *, int));
X static int NEAR toutf8nf __P_((char *, u_char *, int, int));
X static int NEAR fromutf8nf __P_((char *, u_char *, int, int));
+# endif        /* _USEUNICODE */
X static int NEAR bin2hex __P_((char *, int));
X static int NEAR tohex __P_((char *, u_char *, int));
X static int NEAR fromhex __P_((char *, u_char *, int));
@@ -178,7 +178,7 @@
X char *utf8macpath = NULL;
X char *noconvpath = NULL;
X #endif        /* !_NOKANJIFCONV */
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+#ifdef _USEUNICODE
X char *unitblpath = NULL;
X int unicodebuffer = 0;
X #endif
@@ -211,7 +211,7 @@
X #define       MAXLANGLIST     arraysize(langlist)
X #endif        /* !_NOKANJICONV || (!_NOENGMES && !_NOJPNMES) */
X 
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+#ifdef _USEUNICODE
X static u_char *unitblbuf = NULL;
X static u_int unitblent = 0;
X static CONST kconv_t rsjistable[] = {
@@ -248,7 +248,7 @@
X       {0xfa5b, 0x81e6, 0x01},         /* because */
X };
X #define       RSJISTBLSIZ     arraysize(rsjistable)
-#endif /* !_NOKANJICONV || (FD && !_NODOSDRIVE) */
+#endif /* _USEUNICODE */
X #if   !defined (_NOKANJICONV) \
X || (defined (FD) && defined (_USEDOSEMU) && defined (CODEEUC))
X static CONST kconv_t convtable[] = {
@@ -374,11 +374,12 @@
X };
X #endif        /* !_NOKANJICONV || (FD && _USEDOSEMU && CODEEUC) */
X #ifndef       _NOKANJICONV
+# ifdef        _USEUNICODE
X static u_int nftblnum = 0;
X static u_int nflen = 0;
X static u_char **nftblbuf = NULL;
X static u_int *nftblent = 0;
-#define        NF_MAC          1
+# endif
X static CONST u_char hctypetable[256] = {
X       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */
X       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */
@@ -461,37 +462,34 @@
X 
X #ifndef       FD
X int onkanji1 __P_((char *, int));
-#if    !defined (_NOKANJICONV) \
+# if   !defined (_NOKANJICONV) \
X || (!defined (_NOENGMES) && !defined (_NOJPNMES))
X int getlang __P_((char *, int));
-#endif
-#if    !defined (_NOENGMES) && !defined (_NOJPNMES)
+# endif
+# if   !defined (_NOENGMES) && !defined (_NOJPNMES)
X char *mesconv __P_((char *, char *));
-#endif
-#if    !defined (_NOKANJICONV) \
+# endif
+# if   !defined (_NOKANJICONV) \
X || (defined (FD) && defined (_USEDOSEMU) && defined (CODEEUC))
X int sjis2ujis __P_((char *, u_char *, int));
X int ujis2sjis __P_((char *, u_char *, int));
-#endif
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+# endif
+# ifdef        _USEUNICODE
X VOID readunitable __P_((int));
X VOID discardunitable __P_((VOID_A));
X u_int unifysjis __P_((u_int, int));
X u_int cnvunicode __P_((u_int, int));
-#endif
-#ifndef        _NOKANJICONV
+# endif
+# ifndef       _NOKANJICONV
+#  ifdef       _USEUNICODE
+int ucs2toutf8 __P_((char *, int, u_int));
+u_int ucs2fromutf8 __P_((u_char *, int));
+#  endif
X int kanjiconv __P_((char *, char *, int, int, int, int));
X char *kanjiconv2 __P_((char *, char *, int, int, int, int));
X char *newkanjiconv __P_((char *, int, int, int));
-#endif /* !_NOKANJICONV */
-#ifndef        _NOKANJIFCONV
-int getkcode __P_((char *));
-#endif
-#ifndef        _NOKANJICONV
X int getoutputkcode __P_((VOID_A));
-#endif
-char *convget __P_((char *, char *, int));
-char *convput __P_((char *, char *, int, int, char *, int *));
+# endif        /* !_NOKANJICONV */
X #endif        /* !FD */
X 
X 
@@ -508,7 +506,7 @@
X               if (!s[i]) return(0);
X               else if (iskanji1(s, i)) i++;
X #ifdef        CODEEUC
-               else if (isekana(s, i)) i++;
+               else VOID_C iskana1(s, &i);
X #endif
X       }
X       if (i > ptr) return(0);
@@ -589,23 +587,29 @@
X u_char *s;
X {
X       u_int w;
-       int i, s1, s2, j1, j2;
+       int n, s1, s2, j1, j2, min, max;
X 
X       s1 = s[0] & 0xff;
X       s2 = s[1] & 0xff;
X       if (s1 >= 0xf0) {
X               w = (((u_int)s1 << 8) | s2);
-               for (i = 0; i < CNVTBLSIZ; i++)
-                       if (w >= convtable[i].start
-                       && w < convtable[i].start + convtable[i].range)
+               min = -1;
+               max = CNVTBLSIZ;
+               for (;;) {
+                       n = (min + max) / 2;
+                       if (n <= min || n >= max) {
+                               w = SJ_UDEF;
+                               kanjierrno = SJIS;
X                               break;
-               if (i >= CNVTBLSIZ) {
-                       w = SJ_UDEF;
-                       kanjierrno = SJIS;
-               }
-               else {
-                       w -= convtable[i].start;
-                       w += convtable[i].cnv;
+                       }
+                       if (w >= convtable[n].start + convtable[n].range)
+                               min = n;
+                       else if (w < convtable[n].start) max = n;
+                       else {
+                               w -= convtable[n].start;
+                               w += convtable[n].cnv;
+                               break;
+                       }
X               }
X               s1 = (w >> 8) & 0xff;
X               s2 = w & 0xff;
@@ -641,9 +645,10 @@
X       }
X       else w = (((u_int)s1 << 8) | s2);
X 
-       for (i = 0; i < CNVTBLSIZ; i++)
-       if (w >= convtable[i].cnv
-       && w < convtable[i].cnv + convtable[i].range) {
+       for (i = 0; i < CNVTBLSIZ; i++) {
+               if (w < convtable[i].cnv
+               || w >= convtable[i].cnv + convtable[i].range)
+                       continue;
X               w -= convtable[i].cnv;
X               w += convtable[i].start;
X               s1 = (w >> 8) & 0xff;
@@ -662,13 +667,15 @@
X {
X       int i, j;
X 
-       for (i = j = 0; s[i] && j < max - 1; i++, j++) {
+       for (i = j = 0; s[i] && j < max; i++, j++) {
X               if (issjis1(s[i]) && issjis2(s[i + 1])) {
+                       if (j + 2 > max) break;
X                       sj2j(&(buf[j]), &(s[i++]));
X                       buf[j++] |= 0x80;
X                       buf[j] |= 0x80;
X               }
X               else if (isskana(s, i)) {
+                       if (j + 2 > max) break;
X                       buf[j++] = (char)C_EKANA;
X                       buf[j] = s[i];
X               }
@@ -685,9 +692,11 @@
X {
X       int i, j;
X 
-       for (i = j = 0; s[i] && j < max - 1; i++, j++) {
-               if (iseuc(s[i]) && iseuc(s[i + 1]))
+       for (i = j = 0; s[i] && j < max; i++, j++) {
+               if (iseuc(s[i]) && iseuc(s[i + 1])) {
+                       if (j + 2 > max) break;
X                       j2sj(&(buf[j++]), &(s[i++]));
+               }
X               else if (isekana(s, i)) buf[j] = s[++i];
X               else buf[j] = s[i];
X       }
@@ -697,7 +706,7 @@
X }
X #endif        /* !_NOKANJICONV || (FD && _USEDOSEMU && CODEEUC) */
X 
-#if    !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+#ifdef _USEUNICODE
X static int NEAR openunitbl(file)
X char *file;
X {
@@ -729,13 +738,13 @@
X       return(fd);
X }
X 
-static u_char *NEAR tblmalloc(size)
+static u_char *NEAR newunitbl(size)
X ALLOC_T size;
X {
X       u_char *tbl;
X 
X       if ((tbl = (u_char *)malloc(size))) return(tbl);
-       openunitbl(NULL);
+       VOID_C openunitbl(NULL);
X       if (unicodebuffer) unicodebuffer = 0;
X 
X       return(NULL);
@@ -760,11 +769,10 @@
X       size = (ALLOC_T)unitblent * 4;
X 
X       if (!unitblbuf) {
-               if (!(tbl = tblmalloc(size))) return;
-               if (Xlseek(fd, (off_t)2, L_SET) < (off_t)0
-               || read(fd, tbl, size) != size) {
+               if (!(tbl = newunitbl(size))) return;
+               if (!skread(fd, (off_t)2, tbl, size)) {
X                       free(tbl);
-                       openunitbl(NULL);
+                       VOID_C openunitbl(NULL);
X                       return;
X               }
X               unitblbuf = tbl;
@@ -776,9 +784,8 @@
X               u_int *tblent;
X               int i;
X 
-               if (Xlseek(fd, (off_t)size + 2, L_SET) < (off_t)0
-               || read(fd, buf, 2) != 2) {
-                       openunitbl(NULL);
+               if (!skread(fd, (off_t)size + 2, buf, 2)) {
+                       VOID_C openunitbl(NULL);
X                       return;
X               }
X               nftblnum = buf[0];
@@ -791,13 +798,13 @@
X                               while (i > 0) free(tblbuf[--i]);
X                               free(tblbuf);
X                               free(tblent);
-                               openunitbl(NULL);
+                               VOID_C openunitbl(NULL);
X                               return;
X                       }
X                       tblent[i] = getword(buf, 0);
X                       size = (ALLOC_T)tblent[i] * (2 + nflen * 2);
X 
-                       if (!(tblbuf[i] = tblmalloc(size))) {
+                       if (!(tblbuf[i] = newunitbl(size))) {
X                               while (i > 0) free(tblbuf[--i]);
X                               free(tblbuf);
X                               free(tblent);
@@ -807,7 +814,7 @@
X                               while (i >= 0) free(tblbuf[i--]);
X                               free(tblbuf);
X                               free(tblent);
-                               openunitbl(NULL);
+                               VOID_C openunitbl(NULL);
X                               return;
X                       }
X               }
@@ -816,7 +823,7 @@
X       }
X # endif       /* !_NOKANJICONV */
X 
-       openunitbl(NULL);
+       VOID_C openunitbl(NULL);
X }
X 
X VOID discardunitable(VOID_A)
@@ -845,16 +852,22 @@
X u_int wc;
X int russ;
X {
-       int i;
+       int n, min, max;
X 
X       wc &= 0xffff;
-       for (i = ((russ) ? 0 : EXCEPTRUSS); i < RSJISTBLSIZ; i++)
-               if (wc >= rsjistable[i].start
-               && wc < rsjistable[i].start + rsjistable[i].range)
+       min = ((russ) ? 0 : EXCEPTRUSS) - 1;
+       max = RSJISTBLSIZ;
+       for (;;) {
+               n = (min + max) / 2;
+               if (n <= min || n >= max) break;
+               if (wc >= rsjistable[n].start + rsjistable[n].range)
+                       min = n;
+               else if (wc < rsjistable[n].start) max = n;
+               else {
+                       wc -= rsjistable[n].start;
+                       wc += rsjistable[n].cnv;
X                       break;
-       if (i < RSJISTBLSIZ) {
-               wc -= rsjistable[i].start;
-               wc += rsjistable[i].cnv;
+               }
X       }
X 
X       return(wc);
@@ -865,12 +878,12 @@
X int encode;
X {
X       u_char *cp, buf[4];
-       u_int r, w, min, max, ofs;
+       u_int r, w, ofs, min, max;
X       int fd;
X 
X       wc &= 0xffff;
X       if (encode < 0) {
-               openunitbl(NULL);
+               VOID_C openunitbl(NULL);
X               if (!unicodebuffer) discardunitable();
X               return(0);
X       }
@@ -929,26 +942,20 @@
X               else {
X                       min = 0;
X                       max = unitblent + 1;
-                       ofs = unitblent / 2 + 1;
X                       for (;;) {
-                               if (ofs == min || ofs == max) break;
+                               ofs = (min + max) / 2;
+                               if (ofs <= min || ofs >= max) break;
X                               cp = &(unitblbuf[(ofs - 1) * 4]);
X                               w = getword(cp, 0);
-                               if (wc == w) break;
-                               else if (wc < w) {
-                                       max = ofs;
-                                       ofs = (ofs + min) / 2;
-                               }
-                               else {
-                                       min = ofs;
-                                       ofs = (ofs + max) / 2;
-                               }
+                               if (wc > w) min = ofs;
+                               else if (wc < w) max = ofs;
+                               else break;
X                       }
X               }
X       }
X       else if ((fd = openunitbl(UNICODETBL)) < 0) ofs = unitblent;
X       else if (encode) {
-               if (Xlseek(fd, (off_t)2, L_SET) < (off_t)0) ofs = unitblent;
+               if (lseek(fd, (off_t)2, L_SET) < (off_t)0) ofs = unitblent;
X               else for (ofs = 0; ofs < unitblent; ofs++) {
X                       if (read(fd, cp, 4) != 4) {
X                               ofs = unitblent;
@@ -961,25 +968,17 @@
X       else {
X               min = 0;
X               max = unitblent + 1;
-               ofs = unitblent / 2 + 1;
X               for (;;) {
-                       if (ofs == min || ofs == max) break;
-                       if (Xlseek(fd, (off_t)(ofs - 1) * 4 + 2, L_SET)
-                       < (off_t)0
-                       || read(fd, cp, 4) != 4) {
+                       ofs = (min + max) / 2;
+                       if (ofs <= min || ofs >= max) break;
+                       if (!skread(fd, (off_t)(ofs - 1) * 4 + 2, cp, 4)) {
X                               ofs = min = max = 0;
X                               break;
X                       }
X                       w = getword(cp, 0);
-                       if (wc == w) break;
-                       else if (wc < w) {
-                               max = ofs;
-                               ofs = (ofs + min) / 2;
-                       }
-                       else {
-                               min = ofs;
-                               ofs = (ofs + max) / 2;
-                       }
+                       if (wc > w) min = ofs;
+                       else if (wc < w) max = ofs;
+                       else break;
X               }
X       }
X 
@@ -994,9 +993,10 @@
X 
X       return(r);
X }
-#endif /* !_NOKANJICONV || (FD && !_NODOSDRIVE) */
+#endif /* _USEUNICODE */
X 
X #ifndef       _NOKANJICONV
+# ifdef        _USEUNICODE
X static int NEAR opennftbl(file, nf, entp)
X char *file;
X int nf;
@@ -1010,8 +1010,7 @@
X       ofs = (off_t)unitblent * 4 + 2;
X 
X       if (!nftblnum) {
-               if (Xlseek(fd, ofs, L_SET) < (off_t)0
-               || read(fd, buf, 2) != 2) return(-1);
+               if (!skread(fd, ofs, buf, 2)) return(-1);
X               nftblnum = buf[0];
X               nflen = buf[1];
X       }
@@ -1021,13 +1020,13 @@
X       *entp = 0;
X       for (i = 0; i < nf; i++) {
X               ofs += 2 + (off_t)*entp * (2 + nflen * 2);
-               if (Xlseek(fd, ofs, L_SET) < (off_t)0
-               || read(fd, buf, 2) != 2) return(-1);
+               if (!skread(fd, ofs, buf, 2)) return(-1);
X               *entp = getword(buf, 0);
X       }
X 
X       return(fd);
X }
+# endif        /* _USEUNICODE */
X 
X static int NEAR toenglish(buf, s, max)
X char *buf;
@@ -1036,20 +1035,14 @@
X {
X       int i, j;
X 
-       for (i = j = 0; s[i] && j < max - 1; i++, j++) {
+       for (i = j = 0; s[i] && j < max; i++, j++) {
X               if (iskanji1((char *)s, i)) {
+                       if (j + 2 > max) break;
X                       i++;
X                       buf[j++] = '?';
X                       buf[j] = '?';
X               }
-# ifdef        CODEEUC
-               else if (isekana(s, i)) {
-                       i++;
-                       buf[j] = '?';
-               }
-# else
-               else if (isskana(s, i)) buf[j] = '?';
-# endif
+               else if (iskana1((char *)s, &i)) buf[j] = '?';
X               else buf[j] = s[i];
X       }
X 
@@ -1061,11 +1054,15 @@
X u_char *s;
X int max, knj, asc, io;
X {
-       int i, j, mode;
+       int i, j, len, mode;
X 
X       mode = ASCII;
-       for (i = j = 0; s[i] && j < max - 7; i++, j++) {
+       for (i = j = 0; s[i] && j < max; i++, j++) {
X               if (iskanji1((char *)s, i)) {
+                       len = 5;
+                       if (mode & KANA) len++;
+                       if (!(mode & KANJI)) len += 3;
+                       if (j + len > max) break;
X                       if (mode & KANA) buf[j++] = '\017';
X                       mode &= ~KANA;
X                       if (!(mode & KANJI)) {
@@ -1082,18 +1079,21 @@
X # endif
X                       buf[j] = jcnv(buf[j], io);
X               }
-# ifdef        CODEEUC
-               else if (isekana(s, i)) {
-                       i++;
-# else
-               else if (isskana(s, i)) {
-# endif
+               else if (iskana1((char *)s, &i)) {
+                       len = 2;
+                       if (!(mode & KANA)) len++;
+                       if (mode & KANJI) len += 3;
+                       if (j + len > max) break;
X                       if (!(mode & KANA)) buf[j++] = '\016';
X                       mode |= KANA;
X                       buf[j] = s[i] & ~0x80;
X                       buf[j] = jcnv(buf[j], io);
X               }
X               else {
+                       len = 1;
+                       if (mode & KANA) len++;
+                       if (mode & KANJI) len += 3;
+                       if (j + len > max) break;
X                       if (mode & KANA) buf[j++] = '\017';
X                       mode &= ~KANA;
X                       if (mode & KANJI) {
@@ -1123,7 +1123,7 @@
X       int i, j, mode;
X 
X       mode = ASCII;
-       for (i = j = 0; s[i] && j < max - 1; i++)
+       for (i = j = 0; s[i] && j < max; i++)
X       switch (s[i]) {
X               case '\016':    /* SO */
X                       mode |= KANA;
@@ -1177,12 +1177,14 @@
X                               if (!isjkana(s, i)) buf[j++] = s[i];
X                               else {
X # ifdef       CODEEUC
+                                       if (j + 2 > max) break;
X                                       buf[j++] = (char)C_EKANA;
X # endif
X                                       buf[j++] = jdecnv(s[i], io) | 0x80;
X                               }
X                       }
X                       else if (mode & KANJI) {
+                               if (j + 2 > max) break;
X                               if (!isjis(s[i]) || !isjis(s[i + 1])) {
X                                       buf[j++] = s[i++];
X                                       buf[j++] = s[i];
@@ -1203,6 +1205,7 @@
X                       }
X # ifdef       CODEEUC
X                       else if (iskana2(s[i])) {
+                               if (j + 2 > max) break;
X                               buf[j++] = (char)C_EKANA;
X                               buf[j++] = s[i];
X                       }
@@ -1219,11 +1222,14 @@
X u_char *s;
X int max, knj, asc, io;
X {
-       int i, j, mode;
+       int i, j, len, mode;
X 
X       mode = ASCII;
-       for (i = j = 0; s[i] && j < max - 7; i++, j++) {
+       for (i = j = 0; s[i] && j < max; i++, j++) {
X               if (iskanji1((char *)s, i)) {
+                       len = 5;
+                       if (mode != KANJI) len += 3;
+                       if (j + len > max) break;
X                       if (mode != KANJI) {
X                               buf[j++] = '\033';
X                               buf[j++] = '$';
@@ -1239,6 +1245,9 @@
X                       buf[j] = jcnv(buf[j], io);
X               }
X               else {
+                       len = 1;
+                       if (mode == KANJI) len += 3;
+                       if (j + len > max) break;
X                       if (mode == KANJI) {
X                               buf[j++] = '\033';
X                               buf[j++] = '(';
@@ -1246,7 +1255,7 @@
X                       }
X                       mode = ASCII;
X # ifdef       CODEEUC
-                       if (isekana(s, i)) i++;
+                       VOID_C iskana1((char *)s, &i);
X # endif
X                       buf[j] = s[i];
X               }
@@ -1265,11 +1274,14 @@
X u_char *s;
X int max, knj, asc, io;
X {
-       int i, j, mode;
+       int i, j, len, mode;
X 
X       mode = ASCII;
-       for (i = j = 0; s[i] && j < max - 7; i++, j++) {
+       for (i = j = 0; s[i] && j < max; i++, j++) {
X               if (iskanji1((char *)s, i)) {
+                       len = 5;
+                       if (mode != KANJI) len += 3;
+                       if (j + len > max) break;
X                       if (mode != KANJI) {
X                               buf[j++] = '\033';
X                               buf[j++] = '$';
@@ -1284,12 +1296,10 @@
X # endif
X                       buf[j] = jcnv(buf[j], io);
X               }
-# ifdef        CODEEUC
-               else if (isekana(s, i)) {
-                       i++;
-# else
-               else if (isskana(s, i)) {
-# endif
+               else if (iskana1((char *)s, &i)) {
+                       len = 4;
+                       if (mode != JKANA) len += 3;
+                       if (j + len > max) break;
X                       if (mode != JKANA) {
X                               buf[j++] = '\033';
X                               buf[j++] = '(';
@@ -1300,6 +1310,9 @@
X                       buf[j] = jcnv(buf[j], io);
X               }
X               else {
SHAR_EOF
  : || $echo 'restore of' 'FD-2.08e.patch' 'failed'
fi
$echo 'End of' 'FD-2.08e.patch' 'part' '3'
$echo 'File' 'FD-2.08e.patch' 'is continued in part' '4'
echo 4 > _sh01537/seq
exit 0
-- 
                                               しらい たかし