しらいです。

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

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

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is `FD-2.08c.shar.02' (part 2 of FD-2.08c.patch).
# Do not concatenate these parts, unpack them in order with `/bin/sh'.
# File `FD-2.08c.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 _sh00841/seq; then
  $echo 'Please unpack part 1 first!'
  exit 1
fi
shar_sequence=`cat _sh00841/seq`
if test "$shar_sequence" != 2; then
  $echo 'Please unpack part' "$shar_sequence" 'next!'
  exit 1
fi
if test ! -f _sh00841/new; then
  $echo 'x -' 'STILL SKIPPING' 'FD-2.08c.patch'
else
  $echo 'x -' 'continuing file' 'FD-2.08c.patch'
  sed 's/^X//' << 'SHAR_EOF' >> FD-2.08c.patch &&
+                       memset(buf, hi, len);
+
+                       tmp = 0x5a;
+                       cp = (char *)(&tmp);
+                       if (*cp != 0x5a) buf += len - sizeof(u_long_t);
+                       memcpy(buf, (char *)(&u), sizeof(u));
+               }
+               else
+#endif /* !HAVELONGLONG */
X               if (len == (int)sizeof(u_long_t))
X                       *(va_arg(args, u_long_t *)) = u;
X #ifdef        HAVELONGLONG
@@ -705,7 +736,7 @@
X                               unprint = 0;
X                               break;
X                       default:
-                               tmp = sscanf2(&(prompt[i]), "%3Co", line);
+                               tmp = sscanf2(&(prompt[i]), "%<3Co", line);
X                               if (tmp) i = (tmp - prompt) - 1;
X                               else *line = prompt[i];
X                               line[1] = '\0';
@@ -907,7 +938,7 @@
X       for (i = j = 0; s[i]; i++, j++) {
X               if (s[i] == '\\') {
X                       i++;
-                       if ((tmp = sscanf2(&(s[i]), "%3Co", &(cp[j])))) {
+                       if ((tmp = sscanf2(&(s[i]), "%<3Co", &(cp[j])))) {
X                               i = (tmp - s) - 1;
X                               continue;
X                       }
diff -urNP ../FD-2.08b/pathname.c ./pathname.c
--- ../FD-2.08b/pathname.c      Thu Mar 30 00:00:00 2006
+++ ./pathname.c        Wed May 24 00:00:00 2006
@@ -3180,7 +3180,7 @@
X       len = ((cp = strdelim(top, 0))) ? (cp - top) : strlen(top);
X       if (!len) cp = gethomedir();
X # ifdef       FD
-       else if (len == (int)sizeof("FD") - 1 && !strnpathcmp(top, "FD", len))
+       else if (len == strsize("FD") && !strnpathcmp(top, "FD", len))
X               cp = progpath;
X # endif
X       else {
diff -urNP ../FD-2.08b/posixsh.c ./posixsh.c
--- ../FD-2.08b/posixsh.c       Thu Mar 30 00:00:00 2006
+++ ./posixsh.c Wed May 24 00:00:00 2006
@@ -91,7 +91,7 @@
X 
X #define       ALIASDELIMIT    "();&|<>"
X #define       BUFUNIT         32
-#define        getconstvar(s)  (getshellvar(s, sizeof(s) - 1))
+#define        getconstvar(s)  (getshellvar(s, strsize(s)))
X #define       ER_COMNOFOUND   1
X #define       ER_NOTFOUND     2
X #define       ER_NOTIDENT     4
diff -urNP ../FD-2.08b/printf.c ./printf.c
--- ../FD-2.08b/printf.c        Thu Mar 30 00:00:00 2006
+++ ./printf.c  Wed May 24 00:00:00 2006
@@ -192,7 +192,7 @@
X       if (!n) {
X               if (prec) num[len++] = '0';
X       }
-       else while (len < (int)sizeof(num) / sizeof(char)) {
+       else while (len < arraysize(num)) {
X #ifdef        MINIMUMSHELL
X               if (!bit) {
X                       i = (n % base);
@@ -249,8 +249,10 @@
X 
X       if (prec >= 0 && len < prec) {
X               for (i = 0; i < prec - len; i++) {
+#ifndef        MINIMUMSHELL
X                       if ((pbufp -> flags & VF_STRICTWIDTH) && width == 1)
X                               break;
+#endif
X                       width--;
X                       c = '0';
X                       if ((pbufp -> flags & VF_THOUSAND)
@@ -259,6 +261,7 @@
X                       if (setchar(c, pbufp) < 0) return(-1);
X               }
X       }
+#ifndef        MINIMUMSHELL
X       if ((pbufp -> flags & VF_STRICTWIDTH) && width >= 0 && width < len)
X       for (i = 0; i < width; i++) {
X               c = '9';
@@ -267,7 +270,9 @@
X                       c = (i) ? ',' : ' ';
X               if (setchar(c, pbufp) < 0) return(-1);
X       }
-       else for (i = 0; i < len; i++) {
+       else
+#endif /* !MINIMUMSHELL */
+       for (i = 0; i < len; i++) {
X               if (setchar(num[len - i - 1], pbufp) < 0) return(-1);
X       }
X 
@@ -294,7 +299,7 @@
X       }
X       else {
X               s = "(null)";
-               len = (int)sizeof("(null)") - 1;
+               len = strsize("(null)");
X #ifdef        LINUX
X               /* spec. of glibc */
X               if (prec >= 0 && len > prec) len = 0;
@@ -496,29 +501,37 @@
X               }
X 
X               if (base) {
-                       if (len == (int)sizeof(u_long_t))
-                               u = va_arg(args, u_long_t);
-#ifdef HAVELONGLONG
-                       else if (len == (int)sizeof(u_long))
-                               u = va_arg(args, u_long);
-#endif
-                       else u = va_arg(args, u_int);
-
X #ifndef       HAVELONGLONG
X                       if (len > (int)sizeof(u_long_t)) {
-                               u_long_t hi, tmp;
-
-                               while (len > (int)sizeof(u_int)) {
-                                       hi = va_arg(args, u_int);
-                                       len -= (int)sizeof(u_int);
-                               }
+                               u_long_t tmp;
+                               int hi;
X 
+# ifndef       HPUX
+       /*
+        * HP-UX always pushes arguments from lowest to uppermost,
+        * in spite of the CPU endien.
+        */
X                               tmp = 0x5a;
X                               cp = (char *)(&tmp);
X                               if (*cp != 0x5a) {
-                                       tmp = hi;
-                                       hi = u;
-                                       u = tmp;
+                                       hi = va_arg(args, u_int);
+                                       len -= (int)sizeof(u_int);
+                                       while (len > (int)sizeof(u_long_t)) {
+                                               tmp = va_arg(args, u_int);
+                                               len -= (int)sizeof(u_int);
+                                       }
+                                       u = va_arg(args, u_long_t);
+                               }
+                               else
+# endif        /* !HPUX */
+                               {
+                                       hi = 0;
+                                       u = va_arg(args, u_long_t);
+                                       len -= (int)sizeof(u_long_t);
+                                       while (len > 0) {
+                                               hi = va_arg(args, u_int);
+                                               len -= (int)sizeof(u_int);
+                                       }
X                               }
X 
X                               if (pbufp -> flags & VF_UNSIGNED) {
@@ -526,7 +539,7 @@
X                               }
X                               else {
X                                       mask = (MAXUTYPE(u_long_t) >> 1);
-                                       if (hi & ~mask) {
+                                       if (hi < 0) {
X                                               if (++hi || !(u & ~mask))
X                                                       u = ~mask;
X                                       }
@@ -538,10 +551,20 @@
X                       }
X                       else
X #endif        /* !HAVELONGLONG */
+                       if (len == (int)sizeof(u_long_t))
+                               u = va_arg(args, u_long_t);
+#ifdef HAVELONGLONG
+                       else if (len == (int)sizeof(u_long))
+                               u = va_arg(args, u_long);
+#endif
+                       else u = va_arg(args, u_int);
+
X                       if (!(pbufp -> flags & VF_UNSIGNED)) {
-                               mask = (MAXUTYPE(u_long_t)
-                                       >> (((int)sizeof(long_t) - len)
-                                       * BITSPERBYTE + 1));
+                               mask = MAXUTYPE(u_long_t);
+                               if (len < (int)sizeof(u_long_t))
+                                       mask >>= ((int)sizeof(u_long_t) - len)
+                                               * BITSPERBYTE;
+                               mask >>= 1;
X                               if (u & ~mask) u |= ~mask;
X                       }
X                       len = setint(u, base, pbufp, width, prec);
diff -urNP ../FD-2.08b/printf.h ./printf.h
--- ../FD-2.08b/printf.h        Thu Mar 30 00:00:00 2006
+++ ./printf.h  Wed May 24 00:00:00 2006
@@ -33,6 +33,9 @@
X #define       VF_STRICTWIDTH  000400
X #define       VF_UNSIGNED     001000
X 
+#define        strsize(s)      ((int)sizeof(s) - 1)
+#define        arraysize(a)    ((int)sizeof(a) / (int)sizeof(*(a)))
+
X #define       MAXLONGWIDTH    20              /* log10(2^64) = 19.266 */
X #define       MAXCOLSCOMMA(d) (MAXLONGWIDTH + (MAXLONGWIDTH / (d)))
X #ifndef       BITSPERBYTE
diff -urNP ../FD-2.08b/rockridg.c ./rockridg.c
--- ../FD-2.08b/rockridg.c      Thu Mar 30 00:00:00 2006
+++ ./rockridg.c        Wed May 24 00:00:00 2006
@@ -109,7 +109,7 @@
X 
X       len = cp - buf;
X       if (len + 1 >= MAXPATHLEN - 1) return(NULL);
-       snprintf2(&(buf[len]), sizeof(buf) - len, ";%d", TRANSTBLVAR);
+       snprintf2(&(buf[len]), (int)sizeof(buf) - len, ";%d", TRANSTBLVAR);
X       *flagsp |= RR_VERNO;
X       if ((fp = Xfopen(buf, "r"))) return(fp);
X 
diff -urNP ../FD-2.08b/shell.c ./shell.c
--- ../FD-2.08b/shell.c Thu Mar 30 00:00:00 2006
+++ ./shell.c   Wed May 24 00:00:00 2006
@@ -1566,14 +1566,14 @@
X 
X       size = (int)histsize[n];
X       if (!history[n]) {
-               history[n] = (char **)malloc2(sizeof(char *) * (size + 1));
+               history[n] = (char **)malloc2((size + 1) * sizeof(char *));
X               for (i = 0; i <= size; i++) history[n][i] = NULL;
X               histbufsize[n] = size;
X               histno[n] = (short)0;
X       }
X       else if (size > histbufsize[n]) {
X               history[n] = (char **)realloc2(history[n],
-                       sizeof(char *) * (size + 1));
+                       (size + 1) * sizeof(char *));
X               for (i = histbufsize[n] + 1; i <= size; i++)
X                       history[n][i] = NULL;
X               histbufsize[n] = size;
@@ -1631,14 +1631,11 @@
X 
X       if (!file || !(fp = Xfopen(file, "r"))) return(-1);
X #ifndef       NOFLOCK
-       if (lockfile(Xfileno(fp), LCK_READ) < 0) {
-               Xfclose(fp);
-               return(-1);
-       }
+       VOID_C lockfile(Xfileno(fp), LCK_READ);
X #endif
X 
X       size = (int)histsize[n];
-       history[n] = (char **)malloc2(sizeof(char *) * (size + 1));
+       history[n] = (char **)malloc2((size + 1) * sizeof(char *));
X       histbufsize[n] = size;
X       histno[n] = (short)0;
X 
@@ -1650,7 +1647,9 @@
X               for (j = i; j > 0; j--) history[n][j] = history[n][j - 1];
X               history[n][0] = line;
X       }
-       lockfile(Xfileno(fp), LCK_UNLOCK);
+#ifndef        NOFLOCK
+       VOID_C lockfile(Xfileno(fp), LCK_UNLOCK);
+#endif
X       Xfclose(fp);
X 
X       for (i++; i <= size; i++) history[n][i] = NULL;
@@ -1685,15 +1684,14 @@
X       if (!history[n] || !history[n][0]) return(-1);
X       if (!file || !(fp = Xfopen(file, "w"))) return(-1);
X #ifndef       NOFLOCK
-       if (lockfile(Xfileno(fp), LCK_WRITE) < 0) {
-               Xfclose(fp);
-               return(-1);
-       }
+       VOID_C lockfile(Xfileno(fp), LCK_WRITE);
X #endif
X 
X       size = (savehist > (int)histsize[n]) ? (int)histsize[n] : savehist;
X       for (i = size - 1; i >= 0; i--) convhistory(history[n][i], fp);
-       lockfile(Xfileno(fp), LCK_UNLOCK);
+#ifndef        NOFLOCK
+       VOID_C lockfile(Xfileno(fp), LCK_UNLOCK);
+#endif
X       Xfclose(fp);
X 
X       return(0);
diff -urNP ../FD-2.08b/system.c ./system.c
--- ../FD-2.08b/system.c        Thu Mar 30 00:00:00 2006
+++ ./system.c  Wed May 24 00:00:00 2006
@@ -846,12 +846,12 @@
X #define       UNLIMITED       "unlimited"
X #define       MAXTMPNAMLEN    8
X #define       BUFUNIT         32
-#define        getconstvar(s)  (getshellvar(s, sizeof(s) - 1))
+#define        getconstvar(s)  (getshellvar(s, strsize(s)))
X #define       constequal(s, c, l) \
-                       ((l) == (int)sizeof(c) - 1 && !strnenvcmp(s, c, l))
+                       ((l) == strsize(c) && !strnenvcmp(s, c, l))
X #define       consttail(s, h, t, l) \
-                       ((l) == (int)sizeof(h) - 1 + (int)sizeof(t) - 1 \
-                       && !strnenvcmp(&(s[sizeof(h) - 1]), t, sizeof(t) - 1))
+                       ((l) == strsize(h) + strsize(t) \
+                       && !strnenvcmp(&(s[strsize(h)]), t, strsize(t)))
X #ifdef        USESTRERROR
X #define       strerror2               strerror
X #else
@@ -973,7 +973,7 @@
X #define       ER_UNEXPEOF     3
X       "unexpected end of file",
X };
-#define        SYNTAXERRSIZ    ((int)(sizeof(syntaxerrstr) / sizeof(char *)))
+#define        SYNTAXERRSIZ    arraysize(syntaxerrstr)
X 
X static CONST char *execerrstr[] = {
X       NULL,
@@ -1058,7 +1058,7 @@
X       "invalid terminal for FDclone",
X #endif
X };
-#define        EXECERRSIZ      ((int)(sizeof(execerrstr) / sizeof(char *)))
+#define        EXECERRSIZ      arraysize(execerrstr)
X 
X static CONST opetable opelist[] = {
X       {OP_FG, 4, ";"},
@@ -1073,7 +1073,7 @@
X       {OP_NOT, 2, "!"},
X #endif
X };
-#define        OPELISTSIZ      ((int)(sizeof(opelist) / sizeof(opetable)))
+#define        OPELISTSIZ      arraysize(opelist)
X 
X #if   !defined (BASHBUG) && !defined (MINIMUMSHELL)
X static CONST opetable delimlist[] = {
@@ -1105,7 +1105,7 @@
X       {OP_NONE, 0, ">|"},
X       {OP_NONE, 0, ">"},
X };
-#define        DELIMLISTSIZ    ((int)(sizeof(delimlist) / sizeof(opetable)))
+#define        DELIMLISTSIZ    arraysize(delimlist)
X #endif        /* !BASHBUG && !MINIMUMSHELL */
X 
X static shbuiltintable shbuiltinlist[] = {
@@ -1196,7 +1196,7 @@
X       {dofd, "fd", BT_FILENAME},
X #endif
X };
-#define        SHBUILTINSIZ    ((int)(sizeof(shbuiltinlist) / sizeof(shbuiltintable)))
+#define        SHBUILTINSIZ    arraysize(shbuiltinlist)
X 
X statementtable statementlist[] = {
X       {doif, "if", STT_NEEDLIST, {0, 0, 0, 0}},
@@ -1220,7 +1220,7 @@
X       {dolist, "{", STT_LIST | STT_NEEDLIST, {0, 0, 0, 0}},
X       {NULL, "}", STT_NEEDNONE, {SM_LIST, 0, 0, 0}},
X };
-#define        STATEMENTSIZ    ((int)(sizeof(statementlist) / sizeof(statementtable)))
+#define        STATEMENTSIZ    arraysize(statementlist)
X 
X static char *primalvar[] = {
X       "PATH", "PS1", "PS2", "IFS",
@@ -1228,7 +1228,7 @@
X       "MAILCHECK", "PPID",
X #endif
X };
-#define        PRIMALVARSIZ    ((int)(sizeof(primalvar) / sizeof(char *)))
+#define        PRIMALVARSIZ    arraysize(primalvar)
X 
X static char *restrictvar[] = {
X       "PATH", "SHELL",
@@ -1236,7 +1236,7 @@
X       "ENV",
X #endif
X };
-#define        RESTRICTVARSIZ  ((int)(sizeof(restrictvar) / sizeof(char *)))
+#define        RESTRICTVARSIZ  arraysize(restrictvar)
X 
X #if   MSDOS && !defined (BSPATHDELIM)
X static CONST char *adjustvar[] = {
@@ -1261,7 +1261,7 @@
X #  endif
X # endif       /* FD */
X };
-#define        ADJUSTVARSIZ    ((int)(sizeof(adjustvar) / sizeof(char *)))
+#define        ADJUSTVARSIZ    arraysize(adjustvar)
X #endif        /* MSDOS && !BSPATHDELIM */
X 
X static CONST shflagtable shflaglist[] = {
@@ -1302,7 +1302,7 @@
X       {NULL, &loginshell, 'l'},
X       {NULL, &noruncom, 'N'},
X };
-#define        FLAGSSIZ        ((int)(sizeof(shflaglist) / sizeof(shflagtable)))
+#define        FLAGSSIZ        arraysize(shflaglist)
X 
X #ifdef        USERESOURCEH
X static CONST ulimittable ulimitlist[] = {
@@ -1337,7 +1337,7 @@
X       {'v', RLIMIT_VMEM, 1024, "virtual memory(kbytes)"},
X #endif
X };
-#define        ULIMITSIZ       ((int)(sizeof(ulimitlist) / sizeof(ulimittable)))
+#define        ULIMITSIZ       arraysize(ulimitlist)
X #endif        /* USERESOURCEH */
X 
X #ifdef        PSIGNALSTYLE
@@ -1633,8 +1633,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;
@@ -1642,7 +1642,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';
@@ -1659,9 +1659,9 @@
X 
X       strcpy(path, deftmpdir);
X       cp = strcatdelim(path);
-       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);
@@ -2634,7 +2634,7 @@
X       for (i = 0; signallist[i].sig >= 0; i++)
X               if (sig == signallist[i].sig) break;
X       if (signallist[i].sig < 0) {
-               if ((width -= (int)sizeof("Signal ") - 1) < 0) width = 0;
+               if ((width -= strsize("Signal ")) < 0) width = 0;
X               fprintf2(fp, "Signal %-*d", width, sig);
X       }
X       else if (!width) fputs(signallist[i].mes, fp);
@@ -4426,8 +4426,8 @@
X # ifdef       MINIMUMSHELL
X       else if (constequal(s, "MAIL", len)) checkmail(1);
X # else        /* !MINIMUMSHELL */
-       else if (!strnenvcmp(s, "MAIL", sizeof("MAIL") - 1)) {
-               if (len == (int)sizeof("MAIL") - 1) {
+       else if (!strnenvcmp(s, "MAIL", strsize("MAIL"))) {
+               if (len == strsize("MAIL")) {
X                       if (!getconstvar("MAILPATH")) replacemailpath(cp, 0);
X               }
X               else if (consttail(s, "MAIL", "PATH", len))
@@ -4527,8 +4527,8 @@
X               return(-1);
X #if   !MSDOS
X # ifndef      MINIMUMSHELL
-       else if (!strnenvcmp(ident, "MAIL", sizeof("MAIL") - 1)) {
-               if (len == (int)sizeof("MAIL") - 1) {
+       else if (!strnenvcmp(ident, "MAIL", strsize("MAIL"))) {
+               if (len == strsize("MAIL")) {
X                       if (!getconstvar("MAILPATH")) checkmail(1);
X               }
X               else if (consttail(ident, "MAIL", "PATH", len)) {
@@ -4570,7 +4570,7 @@
X }
X 
X #ifndef       MINIMUMSHELL
-#define        LINENOSIZ       ((int)sizeof("LINENO") - 1)
+#define        LINENOSIZ       strsize("LINENO")
X static VOID NEAR setshlineno(n)
X long n;
X {
@@ -6222,7 +6222,7 @@
X 
X #if   defined (FD) && !defined (_NOPTY)
X       if (parentfd >= 0 && ptyterm && *ptyterm) {
-               len = sizeof("TERM") - 1;
+               len = strsize("TERM");
X               cp = malloc2(len + strlen(ptyterm) + 2);
X               memcpy(cp, "TERM", len);
X               cp[len] = '=';
@@ -10830,8 +10830,8 @@
X                       if (!strenvcmp(primalvar[i], "PS1")
X                       || !strenvcmp(primalvar[i], "PS2"))
X                               primalvar[i] = NULL;
-               unset("PS1", sizeof("PS1") - 1);
-               unset("PS2", sizeof("PS2") - 1);
+               unset("PS1", strsize("PS1"));
+               unset("PS2", strsize("PS2"));
X       }
X #ifndef       MINIMUMSHELL
X       if (!getconstvar("PS4")) setenv2("PS4", PS4STR, 0);
diff -urNP ../FD-2.08b/term.c ./term.c
--- ../FD-2.08b/term.c  Thu Mar 30 00:00:00 2006
+++ ./term.c    Wed May 24 00:00:00 2006
@@ -446,10 +446,10 @@
X       K_F(11), K_F(12), K_F(13), K_F(14), K_F(15),
X       K_F(16), K_F(17), K_F(18), K_F(19), K_F(20), K_HELP
X };
-#define        SPECIALKEYSIZ   ((int)(sizeof(specialkeycode) / sizeof(int)))
+#define        SPECIALKEYSIZ   arraysize(specialkeycode)
X #else /* !MSDOS */
X static char *dumblist[] = {"dumb", "un", "unknown"};
-#define        DUMBLISTSIZE    ((int)sizeof(dumblist) / sizeof(char *))
+#define        DUMBLISTSIZE    arraysize(dumblist)
X static keyseq_t keyseq[K_MAX - K_MIN + 1];
X static kstree_t *keyseqtree = NULL;
X static char *defkeyseq[K_MAX - K_MIN + 1] = {
@@ -1354,7 +1354,7 @@
X       format = SIZEFMT;
X       keyflush();
X # if  MSDOS
-       for (i = 0; i < (int)sizeof(GETSIZE) - 1; i++)
+       for (i = 0; i < strsize(GETSIZE); i++)
X               bdos(0x06, GETSIZE[i], 0);
X # else
X       if (!usegetcursor) return(-1);
@@ -1374,7 +1374,7 @@
X # endif
X       } while (buf[i] != format[0]);
X 
-       if (buf[i] == format[0]) while (i < (int)sizeof(buf) - 2) {
+       if (buf[i] == format[0]) while (i < strsize(buf) - 1) {
X               if (!kbhit2(WAITKEYPAD * 1000L)) break;
X # if  MSDOS
X               buf[++i] = bdos(0x07, 0x00, 0);
@@ -1382,10 +1382,10 @@
X               if ((tmp = getch2()) == EOF) break;
X               buf[++i] = tmp;
X # endif
-               if (buf[i] == format[sizeof(SIZEFMT) - 2]) break;
+               if (buf[i] == format[strsize(SIZEFMT) - 1]) break;
X       }
X       keyflush();
-       if (!i || buf[i] != format[sizeof(SIZEFMT) - 2]) return(-1);
+       if (!i || buf[i] != format[strsize(SIZEFMT) - 1]) return(-1);
X       buf[++i] = '\0';
X 
X       count = 0;
@@ -1666,8 +1666,8 @@
X       int i, n;
X 
X       if (!parent || !(parent -> next))
-               new = (kstree_t *)malloc(sizeof(kstree_t) * num);
-       else new = (kstree_t *)realloc(parent -> next, sizeof(kstree_t) * num);
+               new = (kstree_t *)malloc(num * sizeof(kstree_t));
+       else new = (kstree_t *)realloc(parent -> next, num * sizeof(kstree_t));
X       if (!new) err2("realloc()");
X 
X       if (!parent) n = 0;
@@ -1774,7 +1774,7 @@
X               if (i < DUMBLISTSIZE) dumbterm = 1;
X       }
X # ifdef       IRIX
-       winterm = !strncmp(term, WINTERMNAME, sizeof(WINTERMNAME) - 1);
+       winterm = !strncmp(term, WINTERMNAME, strsize(WINTERMNAME));
X # endif
X 
X       for (;;) {
@@ -2815,8 +2815,7 @@
X int ungetch2(c)
X int c;
X {
-       if (ungetnum >= (int)sizeof(ungetbuf) / sizeof(u_char) - 1)
-               return(EOF);
+       if (ungetnum >= arraysize(ungetbuf) - 1) return(EOF);
X       if (ungetnum)
X               memmove(&(ungetbuf[1]), &(ungetbuf[0]),
X                       ungetnum * sizeof(u_char));
@@ -3054,8 +3053,7 @@
X       ch = c;
X       Xioctl(ttyio, TIOCSTI, &ch);
X # else
-       if (ungetnum >= (int)sizeof(ungetbuf) / sizeof(u_char) - 1)
-               return(EOF);
+       if (ungetnum >= arraysize(ungetbuf) - 1) return(EOF);
X       if (ungetnum)
X               memmove(&(ungetbuf[1]), &(ungetbuf[0]),
X                       ungetnum * sizeof(u_char));
diff -urNP ../FD-2.08b/termio.c ./termio.c
--- ../FD-2.08b/termio.c        Thu Mar 30 00:00:00 2006
+++ ./termio.c  Wed May 24 00:00:00 2006
@@ -8,6 +8,7 @@
X #include <string.h>
X #include <fcntl.h>
X #include "machine.h"
+#include "printf.h"
X #include "termio.h"
X 
X #ifdef        USESELECTH
@@ -82,7 +83,6 @@
X #define       MAXSELECT       16
X 
X #ifndef       FD_SET
-#include "printf.h"
X typedef struct fd_set {
X       u_int fds_bits[1];
X } fd_set;
@@ -114,7 +114,7 @@
X static CONST u_short doserrlist[] = {
X       0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 17, 18, 65, 80
X };
-#define        DOSERRLISTSIZ   ((int)(sizeof(doserrlist) / sizeof(u_short)))
+#define        DOSERRLISTSIZ   arraysize(doserrlist)
X static CONST int unixerrlist[] = {
X       0, EINVAL, ENOENT, ENOENT, EMFILE, EACCES,
X       EBADF, ENOMEM, ENOMEM, ENOMEM, ENODEV, EXDEV, 0, EACCES, EEXIST
diff -urNP ../FD-2.08b/unixdisk.c ./unixdisk.c
--- ../FD-2.08b/unixdisk.c      Thu Mar 30 00:00:00 2006
+++ ./unixdisk.c        Wed May 24 00:00:00 2006
@@ -2251,13 +2251,13 @@
X       i = supportLFN(path);
X # ifndef      _NODOSDRIVE
X       if (i == -2) {
-               char tmp[sizeof(long) * 3 + 1];
+               char tmp[3 * sizeof(long) + 1];
X 
X               if (dosstatfs(drive, tmp) < 0) return(-1);
-               buf -> f_bsize = *((u_long *)&(tmp[sizeof(long) * 0]));
-               buf -> f_blocks = *((u_long *)&(tmp[sizeof(long) * 1]));
+               buf -> f_bsize = *((u_long *)&(tmp[0 * sizeof(long)]));
+               buf -> f_blocks = *((u_long *)&(tmp[1 * sizeof(long)]));
X               buf -> f_bfree =
-               buf -> f_bavail = *((u_long *)&(tmp[sizeof(long) * 2]));
+               buf -> f_bavail = *((u_long *)&(tmp[2 * sizeof(long)]));
X       }
X       else
X # endif
diff -urNP ../FD-2.08b/version.h ./version.h
--- ../FD-2.08b/version.h       Thu Mar 30 00:00:00 2006
+++ ./version.h Wed May 24 00:00:00 2006
@@ -5,4 +5,4 @@
X  */
X 
X char *distributor = NULL;
-static char version[] = "@(#)fd.c  2.08b 03/30/06";
+static char version[] = "@(#)fd.c  2.08c 05/24/06";
SHAR_EOF
  $echo 'File' 'FD-2.08c.patch' 'is complete' &&
  $shar_touch -am 05182341106 'FD-2.08c.patch' &&
  chmod 0644 'FD-2.08c.patch' ||
  $echo 'restore of' 'FD-2.08c.patch' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'FD-2.08c.patch:' 'MD5 check failed'
0a77349ab9697990687e4bbf13a1650a  FD-2.08c.patch
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'FD-2.08c.patch'`"
    test 66504 -eq "$shar_count" ||
    $echo 'FD-2.08c.patch:' 'original size' '66504,' 'current size' "$shar_count!"
  fi
fi
$echo 'You have unpacked the last part'
rm -fr _sh00841
exit 0
-- 
                                               しらい たかし