FDclone 2.08c patch [1/2]
しらいです。
file & directory 管理ツール FDclone 2.08c の patch その 1
です。
Submitted-by: shirai@chandra2
Archive-name: FD-2.08c.patch/part01
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is FD-2.08c.patch, a shell archive (produced by GNU sharutils 4.2)
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2006-05-24 00:00 JST by <shirai@chandra2>.
# Source directory was `/usr/home/shirai/src/fd2'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This is part 1 of a multipart archive.
# Do not concatenate these parts, unpack them in order with `/bin/sh'.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 66504 -rw-r--r-- FD-2.08c.patch
#
echo=echo
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh00841; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
if test -r _sh00841/seq; then
$echo 'Must unpack archives in sequence!'
$echo 'Please unpack part' '`cat _sh00841/seq`' 'next!'
exit 1
fi
# ============= FD-2.08c.patch ==============
if test -f 'FD-2.08c.patch' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'FD-2.08c.patch' '(file already exists)'
rm -f _sh00841/new
else
> _sh00841/new
$echo 'x -' extracting 'FD-2.08c.patch' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'FD-2.08c.patch' &&
diff -urNP ../FD-2.08b/HISTORY ./HISTORY
--- ../FD-2.08b/HISTORY Thu Mar 30 00:00:00 2006
+++ ./HISTORY Wed May 24 00:00:00 2006
@@ -1,3 +1,6 @@
+Ver. 2.08c NFS 上のコマンド履歴セーブファイルが消されてしまう点を修正。
+ (05/24/06) 全てのアーカイブファイルサイズを 0 と表示してしまう OS に対応。
+
X Ver. 2.08b Cygwin 1.5.19 対応。
X (03/30/06) PTYMODE=1 時のコマンドラインからの内部コマンド実行に対応。
X 一部の環境で入力キーを取りこぼすことがある点を修正。
diff -urNP ../FD-2.08b/HISTORY.eng ./HISTORY.eng
--- ../FD-2.08b/HISTORY.eng Thu Mar 30 00:00:00 2006
+++ ./HISTORY.eng Wed May 24 00:00:00 2006
@@ -1,3 +1,6 @@
+Ver. 2.08c Bug that the command history file on NFS is truncated is fixed.
+ (05/24/06) Support some OSs displaying every archived file size as 0.
+
X Ver. 2.08b Support Cygwin 1.5.19.
X (03/30/06) Support internal commands with the command line on PTYMODE=1.
X Bug that inputted key is dropped in some environments is fixed.
diff -urNP ../FD-2.08b/Makefile.in ./Makefile.in
--- ../FD-2.08b/Makefile.in Thu Mar 30 00:00:00 2006
+++ ./Makefile.in Wed May 24 00:00:00 2006
@@ -529,7 +529,7 @@
X printf__OBJ__: printf.h
X printf__OBJ__: kctype.h
X termio__OBJ__: machine.h config.h
-termio__OBJ__: termio.h
+termio__OBJ__: printf.h termio.h
X term__OBJ__: machine.h config.h
X term__OBJ__: printf.h
X term__OBJ__: kctype.h
diff -urNP ../FD-2.08b/README ./README
--- ../FD-2.08b/README Thu Mar 30 00:00:00 2006
+++ ./README Wed May 24 00:00:00 2006
@@ -3,7 +3,7 @@
X # FDclone Ver. 2.08 に関して
X #
X # Takashi SHIRAI, <shirai@unixusers.net>
-# Mar 30, 2006
+# May 24, 2006
X #
X ############################################################
X
diff -urNP ../FD-2.08b/README.eng ./README.eng
--- ../FD-2.08b/README.eng Thu Mar 30 00:00:00 2006
+++ ./README.eng Wed May 24 00:00:00 2006
@@ -3,7 +3,7 @@
X # About FDclone Ver. 2.08
X #
X # Takashi SHIRAI, <shirai@unixusers.net>
-# Mar 30, 2006
+# May 24, 2006
X #
X ############################################################
X
diff -urNP ../FD-2.08b/_fdrc ./_fdrc
--- ../FD-2.08b/_fdrc Thu Mar 30 00:00:00 2006
+++ ./_fdrc Wed May 24 00:00:00 2006
@@ -374,6 +374,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #launch ".tar.Z" "zcat %C|tar tvf -" \
X # -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -381,6 +382,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #launch ".tar.gz" "gzip -cd %C|tar tvf -" \
X # -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -388,6 +390,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #launch ".tar.bz2" "bzip2 -cd %C|tar tvf -" \
X # -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -395,6 +398,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #launch ".taZ" "zcat %C|tar tvf -" \
X # -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -402,6 +406,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #launch ".taz" "gzip -cd %C|tar tvf -" \
X # -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -409,6 +414,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #launch ".tgz" "gzip -cd %C|tar tvf -" \
X # -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -416,6 +422,7 @@
X # -f "%a %l %u %g %s %m %d %{yt} %*f" \
X # -f "%10a %u/%g %s %m %d %t %y %*f" \
X # -f "%9a %u/%g %s %m %d %t %y %*f" \
+# -f "%a %u %g %s %m %d %t %y %*f" \
X # -f "%a %u/%g %m %d %t %y %*f"
X #(Examples)
X #launch ".zip" "unzip -lqq" " %s %m-%d-%y %t %*f"
diff -urNP ../FD-2.08b/_fdrc.dif ./_fdrc.dif
--- ../FD-2.08b/_fdrc.dif Thu Mar 30 00:00:00 2006
+++ ./_fdrc.dif Wed May 24 00:00:00 2006
@@ -275,7 +275,7 @@
X
X # Kanji code to be inputted
X # Default: No convert
-@@ -120,49 +267,211 @@
+@@ -120,49 +267,218 @@
X # sjis, SJIS: Shift JIS
X # utf8, UTF8: UTF-8
X # utf8-mac, UTF8-MAC: UTF-8 for Mac OS X
@@ -402,6 +402,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X +#launch ".tar.Z" "zcat %C|tar tvf -" \
X +# -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -409,6 +410,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X +#launch ".tar.gz" "gzip -cd %C|tar tvf -" \
X +# -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -416,6 +418,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X +#launch ".tar.bz2" "bzip2 -cd %C|tar tvf -" \
X +# -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -423,6 +426,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X +#launch ".taZ" "zcat %C|tar tvf -" \
X +# -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -430,6 +434,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X +#launch ".taz" "gzip -cd %C|tar tvf -" \
X +# -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -437,6 +442,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X +#launch ".tgz" "gzip -cd %C|tar tvf -" \
X +# -f "%a %u/%g %s %m %d %t %y %*f" \
@@ -444,6 +450,7 @@
X +# -f "%a %l %u %g %s %m %d %{yt} %*f" \
X +# -f "%10a %u/%g %s %m %d %t %y %*f" \
X +# -f "%9a %u/%g %s %m %d %t %y %*f" \
++# -f "%a %u %g %s %m %d %t %y %*f" \
X +# -f "%a %u/%g %m %d %t %y %*f"
X #(Examples)
X -#launch ".zip" "unzip -lqq" 0,0:0,0,0,1,2[7],2-'-',2'-'-'-',3,4
@@ -517,7 +524,7 @@
X
X # archiver definition
X #(Default)
-@@ -178,6 +487,7 @@
+@@ -178,6 +494,7 @@
X #(Examples)
X #arch ".zip" "zip -q %C %TA" "unzip -q %C %TA"
X #arch ".zoo" "zoo aq %C %TA" "zoo xq %C %TA"
@@ -525,7 +532,7 @@
X
X # examples for MS-DOS
X #arch ".lzh" "lha a %S %TA" "lha x %S %TA"
-@@ -198,22 +508,52 @@
+@@ -198,22 +515,52 @@
X #bind '{' ROLL_UP
X #bind '}' ROLL_DOWN
X #bind '~' "cd ~%N%K"
@@ -588,7 +595,7 @@
X #}
X
X # MS-DOS drive definition
-@@ -222,7 +562,7 @@
+@@ -222,7 +569,7 @@
X
X # alias definition
X #(Example)
diff -urNP ../FD-2.08b/apply.c ./apply.c
--- ../FD-2.08b/apply.c Thu Mar 30 00:00:00 2006
+++ ./apply.c Wed May 24 00:00:00 2006
@@ -300,7 +300,7 @@
X Xlocate(0, L_CMDLINE);
X Xputterm(L_CLEAR);
X cp = SAMEF_K;
- i = strlen2(cp) - (sizeof("%.*s") - 1);
+ i = strlen2(cp) - strsize("%.*s");
X cp = asprintf3(cp, n_column - i, dest);
X Xkanjiputs(cp);
X free(cp);
@@ -477,7 +477,7 @@
X Xlocate(0, L_CMDLINE);
X Xputterm(L_CLEAR);
X cp = DELPM_K;
- len = strlen2(cp) - (sizeof("%.*s") - 1);
+ len = strlen2(cp) - strsize("%.*s");
X cp = asprintf3(cp, n_column - len, path);
X Xkanjiputs(cp);
X free(cp);
@@ -830,7 +830,7 @@
X lcmdline = yy;
X maxcmdline = 1;
X if (!(s = inputstr(AOWNR_K, 0, -1, cp, HST_USER))) return(-1);
- if ((cp = sscanf2(s, "%-*d%$", sizeof(uid_t), &uid))) /*EMPTY*/;
+ if ((cp = sscanf2(s, "%-<*d%$", sizeof(uid_t), &uid))) /*EMPTY*/;
X else if ((up = finduid(0, s))) uid = up -> uid;
X else {
X lcmdline = yy;
@@ -866,7 +866,7 @@
X lcmdline = yy;
X maxcmdline = 1;
X if (!(s = inputstr(AGRUP_K, 0, -1, cp, HST_GROUP))) return(-1);
- if ((cp = sscanf2(s, "%-*d%$", sizeof(gid_t), &gid))) /*EMPTY*/;
+ if ((cp = sscanf2(s, "%-<*d%$", sizeof(gid_t), &gid))) /*EMPTY*/;
X else if ((gp = findgid(0, s))) gid = gp -> gid;
X else {
X lcmdline = yy;
diff -urNP ../FD-2.08b/archive.c ./archive.c
--- ../FD-2.08b/archive.c Thu Mar 30 00:00:00 2006
+++ ./archive.c Wed May 24 00:00:00 2006
@@ -78,6 +78,7 @@
X "%a %l %u %g %s %m %d %{yt} %*f", /* pax */
X "%10a %u/%g %s %m %d %t %y %*f", /* tar (UXP/DS) */
X "%9a %u/%g %s %m %d %t %y %*f", /* traditional */
+ "%a %u %g %s %m %d %t %y %*f", /* AIX */
X "%a %u/%g %m %d %t %y %*f", /* IRIX */
X #endif /* !MSDOS */
X NULL
@@ -282,7 +283,7 @@
X " %f %s %x %x %d-%m-%y %t %a", /* RAR (l) */
X # endif /* !MSDOS */
X };
-#define AUTOFORMATSIZ ((int)(sizeof(autoformat) / sizeof(char *)))
+#define AUTOFORMATSIZ arraysize(autoformat)
X #endif /* FD >= 2 */
X
X
@@ -703,7 +704,7 @@
X break;
X case 'u':
X # ifndef NOUID
- cp = sscanf2(buf, "%-*d%$",
+ cp = sscanf2(buf, "%-<*d%$",
X sizeof(uid_t), &uid);
X if (cp) tmp -> st_uid = uid;
X else if ((up = finduid(0, buf)))
@@ -713,7 +714,7 @@
X break;
X case 'g':
X # ifndef NOUID
- cp = sscanf2(buf, "%-*d%$",
+ cp = sscanf2(buf, "%-<*d%$",
X sizeof(gid_t), &gid);
X if (cp) tmp -> st_gid = gid;
X else if ((gp = findgid(0, buf)))
@@ -1055,10 +1056,10 @@
X
X # ifndef NOUID
X getfield(buf, line, skip, list, F_UID);
- if (sscanf2(buf, "%-*d%$", sizeof(uid_t), &uid)) tmp -> st_uid = uid;
+ if (sscanf2(buf, "%-<*d%$", sizeof(uid_t), &uid)) tmp -> st_uid = uid;
X else tmp -> st_uid = ((up = finduid(0, buf))) ? up -> uid : (uid_t)-1;
X getfield(buf, line, skip, list, F_GID);
- if (sscanf2(buf, "%-*d%$", sizeof(gid_t), &gid)) tmp -> st_gid = gid;
+ if (sscanf2(buf, "%-<*d%$", sizeof(gid_t), &gid)) tmp -> st_gid = gid;
X else tmp -> st_gid = ((gp = findgid(0, buf))) ? gp -> gid : (gid_t)-1;
X # endif
X getfield(buf, line, skip, list, F_SIZE);
diff -urNP ../FD-2.08b/backend.c ./backend.c
--- ../FD-2.08b/backend.c Thu Mar 30 00:00:00 2006
+++ ./backend.c Wed May 24 00:00:00 2006
@@ -599,7 +599,7 @@
X memmove(&(pty[w].tabstop[i + 1]),
X &(pty[w].tabstop[i]),
X ((pty[w].ntabstop)++ - i)
- * sizeof(u_short));
+ * sizeof(u_short));
X pty[w].tabstop[i] = pty[w].cur_x;
X }
X break;
diff -urNP ../FD-2.08b/browse.c ./browse.c
--- ../FD-2.08b/browse.c Thu Mar 30 00:00:00 2006
+++ ./browse.c Wed May 24 00:00:00 2006
@@ -168,11 +168,11 @@
X static CONST u_short modelist[] = {
X S_IFDIR, S_IFLNK, S_IFSOCK, S_IFIFO, S_IFBLK, S_IFCHR
X };
-#define MAXMODELIST ((int)sizeof(modelist) / sizeof(u_short))
+#define MAXMODELIST arraysize(modelist)
X static CONST char suffixlist[] = {
X '/', '@', '=', '|'
X };
-#define MAXSUFFIXLIST ((int)sizeof(suffixlist) / sizeof(char))
+#define MAXSUFFIXLIST arraysize(suffixlist)
X #ifndef _NOCOLOR
X static CONST u_char colorlist[] = {
X CL_DIR, CL_LINK, CL_SOCK, CL_FIFO, CL_BLOCK, CL_CHAR
@@ -189,7 +189,7 @@
X ANSI_FG, /* CL_BLOCK */
X ANSI_FG, /* CL_CHAR */
X };
-#endif
+#endif /* !_NOCOLOR */
X #ifndef _NOPRECEDE
X static int maxstat = 0;
X static int haste = 0;
@@ -544,10 +544,9 @@
X
X i = 0;
X if (!notype) {
- for (j = 0; j < (int)sizeof(typelist) / sizeof(u_short); j++)
+ for (j = 0; j < arraysize(typelist); j++)
X if ((mode & S_IFMT) == typelist[j]) break;
- buf[i++] = (j < (int)sizeof(typelist) / sizeof(u_short))
- ? typesymlist[j] : '-';
+ buf[i++] = (j < arraysize(typelist)) ? typesymlist[j] : '-';
X }
X
X buf[i++] = (mode & S_IRUSR) ? 'r' : '-';
@@ -579,7 +578,7 @@
X {
X int i;
X
- for (i = 0; i < (int)sizeof(fflaglist) / sizeof(u_long); i++)
+ for (i = 0; i < arraysize(fflaglist); i++)
X buf[i] = (flags & fflaglist[i]) ? fflagsymlist[i] : '-';
X buf[i] = '\0';
X
diff -urNP ../FD-2.08b/builtin.c ./builtin.c
--- ../FD-2.08b/builtin.c Thu Mar 30 00:00:00 2006
+++ ./builtin.c Wed May 24 00:00:00 2006
@@ -174,7 +174,7 @@
X #define ER_NOTDUMBTERM 13
X "Cannot execute on dumb term",
X };
-#define BUILTINERRSIZ ((int)(sizeof(builtinerrstr) / sizeof(char *)))
+#define BUILTINERRSIZ arraysize(builtinerrstr)
X
X static CONST builtintable builtinlist[] = {
X #ifndef _NOARCHIVE
@@ -235,7 +235,7 @@
X # endif
X #endif /* _NOORIGSHELL */
X };
-#define BUILTINSIZ ((int)(sizeof(builtinlist) / sizeof(builtintable)))
+#define BUILTINSIZ arraysize(builtinlist)
X
X
X static VOID NEAR builtinerror(argv, s, n)
@@ -332,21 +332,21 @@
X if (c == 'f') {
X i = countvar(lp -> format);
X lp -> format = (char **)realloc2(lp -> format,
- sizeof(char *) * (i + 2));
+ (i + 2) * sizeof(char *));
X lp -> format[i++] = strdup2(cp);
X lp -> format[i] = NULL;
X }
X else if (c == 'i') {
X i = countvar(lp -> lignore);
X lp -> lignore = (char **)realloc2(lp -> lignore,
- sizeof(char *) * (i + 2));
+ (i + 2) * sizeof(char *));
X lp -> lignore[i++] = strdup2(cp);
X lp -> lignore[i] = NULL;
X }
X else if (c == 'e') {
X i = countvar(lp -> lerror);
X lp -> lerror = (char **)realloc2(lp -> lerror,
- sizeof(char *) * (i + 2));
+ (i + 2) * sizeof(char *));
X lp -> lerror[i++] = strdup2(cp);
X lp -> lerror[i] = NULL;
X }
@@ -487,7 +487,7 @@
X }
X
X if (i < argc) {
- lp -> format = (char **)malloc2(sizeof(char *) * 2);
+ lp -> format = (char **)malloc2(2 * sizeof(char *));
X lp -> format[0] = strdup2(argv[i]);
X lp -> format[1] = NULL;
X }
@@ -1642,7 +1642,7 @@
X }
X
X # ifdef HDDMOUNT
- if (!strncmp(argv[3], "HDD", sizeof("HDD") - 1)) {
+ if (!strncmp(argv[3], "HDD", strsize("HDD"))) {
X if (argc > 5) {
X devp -> drive = ER_FEWMANYARG;
X devp -> head = 0;
@@ -3159,7 +3159,7 @@
X return(0);
X }
X
- var = (char **)malloc2(sizeof(char *) * (n + 1));
+ var = (char **)malloc2((n + 1) * sizeof(char *));
X for (i = 0; i < n; i++) var[i] = list[i];
X var[i] = NULL;
X if (addfunction(strdup2(argv[FUNCNAME]), var) < 0) {
diff -urNP ../FD-2.08b/command.c ./command.c
--- ../FD-2.08b/command.c Thu Mar 30 00:00:00 2006
+++ ./command.c Wed May 24 00:00:00 2006
@@ -531,14 +531,13 @@
X if (!(filelist[filepos].linkname)) i = 0;
X else {
X i = strlen(filelist[filepos].linkname);
- if (i > (int)sizeof(tmp) - 1)
- i = (int)sizeof(tmp) - 1;
+ if (i > strsize(tmp)) i = strsize(tmp);
X strncpy(tmp, filelist[filepos].linkname, i);
X }
X }
X else
X # endif
- i = Xreadlink(fnodospath(path, filepos), tmp, sizeof(tmp) - 1);
+ i = Xreadlink(fnodospath(path, filepos), tmp, strsize(tmp));
X tmp[i] = '\0';
X i = 1 - (strlen3(tmp) + 4);
X }
@@ -1432,7 +1431,7 @@
X else if (isdir(&(filelist[filepos]))) return(warning_bell(arg));
X else {
X cp = DELFL_K;
- len = strlen2(cp) - ((int)sizeof("%.*s") - 1);
+ len = strlen2(cp) - strsize("%.*s");
X if (!yesno(cp, n_lastcolumn - len, filelist[filepos].name))
X return(FNC_CANCEL);
X filepos = applyfile(rmvfile, NULL);
@@ -1451,7 +1450,7 @@
X if (!isdir(&(filelist[filepos])) || isdotdir(filelist[filepos].name))
X return(warning_bell(arg));
X cp = DELDR_K;
- len = strlen2(cp) - ((int)sizeof("%.*s") - 1);
+ len = strlen2(cp) - strsize("%.*s");
X if (!yesno(cp, n_lastcolumn - len, filelist[filepos].name))
X return(FNC_CANCEL);
X removepolicy = 0;
diff -urNP ../FD-2.08b/custom.c ./custom.c
--- ../FD-2.08b/custom.c Thu Mar 30 00:00:00 2006
+++ ./custom.c Wed May 24 00:00:00 2006
@@ -461,7 +461,7 @@
X {"FD_NOCONVPATH", &noconvpath, DEFVAL(NOCONVPATH), NCVP_E, T_PATHS},
X #endif /* !_NOKANJIFCONV */
X };
-#define ENVLISTSIZ ((int)(sizeof(envlist) / sizeof(envtable)))
+#define ENVLISTSIZ arraysize(envlist)
X
X #ifndef _NOKANJIFCONV
X static pathtable pathlist[] = {
@@ -470,7 +470,7 @@
X {&progpath, NULL, NOCNV, P_STABLE},
X {&unitblpath, NULL, NOCNV, P_STABLE},
X };
-#define PATHLISTSIZ ((int)(sizeof(pathlist) / sizeof(pathtable)))
+#define PATHLISTSIZ arraysize(pathlist)
X # ifndef _NOSPLITWIN
X # ifndef _NOARCHIVE
X static pathtable archlist[MAXWINDOWS];
@@ -491,7 +491,7 @@
X {0xf8, "HDD(PC98)", 'N', 98, 0},
X # endif
X };
-#define MEDIADESCRSIZ ((int)(sizeof(mediadescr) / sizeof(devinfo)))
+#define MEDIADESCRSIZ arraysize(mediadescr)
X # endif /* _USEDOSEMU */
X static int cs_item = 0;
X static int cs_max = 0;
@@ -524,7 +524,7 @@
X {
X int n;
X
- if (!sscanf2(s, "%o%$", &n)) return(-1);
+ if (!sscanf2(s, "%<o%$", &n)) return(-1);
X n &= 0777;
X
X return(n);
@@ -2651,7 +2651,7 @@
X int i, n, max, val[4];
X
X max = countvar(var);
- for (i = 0; i < (int)sizeof(val) / sizeof(int); i++) val[i] = i;
+ for (i = 0; i < arraysize(val); i++) val[i] = i;
X
X list = (namelist *)malloc2((max + 1) * sizeof(namelist));
X mes = (char **)malloc2((max + 1) * sizeof(char *));
@@ -2692,8 +2692,7 @@
X str[2] = (n < max - 1) ? ARDWN_K : NULL;
X str[3] = ARDEL_K;
X i = 0;
- if (noselect(&i, sizeof(val) / sizeof(int), 0, str, val))
- continue;
+ if (noselect(&i, arraysize(val), 0, str, val)) continue;
X if (i == 0) {
X if (!(tmp = inputcuststr(prompt, 1, cp, -1)))
X continue;
@@ -2748,17 +2747,17 @@
X str[3] = "-i";
X str[4] = "-e";
X str[5] = ARDON_K;
- for (i = 0; i < (int)sizeof(val) / sizeof(int); i++) val[i] = i;
+ for (i = 0; i < arraysize(val); i++) val[i] = i;
X
X n = 0;
X for (;;) {
X verboselaunch(list);
X envcaption(ARSEL_K);
- if (noselect(&n, sizeof(val) / sizeof(int), 0, str, val)) {
+ if (noselect(&n, arraysize(val), 0, str, val)) {
X if (yesno(ARCAN_K)) return(0);
X continue;
X }
- if (n == (int)sizeof(val) / sizeof(int) - 1) {
+ if (n == arraysize(val) - 1) {
X if (!(list -> format)) {
X if (!yesno(ARNOT_K)) continue;
X freevar(list -> lignore);
@@ -3332,12 +3331,12 @@
X w1 = MAXCUSTVAL - 1 - width;
X # ifdef HDDMOUNT
X if (!fdtype[no].cyl) {
- char buf[sizeof("HDD98 #offset=") + MAXCOLSCOMMA(3)];
+ char buf[strsize("HDD98 #offset=") + MAXCOLSCOMMA(3) + 1];
X
X strcpy(buf, "HDD");
X if (isupper2(fdtype[no].head)) strcat(buf, "98");
X i = strlen(buf);
- snprintf2(&(buf[i]), sizeof(buf) - i, " #offset=%'Ld",
+ snprintf2(&(buf[i]), (int)sizeof(buf) - i, " #offset=%'Ld",
X fdtype[no].offset / fdtype[no].sect);
X cputstr(w1, buf);
X }
@@ -3686,7 +3685,7 @@
X
X strcpy(path, file);
X cp = getbasename(path);
- len = (int)sizeof(path) - 1 - (cp - path);
+ len = strsize(path) - (cp - path);
X if (len > MAXTNAMLEN) len = MAXTNAMLEN;
X genrandname(NULL, 0);
X
diff -urNP ../FD-2.08b/doscom.c ./doscom.c
--- ../FD-2.08b/doscom.c Thu Mar 30 00:00:00 2006
+++ ./doscom.c Wed May 24 00:00:00 2006
@@ -427,10 +427,10 @@
X #define ER_INVALIDSW 7
X "Invalid switch",
X };
-#define DOSERRSIZ ((int)(sizeof(doserrstr) / sizeof(char *)))
+#define DOSERRSIZ arraysize(doserrstr)
X
-static char dirsort[(sizeof(DIRSORTFLAG) - 1) * 2 + 1] = "";
-static char dirattr[(sizeof(DIRATTRFLAG) - 1) * 2 + 1] = "";
+static char dirsort[strsize(DIRSORTFLAG) * 2 + 1] = "";
+static char dirattr[strsize(DIRATTRFLAG) * 2 + 1] = "";
X static int dirline = 0;
X static char *dirwd = NULL;
X static int dirtype = '\0';
@@ -692,7 +692,7 @@
X char path[MAXPATHLEN];
X int len;
X
- if ((len = Xreadlink(src, path, sizeof(path) - 1)) < 0) return(-1);
+ if ((len = Xreadlink(src, path, strsize(path))) < 0) return(-1);
X if (Xlstat(dest, &st) >= 0) {
X # ifndef NODIRLOOP
X if (issamebody(src, dest)) return(0);
diff -urNP ../FD-2.08b/dosdisk.c ./dosdisk.c
--- ../FD-2.08b/dosdisk.c Thu Mar 30 00:00:00 2006
+++ ./dosdisk.c Wed May 24 00:00:00 2006
@@ -60,7 +60,7 @@
X #define D_SECSIZE(dl) (dl).d_secsize
X # ifdef BSD4
X # include <sys/disklabel.h>
-# else
+# else /* !BSD4 */
X # ifdef SOLARIS
X # include <sys/dkio.h>
X # include <sys/vtoc.h>
@@ -78,8 +78,8 @@
X # undef D_SECSIZE
X # define D_SECSIZE(dl) 512
X # endif
-# endif
-#endif
+# endif /* !BSD4 */
+#endif /* HDDMOUNT */
X
X #ifdef LINUX
X #include <mntent.h>
@@ -91,7 +91,7 @@
X # ifndef MOUNTED
X # define MOUNTED "/etc/mtab"
X # endif
-#endif
+#endif /* LINUX */
X
X #ifdef NOERRNO
X extern int errno;
@@ -103,7 +103,7 @@
X # else
X # define ENOTEMPTY EACCES
X # endif
-#endif
+#endif /* !ENOTEMPTY */
X
X #ifndef EPERM
X #define EPERM EACCES
@@ -140,6 +140,9 @@
X #define KC_SJIS2 0002
X #define KC_EUCJP 0010
X
+#define strsize(s) ((int)sizeof(s) - 1)
+#define arraysize(a) ((int)sizeof(a) / (int)sizeof(*(a)))
+
X #define reterr(c) {errno = doserrno; return(c);}
X #define S_IEXEC_ALL (S_IEXEC | (S_IEXEC >> 3) | (S_IEXEC >> 6))
X #define ENDCLUST ((long)(0x0fffffff))
@@ -456,10 +459,10 @@
X static int doserrno = 0;
X #if !MSDOS
X static CONST short sectsizelist[] = SECTSIZE;
-#define SLISTSIZ ((int)(sizeof(sectsizelist) / sizeof(short)))
+#define SLISTSIZ arraysize(sectsizelist)
X #endif
X static CONST char *inhibitname[] = INHIBITNAME;
-#define INHIBITNAMESIZ ((int)(sizeof(inhibitname) / sizeof(char *)))
+#define INHIBITNAMESIZ arraysize(inhibitname)
X #ifndef FD
X typedef struct _kconv_t {
X u_short start;
@@ -501,7 +504,7 @@
X {0xfa54, 0x81ca, 0x01}, /* full width not sign */
X {0xfa5b, 0x81e6, 0x01}, /* because */
X };
-#define RSJISTBLSIZ ((int)(sizeof(rsjistable) / sizeof(kconv_t)))
+#define RSJISTBLSIZ arraysizeof(rsjistable)
X #endif /* !FD */
X
X
@@ -832,8 +835,7 @@
X if (i > 0) {
X i--;
X i *= (int)sizeof(char);
- i += (int)sizeof(struct tzhead)
- + ntime * (int)sizeof(char) * 4;
+ i += (int)sizeof(struct tzhead) + ntime * 4 * sizeof(char);
X if (fseek(fp, i, 0) < 0
X || fread(&c, sizeof(char), 1, fp) != 1) {
X fclose(fp);
@@ -841,8 +843,8 @@
X }
X i = c;
X }
- i *= (int)sizeof(char) * (4 + 1 + 1);
- i += (int)sizeof(struct tzhead) + ntime * (int)sizeof(char) * (4 + 1);
+ i *= (4 + 1 + 1) * sizeof(char);
+ i += (int)sizeof(struct tzhead) + ntime * (4 + 1) * sizeof(char);
X if (fseek(fp, i, 0) < 0
X || fread(buf, sizeof(char), 4, fp) != 4) {
X fclose(fp);
@@ -851,9 +853,9 @@
X tmp = char2long(buf);
X tz = -tmp;
X
- i = (int)sizeof(struct tzhead) + ntime * (int)sizeof(char) * (4 + 1)
- + ntype * (int)sizeof(char) * (4 + 1 + 1)
- + nchar * (int)sizeof(char);
+ i = (int)sizeof(struct tzhead) + ntime * (4 + 1) * sizeof(char)
+ + ntype * (4 + 1 + 1) * sizeof(char)
+ + nchar * sizeof(char);
X if (fseek(fp, i, 0) < 0) {
X fclose(fp);
X return(tz);
@@ -2914,12 +2916,12 @@
X buf[i] = '\0';
X
X if (vol > 1 || (vol > 0 && cnv)) {
- for (j = 0; j < (int)sizeof(num) / sizeof(char); j++) {
+ for (j = 0; j < arraysize(num); j++) {
X if (!vol) break;
X num[j] = (vol % 10) + '0';
X vol /= 10;
X }
- for (i = (int)sizeof(num) / sizeof(char) - j; i > 0; i--)
+ for (i = arraysize(num) - j; i > 0; i--)
X if (buf[i - 1] != ' ') break;
X buf[i++] = '~';
X while (j-- > 0) buf[i++] = num[j];
@@ -3815,14 +3817,14 @@
X for (i = 0; i < INHIBITNAMESIZ; i++)
X if (!strncmp((char *)fname, inhibitname[i], 8)) break;
X if (i < INHIBITNAMESIZ
- || (!strncmp((char *)fname, INHIBITCOM, sizeof(INHIBITCOM) - 2)
- && fname[sizeof(INHIBITCOM) - 1] > '0'
- && fname[sizeof(INHIBITCOM) - 1] <= '0' + INHIBITCOMMAX
- && fname[sizeof(INHIBITCOM)] == ' ')
- || (!strncmp((char *)fname, INHIBITLPT, sizeof(INHIBITLPT) - 2)
- && fname[sizeof(INHIBITLPT) - 1] > '0'
- && fname[sizeof(INHIBITLPT) - 1] <= '0' + INHIBITLPTMAX
- && fname[sizeof(INHIBITLPT)] == ' ')) {
+ || (!strncmp((char *)fname, INHIBITCOM, strsize(INHIBITCOM))
+ && fname[strsize(INHIBITCOM)] > '0'
+ && fname[strsize(INHIBITCOM)] <= '0' + INHIBITCOMMAX
+ && fname[strsize(INHIBITCOM) + 1] == ' ')
+ || (!strncmp((char *)fname, INHIBITLPT, strsize(INHIBITLPT))
+ && fname[strsize(INHIBITLPT)] > '0'
+ && fname[strsize(INHIBITLPT)] <= '0' + INHIBITLPTMAX
+ && fname[strsize(INHIBITLPT) + 1] == ' ')) {
X _dosclosedir(xdirp);
X doserrno = EINVAL;
X return(-1);
@@ -4072,11 +4074,11 @@
X }
X avail = (long)(devlist[dd].availsize);
X
- *((long *)&(buf[sizeof(long) * 0])) = block;
- *((long *)&(buf[sizeof(long) * 1])) = total;
- *((long *)&(buf[sizeof(long) * 2])) = avail;
- buf[sizeof(long) * 3] = 0;
- if (devlist[dd].flags & F_FAT32) buf[sizeof(long) * 3] |= 001;
+ *((long *)&(buf[0 * sizeof(long)])) = block;
+ *((long *)&(buf[1 * sizeof(long)])) = total;
+ *((long *)&(buf[2 * sizeof(long)])) = avail;
+ buf[3 * sizeof(long)] = 0;
+ if (devlist[dd].flags & F_FAT32) buf[3 * sizeof(long)] |= 001;
X closedev(dd);
X
X return(0);
@@ -4281,7 +4283,7 @@
X sum = calcsum(dd2dentp(dd) -> name);
X memcpy((char *)&(fd2dentp(fd) -> attr),
X (char *)&(dd2dentp(dd) -> attr),
- sizeof(dent_t) - (8 + 3));
+ (int)sizeof(dent_t) - (8 + 3));
X *(dd2dentp(dd) -> name) = 0xe5;
X *dd2path(dd) = '\0';
X
@@ -4669,7 +4671,7 @@
X dent[1].clust_h[1] = (clust >> 24) & 0xff;
X }
X
- if (doswrite(fd + DOSFDOFFSET, (char *)dent, sizeof(dent_t) * 2) < 0) {
+ if (doswrite(fd + DOSFDOFFSET, (char *)dent, 2 * sizeof(dent_t)) < 0) {
X tmp = errno;
X if ((clust = clust32(fd2devp(fd), &(dosflist[fd]._dent))))
X clustfree(fd2devp(fd), clust);
diff -urNP ../FD-2.08b/dosdisk.h ./dosdisk.h
--- ../FD-2.08b/dosdisk.h Thu Mar 30 00:00:00 2006
+++ ./dosdisk.h Wed May 24 00:00:00 2006
@@ -37,7 +37,7 @@
X #define INHIBITLPTMAX 9 /* Windows will avoid LPT4-LPT9 */
X
X #define MAXDRIVEENTRY 32
-#define DOSFDOFFSET (1 << (8 * (int)sizeof(int) - 2))
+#define DOSFDOFFSET (1 << (8 * sizeof(int) - 2))
X #ifdef NOFILE
X #define DOSNOFILE NOFILE
X #else
@@ -317,7 +317,7 @@
X
X #if defined (DNAMESIZE) && DNAMESIZE < (MAXNAMLEN + 1)
X typedef struct _st_dirent {
- char buf[sizeof(struct dirent) - DNAMESIZE + MAXNAMLEN + 1];
+ char buf[(int)sizeof(struct dirent) - DNAMESIZE + MAXNAMLEN + 1];
X } st_dirent;
X #else
X typedef struct dirent st_dirent;
diff -urNP ../FD-2.08b/dosemu.c ./dosemu.c
--- ../FD-2.08b/dosemu.c Thu Mar 30 00:00:00 2006
+++ ./dosemu.c Wed May 24 00:00:00 2006
@@ -16,7 +16,7 @@
X #ifdef _NODOSDRIVE
X # if defined (DNAMESIZE) && DNAMESIZE < (MAXNAMLEN + 1)
X typedef struct _st_dirent {
- char buf[sizeof(struct dirent) - DNAMESIZE + MAXNAMLEN + 1];
+ char buf[(int)sizeof(struct dirent) - DNAMESIZE + MAXNAMLEN + 1];
X } st_dirent;
X # else
X typedef struct dirent st_dirent;
@@ -124,8 +124,8 @@
X dirpathlist[maxdirpath - 1].path = strdup2(cp);
X #endif
X #ifdef CYGWIN
-#define opendir_saw_u_cygdrive (1 << (8 * (int)sizeof(dirp -> __flags) - 2))
-#define opendir_saw_s_cygdrive (1 << (8 * (int)sizeof(dirp -> __flags) - 3))
+#define opendir_saw_u_cygdrive (1 << (8 * sizeof(dirp -> __flags) - 2))
+#define opendir_saw_s_cygdrive (1 << (8 * sizeof(dirp -> __flags) - 3))
X if (buf[0] != _SC_ || buf[1])
X dirp -> __flags |=
X opendir_saw_u_cygdrive | opendir_saw_s_cygdrive;
diff -urNP ../FD-2.08b/fd.h ./fd.h
--- ../FD-2.08b/fd.h Thu Mar 30 00:00:00 2006
+++ ./fd.h Wed May 24 00:00:00 2006
@@ -88,7 +88,7 @@
X
X #define FDSHELL "fdsh"
X #define FDENV "FD_"
-#define FDESIZ (sizeof(FDENV) - 1)
+#define FDESIZ strsize(FDENV)
X
X /****************************************************************
X * If you don't like the following tools as each uses, *
@@ -262,9 +262,9 @@
X #define S_BYTES " bytes"
X #define S_KBYTES " KB"
X #define S_MBYTES " MB"
-#define W_BYTES (sizeof(S_BYTES) - 1)
-#define W_KBYTES (sizeof(S_KBYTES) - 1)
-#define W_MBYTES (sizeof(S_MBYTES) - 1)
+#define W_BYTES strsize(S_BYTES)
+#define W_KBYTES strsize(S_KBYTES)
+#define W_MBYTES strsize(S_MBYTES)
X #define S_PAGE "Page:"
X #define S_MARK "Mark:"
X #define S_INFO ""
@@ -289,30 +289,30 @@
X #define TS_TOTAL "Total:"
X #define TS_USED "Used:"
X #define TS_FREE "Free:"
-#define W_PAGE (sizeof(S_PAGE) - 1)
-#define W_MARK (sizeof(S_MARK) - 1)
-#define W_INFO (sizeof(S_INFO) - 1)
-#define W_SORT (sizeof(S_SORT) - 1)
-#define W_FIND (sizeof(S_FIND) - 1)
-#define W_PATH (sizeof(S_PATH) - 1)
-#define W_BROWSE (sizeof(S_BROWSE) - 1)
-#define W_ARCH (sizeof(S_ARCH) - 1)
-#define W_SIZE (sizeof(S_SIZE) - 1)
-#define W_TOTAL (sizeof(S_TOTAL) - 1)
-#define W_USED (sizeof(S_USED) - 1)
-#define W_FREE (sizeof(S_FREE) - 1)
-#define TW_PAGE (sizeof(TS_PAGE) - 1)
-#define TW_MARK (sizeof(TS_MARK) - 1)
-#define TW_INFO (sizeof(TS_INFO) - 1)
-#define TW_SORT (sizeof(TS_SORT) - 1)
-#define TW_FIND (sizeof(TS_FIND) - 1)
-#define TW_PATH (sizeof(TS_PATH) - 1)
-#define TW_BROWSE (sizeof(TS_BROWSE) - 1)
-#define TW_ARCH (sizeof(TS_ARCH) - 1)
-#define TW_SIZE (sizeof(TS_SIZE) - 1)
-#define TW_TOTAL (sizeof(TS_TOTAL) - 1)
-#define TW_USED (sizeof(TS_USED) - 1)
-#define TW_FREE (sizeof(TS_FREE) - 1)
+#define W_PAGE strsize(S_PAGE)
+#define W_MARK strsize(S_MARK)
+#define W_INFO strsize(S_INFO)
+#define W_SORT strsize(S_SORT)
+#define W_FIND strsize(S_FIND)
+#define W_PATH strsize(S_PATH)
+#define W_BROWSE strsize(S_BROWSE)
+#define W_ARCH strsize(S_ARCH)
+#define W_SIZE strsize(S_SIZE)
+#define W_TOTAL strsize(S_TOTAL)
+#define W_USED strsize(S_USED)
+#define W_FREE strsize(S_FREE)
+#define TW_PAGE strsize(TS_PAGE)
+#define TW_MARK strsize(TS_MARK)
+#define TW_INFO strsize(TS_INFO)
+#define TW_SORT strsize(TS_SORT)
+#define TW_FIND strsize(TS_FIND)
+#define TW_PATH strsize(TS_PATH)
+#define TW_BROWSE strsize(TS_BROWSE)
+#define TW_ARCH strsize(TS_ARCH)
+#define TW_SIZE strsize(TS_SIZE)
+#define TW_TOTAL strsize(TS_TOTAL)
+#define TW_USED strsize(TS_USED)
+#define TW_FREE strsize(TS_FREE)
X #define D_PAGE 2
X #define D_MARK 4
X #define D_INFO 0
diff -urNP ../FD-2.08b/fd.man ./fd.man
--- ../FD-2.08b/fd.man Thu Mar 30 00:00:00 2006
+++ ./fd.man Wed May 24 00:00:00 2006
@@ -1,10 +1,10 @@
X .\"
-.\" Copyright (c) 1995-2006 Takashi SHIRAI
+.\" Copyright (C) 1995-2006 Takashi SHIRAI
X .\" <shirai@unixusers.net>
X .\"
-.\" @(#)fd.1 2.08b 03/30/06
+.\" @(#)fd.1 2.08c 05/24/06
X .\" fd - File & Directory maintenance tool
-.TH FD 1 "March 30, 2006"
+.TH FD 1 "May 24, 2006"
X .de sh
X .br
X .PP
diff -urNP ../FD-2.08b/fd_e.man ./fd_e.man
--- ../FD-2.08b/fd_e.man Thu Mar 30 00:00:00 2006
+++ ./fd_e.man Wed May 24 00:00:00 2006
@@ -1,10 +1,10 @@
X .\"
-.\" Copyright (c) 1995-2006 Takashi SHIRAI
+.\" Copyright (C) 1995-2006 Takashi SHIRAI
X .\" <shirai@unixusers.net>
X .\"
-.\" @(#)fd.1 2.08b 03/30/06
+.\" @(#)fd.1 2.08c 05/24/06
X .\" fd - File & Directory maintenance tool
-.TH FD 1 "March 30, 2006"
+.TH FD 1 "May 24, 2006"
X .de sh
X .br
X .PP
diff -urNP ../FD-2.08b/file.c ./file.c
--- ../FD-2.08b/file.c Thu Mar 30 00:00:00 2006
+++ ./file.c Wed May 24 00:00:00 2006
@@ -679,7 +679,7 @@
X char path[MAXPATHLEN];
X int len;
X
- if ((len = Xreadlink(src, path, sizeof(path) - 1)) < 0) return(-1);
+ if ((len = Xreadlink(src, path, strsize(path))) < 0) return(-1);
X if (Xlstat(dest, &st) >= 0) {
X # ifndef NODIRLOOP
X if (issamebody(src, dest)) return(0);
@@ -858,8 +858,8 @@
X int i, j, c;
X
X if (!buf) {
- for (i = 0; i < (int)sizeof(seq) / sizeof(char); i++) {
- j = genrand(sizeof(seq) / sizeof(char));
+ for (i = 0; i < arraysize(seq); i++) {
+ j = genrand(arraysize(seq));
X c = seq[i];
X seq[i] = seq[j];
X seq[j] = c;
@@ -867,7 +867,7 @@
X }
X else {
X for (i = 0; i < len; i++) {
- j = genrand(sizeof(seq) / sizeof(char));
+ j = genrand(arraysize(seq));
X buf[i] = seq[j];
X }
X buf[i] = '\0';
@@ -911,9 +911,9 @@
X }
X }
X if (!tmpfilename) {
- n = (int)sizeof(TMPPREFIX) - 1;
+ n = strsize(TMPPREFIX);
X strncpy(cp, TMPPREFIX, n);
- len = (int)sizeof(path) - 1 - (cp - path);
+ len = strsize(path) - (cp - path);
X if (len > MAXTMPNAMLEN) len = MAXTMPNAMLEN;
X len -= n;
X genrandname(NULL, 0);
@@ -932,7 +932,7 @@
X }
X
X strncpy((cp = strcatdelim(path)), dir, n);
- len = (int)sizeof(path) - 1 - (cp - path);
+ len = strsize(path) - (cp - path);
X if (len > MAXTMPNAMLEN) len = MAXTMPNAMLEN;
X len -= n;
X genrandname(NULL, 0);
@@ -986,7 +986,7 @@
X path[0] = '\0';
X if (mktmpdir(path) < 0) return(-1);
X cp = strcatdelim(path);
- len = (int)sizeof(path) - 1 - (cp - path);
+ len = strsize(path) - (cp - path);
X if (len > MAXTMPNAMLEN) len = MAXTMPNAMLEN;
X genrandname(NULL, 0);
X
diff -urNP ../FD-2.08b/func.h ./func.h
--- ../FD-2.08b/func.h Thu Mar 30 00:00:00 2006
+++ ./func.h Wed May 24 00:00:00 2006
@@ -65,7 +65,7 @@
X #define getconstvar(s) (char *)getenv(s)
X #define getshellvar(s, l) (char *)getenv(s)
X #else
-#define getconstvar(s) (getshellvar(s, sizeof(s) - 1))
+#define getconstvar(s) (getshellvar(s, strsize(s)))
X #endif
X
X #ifdef USESTRERROR
@@ -380,9 +380,7 @@
X extern struct dirent *searchdir __P_((DIR *, reg_t *, char *));
X extern int underhome __P_((char *));
X extern int preparedir __P_((char *));
-#ifdef NOFLOCK
-#define lockfile(f, m)
-#else
+#ifndef NOFLOCK
X extern int lockfile __P_((int, int));
X #endif
X extern int touchfile __P_((char *, struct stat *));
diff -urNP ../FD-2.08b/info.c ./info.c
--- ../FD-2.08b/info.c Thu Mar 30 00:00:00 2006
+++ ./info.c Wed May 24 00:00:00 2006
@@ -17,10 +17,6 @@
X #include <sys/dir.h>
X #endif
X
-#if defined (USESTATVFSH) || defined (USEGETVFSTAT)
-#include <sys/statvfs.h>
-#endif
-
X #if MSDOS
X #undef USEVFSH
X #undef USEMNTENTH
@@ -83,7 +79,7 @@
X } mnt_t;
X static FILE *NEAR setmntent2 __P_((char *, char *));
X static mnt_t *NEAR getmntent2 __P_((FILE *, mnt_t *));
-#define hasmntopt2(mntp, opt) strmntopt((mntp) -> mnt_opts, opt)
+#define hasmntopt2(m,o) strmntopt((m) -> mnt_opts, o)
X # if defined (USEMNTINFO) || defined (USEGETMNT)
X # define endmntent2(f)
X # else
@@ -97,9 +93,9 @@
X #ifdef USEGETFSENT
X #include <fstab.h>
X typedef struct fstab mnt_t;
-#define setmntent2(file, mode) (FILE *)(setfsent(), NULL)
-#define getmntent2(fp, mntp) getfsent()
-#define hasmntopt2(mntp, opt) strmntopt((mntp) -> fs_mntops, opt)
+#define setmntent2(f,m) (FILE *)(setfsent(), NULL)
+#define getmntent2(f,m) getfsent()
+#define hasmntopt2(m,o) strmntopt((m) -> fs_mntops, o)
X #define endmntent2(fp) endfsent()
X #define mnt_dir fs_file
X #define mnt_fsname fs_spec
@@ -113,7 +109,7 @@
X char *mnt_type;
X char *mnt_opts;
X } mnt_t;
-#define hasmntopt2(mntp, opt) strmntopt((mntp) -> mnt_opts, opt)
+#define hasmntopt2(m,o) strmntopt((m) -> mnt_opts, o)
X # ifdef PC98
X # define PT_FAT12 0x81 /* 0x80 | 0x01 */
X # define PT_FAT16 0x91 /* 0x80 | 0x11 */
@@ -128,6 +124,9 @@
X # endif
X #endif /* MSDOS */
X
+#if defined (USESTATVFSH) || defined (USEGETVFSTAT)
+#include <sys/statvfs.h>
+#endif
X
X #ifdef USESTATVFSH
X # ifdef USESTATVFS_T
@@ -337,7 +336,7 @@
X K_BEG, K_EOL, K_NPAGE, K_PPAGE, K_CLR, K_ENTER, K_HELP,
X K_BS, '\t', K_CR, K_ESC
X };
-#define KEYCODESIZ ((int)(sizeof(keycodelist) / sizeof(int)))
+#define KEYCODESIZ arraysize(keycodelist)
X static CONST char *keystrlist[] = {
X "Home", "End", "DelLin", "InsLin", "Del", "Ins",
X "Beg", "Eol", "PageDn", "PageUp", "Clr", "Enter", "Help",
@@ -379,7 +378,7 @@
X # endif
X #endif /* !MSDOS */
X };
-#define MNTLISTSIZ ((int)(sizeof(mntlist) / sizeof(strtable)))
+#define MNTLISTSIZ arraysize(mntlist)
X
X
X static int NEAR code2str(buf, code)
@@ -585,7 +584,7 @@
X #endif
X
X #if !defined (MNT_RDONLY) && defined (M_RDONLY)
-#define MNT_RDONLY M_RDONLY
+#define MNT_RDONLY M_RDONLY
X #endif
X
X /*ARGSUSED*/
@@ -823,13 +822,13 @@
X if (!mntbuf) mntbuf = &mnt;
X
X dir = NULL;
- if (!strncmp(path, "/dev/", sizeof("/dev/") - 1)) {
+ if (!strncmp(path, "/dev/", strsize("/dev/"))) {
X if (_chdir2(path) < 0) dir = path;
X }
X # ifndef _NODOSDRIVE
X else if ((drv = dospath(path, NULL))) {
X static char dosmntdir[4];
- char buf[sizeof(long) * 3 + 1];
+ char buf[3 * sizeof(long) + 1];
X
X mntbuf -> mnt_fsname = nullstr;
X mntbuf -> mnt_dir = dosmntdir;
@@ -839,22 +838,22 @@
X (islower2(drv)) ? MNTTYPE_DOS7 : MNTTYPE_PC;
X mntbuf -> mnt_opts = nullstr;
X if (dosstatfs(drv, buf) < 0) return(-1);
- if (buf[sizeof(long) * 3] & 001)
+ if (buf[3 * sizeof(long)] & 001)
X mntbuf -> mnt_type = MNTTYPE_FAT32;
- fsbuf -> f_bsize = *((long *)&(buf[sizeof(long) * 0]));
+ fsbuf -> f_bsize = *((long *)&(buf[0 * sizeof(long)]));
X # ifdef USEFSDATA
X fsbuf -> fd_req.btot = calcKB((off_t)(fsbuf -> f_bsize),
- (off_t)(*((long *)&(buf[sizeof(long) * 1]))));
+ (off_t)(*((long *)&(buf[1 * sizeof(long)]))));
X fsbuf -> fd_req.bfree =
X fsbuf -> fd_req.bfreen = calcKB((off_t)(fsbuf -> f_bsize),
- (off_t)(*((long *)&(buf[sizeof(long) * 2]))));
+ (off_t)(*((long *)&(buf[2 * sizeof(long)]))));
X # else /* !USEFSDATA */
X # ifdef USESTATVFSH
X fsbuf -> f_frsize = 0L;
X # endif
- fsbuf -> f_blocks = *((long *)&(buf[sizeof(long) * 1]));
+ fsbuf -> f_blocks = *((long *)&(buf[1 * sizeof(long)]));
X fsbuf -> f_bfree =
- fsbuf -> f_bavail = *((long *)&(buf[sizeof(long) * 2]));
+ fsbuf -> f_bavail = *((long *)&(buf[2 * sizeof(long)]));
X # endif /* !USEFSDATA */
X fsbuf -> f_files = -1L;
X
diff -urNP ../FD-2.08b/input.c ./input.c
--- ../FD-2.08b/input.c Thu Mar 30 00:00:00 2006
+++ ./input.c Wed May 24 00:00:00 2006
@@ -34,7 +34,7 @@
X
X #define LIMITSELECTWARN 100
X #define YESNOSTR "[Y/N]"
-#define YESNOSIZE ((int)sizeof(YESNOSTR) - 1)
+#define YESNOSIZE strsize(YESNOSTR)
X #define WAITAFTERWARN 360 /* msec */
X #define maxscr() (maxcol * (maxline - minline) \
X - plen - (n_column - n_lastcolumn))
@@ -143,7 +143,7 @@
X K_HOME, K_END, K_BEG, K_EOL,
X K_PPAGE, K_NPAGE, K_ENTER, K_ESC
X };
-#define EMULATEKEYSIZ ((int)(sizeof(emulatekey) / sizeof(int)))
+#define EMULATEKEYSIZ arraysize(emulatekey)
X static CONST char emacskey[] = {
X K_CTRL('P'), K_CTRL('N'), K_CTRL('F'), K_CTRL('B'),
X K_ESC, K_CTRL('D'), K_CTRL('Q'), K_CTRL('K'),
diff -urNP ../FD-2.08b/kanji.c ./kanji.c
--- ../FD-2.08b/kanji.c Thu Mar 30 00:00:00 2006
+++ ./kanji.c Wed May 24 00:00:00 2006
@@ -208,7 +208,7 @@
X {"C", ENG},
X # endif /* _NOENGMES */
X };
-#define MAXLANGLIST ((int)sizeof(langlist) / sizeof(langtable))
+#define MAXLANGLIST arraysize(langlist)
X #endif /* !_NOKANJICONV || (!_NOENGMES && !_NOJPNMES) */
X
X #if !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
@@ -247,7 +247,7 @@
X {0xfa54, 0x81ca, 0x01}, /* full width not sign */
X {0xfa5b, 0x81e6, 0x01}, /* because */
X };
-#define RSJISTBLSIZ ((int)(sizeof(rsjistable) / sizeof(kconv_t)))
+#define RSJISTBLSIZ arraysize(rsjistable)
X #endif /* !_NOKANJICONV || (FD && !_NODOSDRIVE) */
X #if !defined (_NOKANJICONV) \
X || (defined (FD) && defined (_USEDOSEMU) && defined (CODEEUC))
@@ -271,7 +271,7 @@
X {0xfb9c, 0xee80, 0x61}, /* IBM extensions */
X {0xfc40, 0xeee1, 0x0c} /* IBM extensions */
X };
-#define CNVTBLSIZ ((int)(sizeof(convtable) / sizeof(kconv_t)))
+#define CNVTBLSIZ arraysize(convtable)
X static CONST u_char sj2jtable1[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 */
@@ -456,7 +456,7 @@
X {&utf8macpath, M_UTF8},
X {&noconvpath, NOCNV},
X };
-#define MAXKPATHLIST ((int)sizeof(kpathlist) / sizeof(kpathtable))
+#define MAXKPATHLIST arraysize(kpathlist)
X #endif /* !_NOKANJIFCONV */
X
X #ifndef FD
diff -urNP ../FD-2.08b/libc.c ./libc.c
--- ../FD-2.08b/libc.c Thu Mar 30 00:00:00 2006
+++ ./libc.c Wed May 24 00:00:00 2006
@@ -676,7 +676,7 @@
X {
X int n;
X
- if (!sscanf2(s, "%d%$", &n)) return(-1);
+ if (!sscanf2(s, "%<d%$", &n)) return(-1);
X
X return(n);
X }
@@ -1083,8 +1083,7 @@
X if (i > 0) {
X i--;
X i *= (int)sizeof(char);
- i += (int)sizeof(struct tzhead)
- + ntime * (int)sizeof(char) * 4;
+ i += (int)sizeof(struct tzhead) + ntime * 4 * sizeof(char);
X if (fseek(fp, i, 0) < 0
X || fread(&c, sizeof(char), 1, fp) != 1) {
X fclose(fp);
@@ -1092,8 +1091,8 @@
X }
X i = c;
X }
- i *= (int)sizeof(char) * (4 + 1 + 1);
- i += (int)sizeof(struct tzhead) + ntime * (int)sizeof(char) * (4 + 1);
+ i *= (4 + 1 + 1) * sizeof(char);
+ i += (int)sizeof(struct tzhead) + ntime * (4 + 1) * sizeof(char);
X if (fseek(fp, i, 0) < 0
X || fread(buf, sizeof(char), 4, fp) != 4) {
X fclose(fp);
@@ -1102,9 +1101,9 @@
X tmp = char2long(buf);
X tz = -tmp;
X
- i = (int)sizeof(struct tzhead) + ntime * (int)sizeof(char) * (4 + 1)
- + ntype * (int)sizeof(char) * (4 + 1 + 1)
- + nchar * (int)sizeof(char);
+ i = (int)sizeof(struct tzhead) + ntime * (4 + 1) * sizeof(char)
+ + ntype * (4 + 1 + 1) * sizeof(char)
+ + nchar * sizeof(char);
X if (fseek(fp, i, 0) < 0) {
X fclose(fp);
X return(tz);
diff -urNP ../FD-2.08b/log.c ./log.c
--- ../FD-2.08b/log.c Thu Mar 30 00:00:00 2006
+++ ./log.c Wed May 24 00:00:00 2006
@@ -156,12 +156,14 @@
X tm -> tm_hour, tm -> tm_min, tm -> tm_sec,
X getuid(), progname, getpid());
X #endif
- write(fd, hbuf, n);
- write(fd, buf, len);
+ VOID_C write(fd, hbuf, n);
+ VOID_C write(fd, buf, len);
X uc = '\n';
- write(fd, &uc, sizeof(uc));
- lockfile(fd, LCK_UNLOCK);
- close(fd);
+ VOID_C write(fd, &uc, sizeof(uc));
+#ifndef NOFLOCK
+ VOID_C lockfile(fd, LCK_UNLOCK);
+#endif
+ VOID_C close(fd);
X }
X #ifndef NOSYSLOG
X if (usesyslog && syslogged >= 0) {
@@ -200,9 +202,9 @@
X va_end(args);
X
X if (len >= 0) {
- if (val >= 0) n = snprintf2(&(buf[len]), sizeof(buf) - len,
- " succeeded");
- else n = snprintf2(&(buf[len]), sizeof(buf) - len,
+ if (val >= 0) n = snprintf2(&(buf[len]),
+ (int)sizeof(buf) - len, " succeeded");
+ else n = snprintf2(&(buf[len]), (int)sizeof(buf) - len,
X " -- FAILED -- (%k)", strerror2(duperrno));
X if (n < 0) buf[len] = '\0';
X else len += n;
diff -urNP ../FD-2.08b/machine.h ./machine.h
--- ../FD-2.08b/machine.h Thu Mar 30 00:00:00 2006
+++ ./machine.h Wed May 24 00:00:00 2006
@@ -368,6 +368,7 @@
X #define USEMNTCTL
X #define USERE_COMP
X # if defined (_AIX41)
+# define HAVELONGLONG
X # define USESTATVFSH
X # define USEMKTIME
X # define SIGFNCINT
diff -urNP ../FD-2.08b/main.c ./main.c
--- ../FD-2.08b/main.c Thu Mar 30 00:00:00 2006
+++ ./main.c Wed May 24 00:00:00 2006
@@ -856,7 +856,7 @@
X for (i = 1; argv && argv[i]; i++) {
X if (cp > buf) *(cp++) = ' ';
X tmp = killmeta(argv[i]);
- len = snprintf2(cp, sizeof(buf) - (cp - buf), "%s", tmp);
+ len = snprintf2(cp, (int)sizeof(buf) - (cp - buf), "%s", tmp);
X free(tmp);
X if (len < 0) break;
X cp += len;
diff -urNP ../FD-2.08b/makefile.b98 ./makefile.b98
--- ../FD-2.08b/makefile.b98 Thu Mar 30 00:00:00 2006
+++ ./makefile.b98 Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.obj: printf.h
X printf.obj: kctype.h
X termio.obj: machine.h config.h
-termio.obj: termio.h
+termio.obj: printf.h termio.h
X term.obj: machine.h config.h
X term.obj: printf.h
X term.obj: kctype.h
diff -urNP ../FD-2.08b/makefile.bpc ./makefile.bpc
--- ../FD-2.08b/makefile.bpc Thu Mar 30 00:00:00 2006
+++ ./makefile.bpc Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.obj: printf.h
X printf.obj: kctype.h
X termio.obj: machine.h config.h
-termio.obj: termio.h
+termio.obj: printf.h termio.h
X term.obj: machine.h config.h
X term.obj: printf.h
X term.obj: kctype.h
diff -urNP ../FD-2.08b/makefile.d98 ./makefile.d98
--- ../FD-2.08b/makefile.d98 Thu Mar 30 00:00:00 2006
+++ ./makefile.d98 Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.o: printf.h
X printf.o: kctype.h
X termio.o: machine.h config.h
-termio.o: termio.h
+termio.o: printf.h termio.h
X term.o: machine.h config.h
X term.o: printf.h
X term.o: kctype.h
diff -urNP ../FD-2.08b/makefile.dpc ./makefile.dpc
--- ../FD-2.08b/makefile.dpc Thu Mar 30 00:00:00 2006
+++ ./makefile.dpc Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.o: printf.h
X printf.o: kctype.h
X termio.o: machine.h config.h
-termio.o: termio.h
+termio.o: printf.h termio.h
X term.o: machine.h config.h
X term.o: printf.h
X term.o: kctype.h
diff -urNP ../FD-2.08b/makefile.g98 ./makefile.g98
--- ../FD-2.08b/makefile.g98 Thu Mar 30 00:00:00 2006
+++ ./makefile.g98 Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.o: printf.h
X printf.o: kctype.h
X termio.o: machine.h config.h
-termio.o: termio.h
+termio.o: printf.h termio.h
X term.o: machine.h config.h
X term.o: printf.h
X term.o: kctype.h
diff -urNP ../FD-2.08b/makefile.gpc ./makefile.gpc
--- ../FD-2.08b/makefile.gpc Thu Mar 30 00:00:00 2006
+++ ./makefile.gpc Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.o: printf.h
X printf.o: kctype.h
X termio.o: machine.h config.h
-termio.o: termio.h
+termio.o: printf.h termio.h
X term.o: machine.h config.h
X term.o: printf.h
X term.o: kctype.h
diff -urNP ../FD-2.08b/makefile.l98 ./makefile.l98
--- ../FD-2.08b/makefile.l98 Thu Mar 30 00:00:00 2006
+++ ./makefile.l98 Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.obj: printf.h
X printf.obj: kctype.h
X termio.obj: machine.h config.h
-termio.obj: termio.h
+termio.obj: printf.h termio.h
X term.obj: machine.h config.h
X term.obj: printf.h
X term.obj: kctype.h
diff -urNP ../FD-2.08b/makefile.lpc ./makefile.lpc
--- ../FD-2.08b/makefile.lpc Thu Mar 30 00:00:00 2006
+++ ./makefile.lpc Wed May 24 00:00:00 2006
@@ -4,7 +4,7 @@
X
X TITLE = FD-
X VERMAJ = 2
-VERSION = 2.08b
+VERSION = 2.08c
X PREFIX =
X CONFDIR =
X BUILD =
@@ -529,7 +529,7 @@
X printf.obj: printf.h
X printf.obj: kctype.h
X termio.obj: machine.h config.h
-termio.obj: termio.h
+termio.obj: printf.h termio.h
X term.obj: machine.h config.h
X term.obj: printf.h
X term.obj: kctype.h
diff -urNP ../FD-2.08b/mkunitbl.c ./mkunitbl.c
--- ../FD-2.08b/mkunitbl.c Thu Mar 30 00:00:00 2006
+++ ./mkunitbl.c Wed May 24 00:00:00 2006
@@ -9246,7 +9246,7 @@
X {0xffe4, 0xfa55},
X {0xffe5, 0x818f},
X };
-#define UNITBLSIZ ((int)(sizeof(unitable) / sizeof(convtable)))
+#define UNITBLSIZ ((int)sizeof(unitable) / sizeof(convtable))
X
X static nftable macunitable[] = {
X {0x00c0, {0x0041, 0x0300, 0}},
@@ -10192,7 +10192,7 @@
X {0xfb4d, {0x05db, 0x05bf, 0}},
X {0xfb4e, {0x05e4, 0x05bf, 0}},
X };
-#define MACUNITBLSIZ ((int)(sizeof(macunitable) / sizeof(nftable)))
+#define MACUNITBLSIZ ((int)sizeof(macunitable) / sizeof(nftable))
X
X static int cmpuni(vp1, vp2)
X CONST VOID_P vp1;
diff -urNP ../FD-2.08b/parse.c ./parse.c
--- ../FD-2.08b/parse.c Thu Mar 30 00:00:00 2006
+++ ./parse.c Wed May 24 00:00:00 2006
@@ -92,7 +92,7 @@
X {K_HELP, "HELP"},
X {0, NULL}
X };
-#define KEYIDENTSIZ ((int)(sizeof(keyidentlist) / sizeof(strtable)) - 1)
+#define KEYIDENTSIZ (arraysize(keyidentlist) - 1)
X
X static CONST char escapechar[] = "abefnrtv";
X static CONST char escapevalue[] = {
@@ -156,7 +156,7 @@
X }
X width = getnum(fmt, &i);
X
- len = (int)sizeof(int);
+ len = sizeof(int);
X for (; fmt[i]; i++) {
X if (!(cp = strchr(printfsizechar, fmt[i]))) break;
X len = printfsize[cp - printfsizechar];
@@ -256,24 +256,55 @@
X break;
X }
X
- mask = (MAXUTYPE(u_long_t)
- >> (((int)sizeof(long_t) - len) * BITSPERBYTE));
+ mask = MAXUTYPE(u_long_t);
+ if (len < (int)sizeof(u_long_t))
+ mask >>= ((int)sizeof(u_long_t) - len) * BITSPERBYTE;
X if (flags & VF_UNSIGNED) {
X if (u & ~mask) {
- s = NULL;
- break;
+ u = mask;
+ if (flags & VF_STRICTWIDTH) {
+ s = NULL;
+ break;
+ }
X }
X }
X else {
X mask >>= 1;
X if (n >= 0) {
- if ((u_long_t)n & ~mask) s = NULL;
+ if ((u_long_t)n & ~mask) {
+ n = mask;
+ if (flags & VF_STRICTWIDTH) s = NULL;
+ }
+ }
+ else if (((u_long_t)n & ~mask) != ~mask) {
+ n = ~mask;
+ if (flags & VF_STRICTWIDTH) s = NULL;
X }
- else if (((u_long_t)n & ~mask) != ~mask) s = NULL;
X if (!s) break;
X memcpy(&u, &n, sizeof(u));
X }
X
+#ifndef HAVELONGLONG
+ if (len > (int)sizeof(u_long_t)) {
+ char *buf;
+ u_long_t tmp;
+ int hi;
+
+ hi = 0;
+ if (!(flags & VF_UNSIGNED)) {
+ mask = (MAXUTYPE(u_long_t) >> 1);
+ if (u & ~mask) hi = 0xff;
+ }
+ buf = va_arg(args, char *);
SHAR_EOF
: || $echo 'restore of' 'FD-2.08c.patch' 'failed'
fi
$echo 'End of' 'FD-2.08c.patch' 'part' '1'
$echo 'File' 'FD-2.08c.patch' 'is continued in part' '2'
echo 2 > _sh00841/seq
exit 0
--
しらい たかし
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735