bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] more merges from coreutils


From: Paul Eggert
Subject: [Bug-gnulib] more merges from coreutils
Date: Fri, 06 Aug 2004 17:14:48 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I ran out of time to nicely split up the remaining changes from
coreutils, so here they are all in one big gulp.  Sorry.

2004-08-06  Paul Eggert  <address@hidden>

        * lib/chown.c, lib/closeout.c, lib/dup2.c, lib/exclude.c,
        lib/fileblocks.c, lib/filemode.c, lib/fnmatch.c,
        lib/fnmatch_loop.c, lib/fopen-safer.c, lib/fsusage.c,
        lib/fsusage.h, lib/ftruncate.c, lib/full-write.c,
        lib/getdate.y, lib/getloadavg.c, lib/getugroups.c,
        lib/hard-locale.c, lib/hard-locale.h, lib/hash.c, lib/human.c,
        lib/human.h, lib/lchown.c, lib/lchown.h, lib/makepath.c,
        lib/makepath.h, lib/md5.c, lib/md5.h, lib/memchr.c,
        lib/memcoll.c, lib/memrchr.c, lib/modechange.c,
        lib/modechange.h, lib/mountlist.c, lib/mountlist.h,
        lib/nanosleep.c, lib/posixtm.c, lib/putenv.c, lib/quotearg.c,
        lib/quotearg.h, lib/readtokens.c, lib/readutmp.c,
        lib/readutmp.h, lib/rmdir.c, lib/safe-read.c, lib/save-cwd.c,
        lib/savedir.c, lib/setenv.c, lib/sig2str.c, lib/stat.c,
        lib/strtoimax.c, lib/strverscmp.c, lib/userspec.c,
        lib/utime.c, lib/version-etc.c, lib/xgethostname.c,
        lib/xmemcoll.c, lib/xreadlink.c, lib/xstrtod.c, lib/xstrtod.h,
        lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
        lib/xstrtoumax.c, m4/acl.m4, m4/afs.m4, m4/calloc.m4,
        m4/dirfd.m4, m4/fsusage.m4, m4/jm-macros.m4, m4/ls-mntd-fs.m4,
        m4/md5.m4, m4/mountlist.m4, m4/prereq.m4, m4/sha.m4,
        modules/canonicalize, modules/euidaccess, modules/filemode,
        modules/lchown, modules/makepath, modules/rmdir, modules/stat:
        Merge changes from coreutils.

Index: lib/chown.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/chown.c,v
retrieving revision 1.9
diff -u -r1.9 chown.c
--- lib/chown.c 1 Jun 2004 20:27:20 -0000       1.9
+++ lib/chown.c 7 Aug 2004 00:09:11 -0000
@@ -36,9 +36,6 @@
 # include <sys/file.h>
 #endif
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 /* Provide a more-closely POSIX-conforming version of chown on
    systems with one or both of the following problems:
Index: lib/closeout.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/closeout.c,v
retrieving revision 1.12
diff -u -r1.12 closeout.c
--- lib/closeout.c      20 Jul 2003 15:49:59 -0000      1.12
+++ lib/closeout.c      7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,7 @@
 /* closeout.c - close standard output
-   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,11 +24,7 @@
 #include "closeout.h"
 
 #include <stdio.h>
-
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
Index: lib/dup2.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/dup2.c,v
retrieving revision 1.3
diff -u -r1.3 dup2.c
--- lib/dup2.c  7 Aug 2000 15:48:18 -0000       1.3
+++ lib/dup2.c  7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,5 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
-   Copyright 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,9 +22,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #if HAVE_FCNTL_H
 # include <fcntl.h>
Index: lib/exclude.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/exclude.c,v
retrieving revision 1.20
diff -u -r1.20 exclude.c
--- lib/exclude.c       27 Oct 2003 08:41:23 -0000      1.20
+++ lib/exclude.c       7 Aug 2004 00:09:11 -0000
@@ -1,7 +1,7 @@
 /* exclude.c -- exclude file names
 
-   Copyright (C) 1992, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003 Free
-   Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003,
+   2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,9 +28,6 @@
 
 #include <ctype.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
Index: lib/fileblocks.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fileblocks.c,v
retrieving revision 1.16
diff -u -r1.16 fileblocks.c
--- lib/fileblocks.c    7 Aug 2000 15:48:18 -0000       1.16
+++ lib/fileblocks.c    7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,6 @@
 /* Convert file size to number of blocks on System V-like machines.
-   Copyright (C) 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
+
+   Copyright (C) 1990, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -73,5 +74,5 @@
 #else
 /* This declaration is solely to ensure that after preprocessing
    this file is never empty.  */
-extern int textutils_fileblocks_unused;
+typedef int textutils_fileblocks_unused;
 #endif
Index: lib/filemode.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/filemode.c,v
retrieving revision 1.13
diff -u -r1.13 filemode.c
--- lib/filemode.c      15 Apr 2000 21:54:46 -0000      1.13
+++ lib/filemode.c      7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,5 @@
 /* filemode.c -- make a string describing file modes
-   Copyright (C) 1985, 1990, 1993, 1998-2000 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004 Free Software Foundation, 
Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,98 +23,7 @@
 #include <sys/stat.h>
 
 #include "filemode.h"
-
-#if !S_IRUSR
-# if S_IREAD
-#  define S_IRUSR S_IREAD
-# else
-#  define S_IRUSR 00400
-# endif
-#endif
-
-#if !S_IWUSR
-# if S_IWRITE
-#  define S_IWUSR S_IWRITE
-# else
-#  define S_IWUSR 00200
-# endif
-#endif
-
-#if !S_IXUSR
-# if S_IEXEC
-#  define S_IXUSR S_IEXEC
-# else
-#  define S_IXUSR 00100
-# endif
-#endif
-
-#if !S_IRGRP
-# define S_IRGRP (S_IRUSR >> 3)
-#endif
-#if !S_IWGRP
-# define S_IWGRP (S_IWUSR >> 3)
-#endif
-#if !S_IXGRP
-# define S_IXGRP (S_IXUSR >> 3)
-#endif
-#if !S_IROTH
-# define S_IROTH (S_IRUSR >> 6)
-#endif
-#if !S_IWOTH
-# define S_IWOTH (S_IWUSR >> 6)
-#endif
-#if !S_IXOTH
-# define S_IXOTH (S_IXUSR >> 6)
-#endif
-
-#ifdef STAT_MACROS_BROKEN
-# undef S_ISBLK
-# undef S_ISCHR
-# undef S_ISDIR
-# undef S_ISFIFO
-# undef S_ISLNK
-# undef S_ISMPB
-# undef S_ISMPC
-# undef S_ISNWK
-# undef S_ISREG
-# undef S_ISSOCK
-#endif /* STAT_MACROS_BROKEN.  */
-
-#if !defined S_ISBLK && defined S_IFBLK
-# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined S_ISCHR && defined S_IFCHR
-# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined S_ISDIR && defined S_IFDIR
-# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined S_ISREG && defined S_IFREG
-# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined S_ISFIFO && defined S_IFIFO
-# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined S_ISLNK && defined S_IFLNK
-# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined S_ISSOCK && defined S_IFSOCK
-# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined S_ISMPB && defined S_IFMPB /* V7 */
-# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#endif
-#if !defined S_ISNWK && defined S_IFNWK /* HP/UX */
-# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-#if !defined S_ISDOOR && defined S_IFDOOR /* Solaris 2.5 and up */
-# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
-#endif
-#if !defined S_ISCTG && defined S_IFCTG /* MassComp */
-# define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
-#endif
-
+#include "stat-macros.h"
 
 
 /* Set the 's' and 't' flags in file attributes string CHARS,
@@ -123,7 +32,6 @@
 static void
 setst (mode_t bits, char *chars)
 {
-#ifdef S_ISUID
   if (bits & S_ISUID)
     {
       if (chars[3] != 'x')
@@ -132,8 +40,6 @@
       else
        chars[3] = 's';
     }
-#endif
-#ifdef S_ISGID
   if (bits & S_ISGID)
     {
       if (chars[6] != 'x')
@@ -142,8 +48,6 @@
       else
        chars[6] = 's';
     }
-#endif
-#ifdef S_ISVTX
   if (bits & S_ISVTX)
     {
       if (chars[9] != 'x')
@@ -152,7 +56,6 @@
       else
        chars[9] = 't';
     }
-#endif
 }
 
 /* Return a character indicating the type of file described by
@@ -174,60 +77,40 @@
 static char
 ftypelet (mode_t bits)
 {
-#ifdef S_ISBLK
   if (S_ISBLK (bits))
     return 'b';
-#endif
   if (S_ISCHR (bits))
     return 'c';
   if (S_ISDIR (bits))
     return 'd';
   if (S_ISREG (bits))
     return '-';
-#ifdef S_ISFIFO
   if (S_ISFIFO (bits))
     return 'p';
-#endif
-#ifdef S_ISLNK
   if (S_ISLNK (bits))
     return 'l';
-#endif
-#ifdef S_ISSOCK
   if (S_ISSOCK (bits))
     return 's';
-#endif
-#ifdef S_ISMPC
   if (S_ISMPC (bits))
     return 'm';
-#endif
-#ifdef S_ISNWK
   if (S_ISNWK (bits))
     return 'n';
-#endif
-#ifdef S_ISDOOR
   if (S_ISDOOR (bits))
     return 'D';
-#endif
-#ifdef S_ISCTG
   if (S_ISCTG (bits))
     return 'C';
-#endif
 
   /* The following two tests are for Cray DMF (Data Migration
      Facility), which is a HSM file system.  A migrated file has a
      `st_dm_mode' that is different from the normal `st_mode', so any
      tests for migrated files should use the former.  */
 
-#ifdef S_ISOFD
   if (S_ISOFD (bits))
     /* off line, with data  */
     return 'M';
-#endif
-#ifdef S_ISOFL
   /* off line, with no data  */
   if (S_ISOFL (bits))
     return 'M';
-#endif
   return '?';
 }
 
Index: lib/fnmatch.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch.c,v
retrieving revision 1.27
diff -u -r1.27 fnmatch.c
--- lib/fnmatch.c       17 May 2004 05:41:42 -0000      1.27
+++ lib/fnmatch.c       7 Aug 2004 00:09:11 -0000
@@ -35,6 +35,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <stddef.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -156,10 +157,6 @@
 /* Avoid depending on library functions or files
    whose names are inconsistent.  */
 
-# ifndef errno
-extern int errno;
-# endif
-
 /* Global variable.  */
 static int posixly_correct;
 
Index: lib/fnmatch_loop.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch_loop.c,v
retrieving revision 1.7
diff -u -r1.7 fnmatch_loop.c
--- lib/fnmatch_loop.c  14 Jan 2004 22:22:10 -0000      1.7
+++ lib/fnmatch_loop.c  7 Aug 2004 00:09:11 -0000
@@ -18,14 +18,14 @@
 /* Match STRING against the filename pattern PATTERN, returning zero if
    it matches, nonzero if not.  */
 static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
-               const CHAR *string_end, int no_leading_period, int flags)
+               const CHAR *string_end, bool no_leading_period, int flags)
      internal_function;
 static const CHAR *END (const CHAR *patternp) internal_function;
 
 static int
 internal_function
 FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
-     int no_leading_period, int flags)
+     bool no_leading_period, int flags)
 {
   register const CHAR *p = pattern, *n = string;
   register UCHAR c;
@@ -41,7 +41,7 @@
 
   while ((c = *p++) != L('\0'))
     {
-      int new_no_leading_period = 0;
+      bool new_no_leading_period = false;
       c = FOLD (c);
 
       switch (c)
@@ -161,9 +161,9 @@
                {
                  int flags2 = ((flags & FNM_FILE_NAME)
                                ? flags : (flags & ~FNM_PERIOD));
-                 int no_leading_period2 = no_leading_period;
+                 bool no_leading_period2 = no_leading_period;
 
-                 for (--p; n < endp; ++n, no_leading_period2 = 0)
+                 for (--p; n < endp; ++n, no_leading_period2 = false)
                    if (FCT (p, n, string_end, no_leading_period2, flags2)
                        == 0)
                      return 0;
@@ -186,7 +186,7 @@
                  if (c == L('\\') && !(flags & FNM_NOESCAPE))
                    c = *p;
                  c = FOLD (c);
-                 for (--p; n < endp; ++n, no_leading_period2 = 0)
+                 for (--p; n < endp; ++n, no_leading_period2 = false)
                    if (FOLD ((UCHAR) *n) == c
                        && (FCT (p, n, string_end, no_leading_period2, flags2)
                            == 0))
@@ -200,7 +200,7 @@
        case L('['):
          {
            /* Nonzero if the sense of the character class is inverted.  */
-           register int not;
+           register bool not;
            CHAR cold;
            UCHAR fn;
 
@@ -410,10 +410,10 @@
                  return FNM_NOMATCH;
                else
                  {
-                   int is_range = 0;
+                   bool is_range = false;
 
 #ifdef _LIBC
-                   int is_seqval = 0;
+                   bool is_seqval = false;
 
                    if (c == L('[') && *p == L('.'))
                      {
@@ -460,7 +460,7 @@
                            const int32_t *symb_table;
 # ifdef WIDE_CHAR_VERSION
                            char str[c1];
-                           unsigned int strcnt;
+                           size_t strcnt;
 # else
 #  define str (startp + 1)
 # endif
@@ -550,7 +550,7 @@
                                  }
 
                                /* Get the collation sequence value.  */
-                               is_seqval = 1;
+                               is_seqval = true;
 # ifdef WIDE_CHAR_VERSION
                                cold = wextra[1 + wextra[idx]];
 # else
@@ -629,7 +629,7 @@
                        lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
 # endif
 
-                       is_seqval = 0;
+                       is_seqval = false;
                        if (cend == L('[') && *p == L('.'))
                          {
                            uint32_t nrules =
@@ -668,7 +668,7 @@
                                const int32_t *symb_table;
 # ifdef WIDE_CHAR_VERSION
                                char str[c1];
-                               unsigned int strcnt;
+                               size_t strcnt;
 # else
 #  define str (startp + 1)
 # endif
@@ -738,7 +738,7 @@
                                    wextra = (int32_t *) &extra[idx + 4];
 # endif
                                    /* Get the collation sequence value.  */
-                                   is_seqval = 1;
+                                   is_seqval = true;
 # ifdef WIDE_CHAR_VERSION
                                    cend = wextra[1 + wextra[idx]];
 # else
@@ -929,7 +929,7 @@
              if (n == string_end || c != (UCHAR) *n)
                return FNM_NOMATCH;
 
-             new_no_leading_period = 1;
+             new_no_leading_period = true;
              break;
            }
          /* FALLTHROUGH */
@@ -996,10 +996,10 @@
 static int
 internal_function
 EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
-     int no_leading_period, int flags)
+     bool no_leading_period, int flags)
 {
   const CHAR *startp;
-  int level;
+  size_t level;
   struct patternlist
   {
     struct patternlist *next;
@@ -1013,7 +1013,7 @@
 
   /* Parse the pattern.  Store the individual parts in the list.  */
   level = 0;
-  for (startp = p = pattern + 1; level >= 0; ++p)
+  for (startp = p = pattern + 1; ; ++p)
     if (*p == L('\0'))
       /* This is an invalid pattern.  */
       return -1;
@@ -1066,6 +1066,7 @@
            *lastp = newp;                                                    \
            lastp = &newp->next
            NEW_PATTERN;
+           break;
          }
       }
     else if (*p == L('|'))
@@ -1100,7 +1101,7 @@
                && (FCT (p, rs, string_end,
                         rs == string
                         ? no_leading_period
-                        : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0,
+                        : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
                         flags & FNM_FILE_NAME
                         ? flags : flags & ~FNM_PERIOD) == 0
                    /* This didn't work.  Try the whole pattern.  */
@@ -1108,8 +1109,7 @@
                        && FCT (pattern - 1, rs, string_end,
                                rs == string
                                ? no_leading_period
-                               : (rs[-1] == '/' && NO_LEADING_PERIOD (flags)
-                                  ? 1 : 0),
+                               : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
                                flags & FNM_FILE_NAME
                                ? flags : flags & ~FNM_PERIOD) == 0)))
              /* It worked.  Signal success.  */
@@ -1156,7 +1156,7 @@
              && (FCT (p, rs, string_end,
                       rs == string
                       ? no_leading_period
-                      : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0,
+                      : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
                       flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD)
                  == 0))
            /* This is successful.  */
Index: lib/fopen-safer.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fopen-safer.c,v
retrieving revision 1.1
diff -u -r1.1 fopen-safer.c
--- lib/fopen-safer.c   3 Mar 2001 19:05:51 -0000       1.1
+++ lib/fopen-safer.c   7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,5 @@
 /* Invoke fopen, but avoid some glitches.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -31,10 +31,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
 #include <stdio.h>
 #include <stdio-safer.h>
 
Index: lib/fsusage.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fsusage.c,v
retrieving revision 1.46
diff -u -r1.46 fsusage.c
--- lib/fsusage.c       6 Jun 2003 19:45:59 -0000       1.46
+++ lib/fsusage.c       7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,6 @@
-/* fsusage.c -- return space usage of mounted filesystems
+/* fsusage.c -- return space usage of mounted file systems
 
-   Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003 Free
+   Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -23,10 +23,12 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
 #endif
 #ifndef UINTMAX_MAX
 # define UINTMAX_MAX ((uintmax_t) -1)
@@ -102,7 +104,7 @@
 #define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1))
 
 /* Fill in the fields of FSP with information about space usage for
-   the filesystem on which PATH resides.
+   the file system on which PATH resides.
    DISK is the device on which PATH is mounted, for space-getting
    methods that need to know it.
    Return 0 if successful, -1 if not.  When returning -1, ensure that
Index: lib/fsusage.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fsusage.h,v
retrieving revision 1.9
diff -u -r1.9 fsusage.h
--- lib/fsusage.h       18 Jun 2003 05:52:19 -0000      1.9
+++ lib/fsusage.h       7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,7 @@
-/* fsusage.h -- declarations for filesystem space usage info
+/* fsusage.h -- declarations for file system space usage info
 
-   Copyright (C) 1991, 1992, 1997, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1997, 2003, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,18 +17,20 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* Space usage statistics for a filesystem.  Blocks are 512-byte. */
+/* Space usage statistics for a file system.  Blocks are 512-byte. */
 
 #if !defined FSUSAGE_H_
 # define FSUSAGE_H_
 
+# include <stdbool.h>
+
 struct fs_usage
 {
-  int fsu_blocksize;           /* Size of a block.  */
+  uintmax_t fsu_blocksize;     /* Size of a block.  */
   uintmax_t fsu_blocks;                /* Total blocks. */
   uintmax_t fsu_bfree;         /* Free blocks available to superuser. */
   uintmax_t fsu_bavail;                /* Free blocks available to 
non-superuser. */
-  int fsu_bavail_top_bit_set;  /* 1 if fsu_bavail represents a value < 0.  */
+  bool fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0.  */
   uintmax_t fsu_files;         /* Total file nodes. */
   uintmax_t fsu_ffree;         /* Free file nodes. */
 };
Index: lib/ftruncate.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/ftruncate.c,v
retrieving revision 1.7
diff -u -r1.7 ftruncate.c
--- lib/ftruncate.c     7 Dec 1998 03:12:10 -0000       1.7
+++ lib/ftruncate.c     7 Aug 2004 00:09:11 -0000
@@ -79,9 +79,6 @@
 #  else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
 
 #   include <errno.h>
-#   ifndef errno
-extern int errno;
-#   endif
 
 int
 ftruncate (int fd, off_t length)
Index: lib/full-write.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/full-write.c,v
retrieving revision 1.18
diff -u -r1.18 full-write.c
--- lib/full-write.c    8 Jan 2003 18:42:38 -0000       1.18
+++ lib/full-write.c    7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,7 @@
 /* An interface to read and write that retries (if necessary) until complete.
 
-   Copyright (C) 1993, 1994, 1997-2003 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+   2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,9 +29,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #ifdef FULL_READ
 # include "safe-read.h"
Index: lib/getdate.y
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getdate.y,v
retrieving revision 1.82
diff -u -r1.82 getdate.y
--- lib/getdate.y       6 Jun 2004 18:55:59 -0000       1.82
+++ lib/getdate.y       7 Aug 2004 00:09:11 -0000
@@ -768,8 +768,11 @@
 
   /* Make it uppercase.  */
   for (p = word; *p; p++)
-    if (ISLOWER ((unsigned char) *p))
-      *p = toupper ((unsigned char) *p);
+    {
+      unsigned char ch = *p;
+      if (ISLOWER (ch))
+       *p = toupper (ch);
+    }
 
   for (tp = meridian_table; tp->name; tp++)
     if (strcmp (word, tp->name) == 0)
Index: lib/getloadavg.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getloadavg.c,v
retrieving revision 1.22
diff -u -r1.22 getloadavg.c
--- lib/getloadavg.c    30 Mar 2004 18:51:56 -0000      1.22
+++ lib/getloadavg.c    7 Aug 2004 00:09:11 -0000
@@ -48,8 +48,6 @@
                                not an array.
    HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
    LINUX_LDAV_FILE             [__linux__]: File containing load averages.
-   HAVE_LOCALE_H                locale.h is available.
-   HAVE_SETLOCALE               The `setlocale' function is available.
 
    Specific system predefines this file uses, aside from setting
    default values if not emacs:
@@ -70,9 +68,9 @@
    UMAX4_3
    VMS
    WINDOWS32                   No-op for Windows95/NT.
-   __linux__                   Linux: assumes /proc filesystem mounted.
+   __linux__                   Linux: assumes /proc file system mounted.
                                Support from Michael K. Johnson.
-   __NetBSD__                  NetBSD: assumes /kern filesystem mounted.
+   __NetBSD__                  NetBSD: assumes /kern file system mounted.
 
    In addition, to avoid nesting many #ifdefs, we internally set
    LDAV_DONE to indicate that the load average has been computed.
@@ -85,39 +83,28 @@
 # include <config.h>
 #endif
 
-#include <sys/types.h>
-
-/* Both the Emacs and non-Emacs sections want this.  Some
-   configuration files' definitions for the LOAD_AVE_CVT macro (like
-   sparc.h's) use macros like FSCALE, defined here.  */
-#if defined (unix) || defined (__unix)
-# include <sys/param.h>
-#endif
-
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 /* Exclude all the code except the test program at the end
-   if the system has its own `getloadavg' function.
-
-   The declaration of `errno' is needed by the test program
-   as well as the function itself, so it comes first.  */
+   if the system has its own `getloadavg' function.  */
 
-#include <errno.h>
+#ifndef HAVE_GETLOADAVG
 
-#ifndef errno
-extern int errno;
-#endif
+# include <sys/types.h>
 
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#ifndef HAVE_SETLOCALE
-# define setlocale(Category, Locale) ((char *) NULL)
-#endif
-
-#include "cloexec.h"
-#include "xalloc.h"
+/* Both the Emacs and non-Emacs sections want this.  Some
+   configuration files' definitions for the LOAD_AVE_CVT macro (like
+   sparc.h's) use macros like FSCALE, defined here.  */
+# if defined (unix) || defined (__unix)
+#  include <sys/param.h>
+# endif
 
-#ifndef HAVE_GETLOADAVG
+# include "c-strtod.h"
+# include "cloexec.h"
+# include "xalloc.h"
 
 /* The existing Emacs configuration files define a macro called
    LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
@@ -362,7 +349,7 @@
 #  include <unistd.h>
 # endif
 
-# include <stdio.h>
+# include <limits.h>
 
 /* LOAD_AVE_TYPE should only get defined if we're going to use the
    nlist method.  */
@@ -436,7 +423,6 @@
 # endif /* sgi */
 
 # ifdef UMAX
-#  include <stdio.h>
 #  include <signal.h>
 #  include <sys/time.h>
 #  include <sys/wait.h>
@@ -472,7 +458,7 @@
 
 # ifdef NeXT
 static processor_set_t default_set;
-static int getloadavg_initialized;
+static bool getloadavg_initialized;
 # endif /* NeXT */
 
 # ifdef UMAX
@@ -487,8 +473,8 @@
 # if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE)
 /* File descriptor open to /dev/kmem or VMS load ave driver.  */
 static int channel;
-/* Nonzero iff channel is valid.  */
-static int getloadavg_initialized;
+/* True iff channel is valid.  */
+static bool getloadavg_initialized;
 /* Offset in kmem to seek to read load average, or 0 means invalid.  */
 static long offset;
 
@@ -592,33 +578,37 @@
 #   define LINUX_LDAV_FILE "/proc/loadavg"
 #  endif
 
-  char ldavgbuf[40];
-  double load_ave[3];
+/* Upper bound on the string length of an integer converted to string.
+   302 / 1000 is ceil (log10 (2.0)).  Subtract 1 for the sign bit;
+   add 1 for integer division truncation; add 1 more for a minus sign.  */
+#  define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
+
+  char ldavgbuf[3 * (INT_STRLEN_BOUND (long int) + sizeof ".00")];
+  char const *ptr = ldavgbuf;
   int fd, count;
-  char *old_locale;
 
   fd = open (LINUX_LDAV_FILE, O_RDONLY);
   if (fd == -1)
     return -1;
-  count = read (fd, ldavgbuf, 40);
+  count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
   (void) close (fd);
   if (count <= 0)
     return -1;
+  ldavgbuf[count] = '\0';
 
-  /* The following sscanf must use the C locale.  */
-  old_locale = setlocale (LC_NUMERIC, NULL);
-  if (old_locale)
-    old_locale = xstrdup (old_locale);
-  setlocale (LC_NUMERIC, "C");
-  count = sscanf (ldavgbuf, "%lf %lf %lf",
-                 &load_ave[0], &load_ave[1], &load_ave[2]);
-  setlocale (LC_NUMERIC, old_locale);
-  free (old_locale);
-  if (count < 1)
-    return -1;
-
-  for (elem = 0; elem < nelem && elem < count; elem++)
-    loadavg[elem] = load_ave[elem];
+  for (elem = 0; elem < nelem; elem++)
+    {
+      char *endptr;
+      double d = c_strtod (ptr, &endptr);
+      if (ptr == endptr)
+       {
+         if (elem == 0)
+           return -1;
+         break;
+       }
+      loadavg[elem] = d;
+      ptr = endptr;
+    }
 
   return elem;
 
@@ -659,7 +649,7 @@
 
   host_t host;
   struct processor_set_basic_info info;
-  unsigned info_count;
+  unsigned int info_count;
 
   /* We only know how to get the 1-minute average for this system,
      so even if the caller asks for more than 1, we only return 1.  */
@@ -667,7 +657,7 @@
   if (!getloadavg_initialized)
     {
       if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS)
-       getloadavg_initialized = 1;
+       getloadavg_initialized = true;
     }
 
   if (getloadavg_initialized)
@@ -676,7 +666,7 @@
       if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
                              (processor_set_info_t) &info, &info_count)
          != KERN_SUCCESS)
-       getloadavg_initialized = 0;
+       getloadavg_initialized = false;
       else
        {
          if (nelem > 0)
@@ -837,7 +827,7 @@
   /* VMS specific code -- read from the Load Ave driver.  */
 
   LOAD_AVE_TYPE load_ave[3];
-  static int getloadavg_initialized = 0;
+  static bool getloadavg_initialized;
 #  ifdef eunice
   struct
   {
@@ -857,7 +847,7 @@
       $DESCRIPTOR (descriptor, "LAV0:");
 #  endif
       if (sys$assign (&descriptor, &channel, 0, 0) & 1)
-       getloadavg_initialized = 1;
+       getloadavg_initialized = true;
     }
 
   /* Read the load average vector.  */
@@ -866,7 +856,7 @@
                     load_ave, 12, 0, 0, 0, 0) & 1))
     {
       sys$dassgn (channel);
-      getloadavg_initialized = 0;
+      getloadavg_initialized = false;
     }
 
   if (!getloadavg_initialized)
@@ -919,7 +909,7 @@
 
       ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
       if (ldav_off != -1)
-       offset = (long) ldav_off & 0x7fffffff;
+       offset = (long int) ldav_off & 0x7fffffff;
 #  endif /* sgi */
     }
 
@@ -933,7 +923,7 @@
          /* Set the channel to close on exec, so it does not
             litter any child's descriptor table.  */
          set_cloexec_flag (channel, true);
-         getloadavg_initialized = 1;
+         getloadavg_initialized = true;
        }
 #  else /* SUNOS_5 */
       /* We pass 0 for the kernel, corefile, and swapfile names
@@ -944,7 +934,7 @@
          /* nlist the currently running kernel.  */
          kvm_nlist (kd, nl);
          offset = nl[0].n_value;
-         getloadavg_initialized = 1;
+         getloadavg_initialized = true;
        }
 #  endif /* SUNOS_5 */
     }
@@ -959,14 +949,14 @@
          != sizeof (load_ave))
        {
          close (channel);
-         getloadavg_initialized = 0;
+         getloadavg_initialized = false;
        }
 #  else  /* SUNOS_5 */
       if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave))
          != sizeof (load_ave))
        {
          kvm_close (kd);
-         getloadavg_initialized = 0;
+         getloadavg_initialized = false;
        }
 #  endif /* SUNOS_5 */
     }
@@ -999,7 +989,7 @@
 #endif /* ! HAVE_GETLOADAVG */

 #ifdef TEST
-void
+int
 main (int argc, char **argv)
 {
   int naptime = 0;
@@ -1017,7 +1007,7 @@
       if (loads == -1)
        {
          perror ("Error getting load average");
-         exit (1);
+         return EXIT_FAILURE;
        }
       if (loads > 0)
        printf ("1-minute: %f  ", avg[0]);
@@ -1033,6 +1023,6 @@
       sleep (naptime);
     }
 
-  exit (0);
+  return EXIT_SUCCESS;
 }
 #endif /* TEST */
Index: lib/getugroups.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getugroups.c,v
retrieving revision 1.12
diff -u -r1.12 getugroups.c
--- lib/getugroups.c    9 Sep 2003 18:42:46 -0000       1.12
+++ lib/getugroups.c    7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,7 @@
 /* getugroups.c -- return a list of the groups a user is in
-   Copyright (C) 1990, 1991, 1998, 1999, 2000, 2003 Free Software Foundation.
+
+   Copyright (C) 1990, 1991, 1998, 1999, 2000, 2003, 2004 Free
+   Software Foundation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,6 +31,11 @@
 # include <unistd.h>
 #endif
 
+#include <errno.h>
+#ifndef EOVERFLOW
+# define EOVERFLOW EINVAL
+#endif
+
 /* setgrent, getgrent, and endgrent are not specified by POSIX.1,
    so header files might not declare them.
    If you don't have them at all, we can't implement this function.
@@ -88,6 +95,11 @@
                  grouplist[count] = grp->gr_gid;
                }
              count++;
+             if (count < 0)
+               {
+                 errno = EOVERFLOW;
+                 return -1;
+               }
            }
        }
     }
Index: lib/hard-locale.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/hard-locale.c,v
retrieving revision 1.8
diff -u -r1.8 hard-locale.c
--- lib/hard-locale.c   9 Sep 2003 19:37:26 -0000       1.8
+++ lib/hard-locale.c   7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,7 @@
 /* hard-locale.c -- Determine whether a locale is hard.
 
-   Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,23 +30,23 @@
 #include <stdlib.h>
 #include <string.h>
 
-/* Return nonzero if the current CATEGORY locale is hard, i.e. if you
+/* Return true if the current CATEGORY locale is hard, i.e. if you
    can't get away with assuming traditional C or POSIX behavior.  */
-int
+bool
 hard_locale (int category)
 {
 #if ! HAVE_SETLOCALE
-  return 0;
+  return false;
 #else
 
-  int hard = 1;
-  char const *p = setlocale (category, 0);
+  bool hard = true;
+  char const *p = setlocale (category, NULL);
 
   if (p)
     {
 # if defined __GLIBC__ && 2 <= __GLIBC__
       if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0)
-       hard = 0;
+       hard = false;
 # else
       char *locale = malloc (strlen (p) + 1);
       if (locale)
@@ -59,7 +60,7 @@
               && strcmp (p, locale) == 0)
              || ((p = setlocale (category, "POSIX"))
                  && strcmp (p, locale) == 0))
-           hard = 0;
+           hard = false;
 
          /* Restore the caller's locale.  */
          setlocale (category, locale);
Index: lib/hard-locale.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/hard-locale.h,v
retrieving revision 1.2
diff -u -r1.2 hard-locale.h
--- lib/hard-locale.h   18 Jun 2003 05:52:19 -0000      1.2
+++ lib/hard-locale.h   7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,6 @@
 /* Determine whether a locale is hard.
 
-   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
 #ifndef HARD_LOCALE_H_
 # define HARD_LOCALE_H_ 1
 
-int hard_locale (int);
+# include <stdbool.h>
+
+bool hard_locale (int);
 
 #endif /* HARD_LOCALE_H_ */
Index: lib/hash.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/hash.c,v
retrieving revision 1.36
diff -u -r1.36 hash.c
--- lib/hash.c  31 Oct 2003 14:06:36 -0000      1.36
+++ lib/hash.c  7 Aug 2004 00:09:11 -0000
@@ -1,7 +1,7 @@
 /* hash - hashing table processing.
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
-   Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+   Software Foundation, Inc.
 
    Written by Jim Meyering, 1992.
 
@@ -400,9 +400,10 @@
   ((Byte) + ROTATE_LEFT (Value, 7))
 
   size_t value = 0;
+  unsigned char ch;
 
-  for (; *string; string++)
-    value = HASH_ONE_CHAR (value, (unsigned char) *string);
+  for (; (ch = *string); string++)
+    value = HASH_ONE_CHAR (value, ch);
   return value % n_buckets;
 
 # undef ROTATE_LEFT
@@ -420,9 +421,10 @@
 hash_string (const char *string, size_t n_buckets)
 {
   size_t value = 0;
+  unsigned char ch;
 
-  while (*string)
-    value = (value * 31 + (unsigned char) *string++) % n_buckets;
+  for (; (ch = *string); string++)
+    value = (value * 31 + ch) % n_buckets;
   return value;
 }
 
Index: lib/human.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/human.c,v
retrieving revision 1.24
diff -u -r1.24 human.c
--- lib/human.c 31 Mar 2004 07:25:19 -0000      1.24
+++ lib/human.c 7 Aug 2004 00:09:11 -0000
@@ -300,8 +300,8 @@
          {
            do
              {
-               unsigned r10 = (amt % base) * 10 + tenths;
-               unsigned r2 = (r10 % base) * 2 + (rounding >> 1);
+               unsigned int r10 = (amt % base) * 10 + tenths;
+               unsigned int r2 = (r10 % base) * 2 + (rounding >> 1);
                amt /= base;
                tenths = r10 / base;
                rounding = (r2 < base
Index: lib/human.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/human.h,v
retrieving revision 1.8
diff -u -r1.8 human.h
--- lib/human.h 5 Jun 2003 04:35:13 -0000       1.8
+++ lib/human.h 7 Aug 2004 00:09:11 -0000
@@ -1,7 +1,7 @@
 /* human.h -- print human readable file size
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
-   Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,12 +29,11 @@
 # include <limits.h>
 # include <stdbool.h>
 
-# if HAVE_INTTYPES_H
-#  include <inttypes.h>
-# else
-#  if HAVE_STDINT_H
-#   include <stdint.h>
-#  endif
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+# if HAVE_UNISTD_H
+#  include <unistd.h>
 # endif
 
 /* A conservative bound on the maximum length of a human-readable string.
Index: lib/lchown.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/lchown.c,v
retrieving revision 1.13
diff -u -r1.13 lchown.c
--- lib/lchown.c        1 Jun 2004 20:27:21 -0000       1.13
+++ lib/lchown.c        7 Aug 2004 00:09:11 -0000
@@ -22,46 +22,31 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-#include "lchown.h"
 
-#ifdef STAT_MACROS_BROKEN
-# undef S_ISLNK
-#endif
-
-#ifndef S_ISLNK
-# ifdef S_IFLNK
-#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-# else
-#  define S_ISLNK(m) 0
-# endif
-#endif
+#include "lchown.h"
+#include "stat-macros.h"
 
 /* Declare chown to avoid a warning.  Don't include unistd.h,
    because it may have a conflicting prototype for lchown.  */
 int chown ();
 
 /* Work just like chown, except when FILE is a symbolic link.
-   In that case, set errno to ENOSYS and return -1.
+   In that case, set errno to EOPNOTSUPP and return -1.
    But if autoconf tests determined that chown modifies
    symlinks, then just call chown.  */
 
 int
 lchown (const char *file, uid_t uid, gid_t gid)
 {
-#if CHOWN_MODIFIES_SYMLINK
-  return chown (file, uid, gid);
-#else
+#if ! CHOWN_MODIFIES_SYMLINK
   struct stat stats;
 
   if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
     {
-      errno = ENOSYS;
+      errno = EOPNOTSUPP;
       return -1;
     }
+#endif
 
   return chown (file, uid, gid);
-#endif
 }
Index: lib/lchown.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/lchown.h,v
retrieving revision 1.2
diff -u -r1.2 lchown.h
--- lib/lchown.h        5 Sep 1999 06:56:50 -0000       1.2
+++ lib/lchown.h        7 Aug 2004 00:09:11 -0000
@@ -1,9 +1,9 @@
-/* Some systems don't have ENOSYS.  */
-#ifndef ENOSYS
+/* Some systems don't have EOPNOTSUPP.  */
+#ifndef EOPNOTSUPP
 # ifdef ENOTSUP
-#  define ENOSYS ENOTSUP
+#  define EOPNOTSUPP ENOTSUP
 # else
 /* Some systems don't have ENOTSUP either.  */
-#  define ENOSYS EINVAL
+#  define EOPNOTSUPP EINVAL
 # endif
 #endif
Index: lib/makepath.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/makepath.c,v
retrieving revision 1.58
diff -u -r1.58 makepath.c
--- lib/makepath.c      9 Sep 2003 21:52:26 -0000       1.58
+++ lib/makepath.c      7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,6 @@
 /* makepath.c -- Ensure that a directory path exists.
 
-   Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002, 2003 Free
+   Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -34,53 +34,10 @@
 # include <unistd.h>
 #endif
 
-#if STAT_MACROS_BROKEN
-# undef S_ISDIR
-#endif
-
-#if !defined S_ISDIR && defined S_IFDIR
-# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-#ifndef S_IRWXUGO
-# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
-#endif
-
 #include <stdlib.h>
-
 #include <errno.h>
-
-#ifndef errno
-extern int errno;
-#endif
-
 #include <string.h>
 
-#ifndef S_ISUID
-# define S_ISUID 04000
-#endif
-#ifndef S_ISGID
-# define S_ISGID 02000
-#endif
-#ifndef S_ISVTX
-# define S_ISVTX 01000
-#endif
-#ifndef S_IRUSR
-# define S_IRUSR 0200
-#endif
-#ifndef S_IWUSR
-# define S_IWUSR 0200
-#endif
-#ifndef S_IXUSR
-# define S_IXUSR 0100
-#endif
-
-#ifndef S_IRWXU
-# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
-#endif
-
-#define WX_USR (S_IWUSR | S_IXUSR)
-
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
@@ -88,6 +45,9 @@
 #include "dirname.h"
 #include "error.h"
 #include "quote.h"
+#include "stat-macros.h"
+
+#define WX_USR (S_IWUSR | S_IXUSR)
 
 #define CLEANUP_CWD                                    \
   do                                                   \
@@ -119,18 +79,19 @@
   while (0)
 
 /* Attempt to create directory DIR (aka DIRPATH) with the specified MODE.
-   If CREATED_DIR_P is non-NULL, set *CREATED_DIR_P to non-zero if this
-   function creates DIR and to zero otherwise.  Give a diagnostic and
-   return non-zero if DIR cannot be created or cannot be determined to
+   If CREATED_DIR_P is non-NULL, set *CREATED_DIR_P if this
+   function creates DIR and clear it otherwise.  Give a diagnostic and
+   return false if DIR cannot be created or cannot be determined to
    exist already.  Use DIRPATH in any diagnostic, not DIR.
-   Note that if DIR already exists, this function returns zero
-   (indicating success) and sets *CREATED_DIR_P to zero.  */
+   Note that if DIR already exists, this function returns true
+   (indicating success) and clears *CREATED_DIR_P.  */
 
-int
-make_dir (const char *dir, const char *dirpath, mode_t mode, int 
*created_dir_p)
+bool
+make_dir (const char *dir, const char *dirpath, mode_t mode,
+         bool *created_dir_p)
 {
-  int fail = 0;
-  int created_dir;
+  bool ok = true;
+  bool created_dir;
 
   created_dir = (mkdir (dir, mode) == 0);
 
@@ -151,12 +112,12 @@
        {
          error (0, saved_errno, _("cannot create directory %s"),
                 quote (dirpath));
-         fail = 1;
+         ok = false;
        }
       else if (!S_ISDIR (stats.st_mode))
        {
          error (0, 0, _("%s exists but is not a directory"), quote (dirpath));
-         fail = 1;
+         ok = false;
        }
       else
        {
@@ -167,7 +128,7 @@
   if (created_dir_p)
     *created_dir_p = created_dir;
 
-  return fail;
+  return ok;
 }
 
 /* Ensure that the directory ARGPATH exists.
@@ -181,36 +142,36 @@
    If VERBOSE_FMT_STRING is nonzero, use it as a printf format
    string for printing a message after successfully making a directory,
    with the name of the directory that was just made as an argument.
-   If PRESERVE_EXISTING is non-zero and ARGPATH is an existing directory,
+   If PRESERVE_EXISTING is true and ARGPATH is an existing directory,
    then do not attempt to set its permissions and ownership.
 
-   Return 0 if ARGPATH exists as a directory with the proper
-   ownership and permissions when done, otherwise 1.  */
+   Return true iff ARGPATH exists as a directory with the proper
+   ownership and permissions when done.  */
 
-int
+bool
 make_path (const char *argpath,
-          int mode,
-          int parent_mode,
+          mode_t mode,
+          mode_t parent_mode,
           uid_t owner,
           gid_t group,
-          int preserve_existing,
+          bool preserve_existing,
           const char *verbose_fmt_string)
 {
   struct stat stats;
-  int retval = 0;
+  bool retval = true;
 
   if (stat (argpath, &stats))
     {
       char *slash;
-      int tmp_mode;            /* Initial perms for leading dirs.  */
-      int re_protect;          /* Should leading dirs be unwritable? */
+      mode_t tmp_mode;         /* Initial perms for leading dirs.  */
+      bool re_protect;         /* Should leading dirs be unwritable? */
       struct ptr_list
       {
        char *dirname_end;
        struct ptr_list *next;
       };
       struct ptr_list *p, *leading_dirs = NULL;
-      int do_chdir;            /* Whether to chdir before each mkdir.  */
+      bool do_chdir;           /* Whether to chdir before each mkdir.  */
       struct saved_cwd cwd;
       char *basename_dir;
       char *dirpath;
@@ -231,23 +192,23 @@
              && (parent_mode & (S_ISUID | S_ISGID | S_ISVTX)) != 0))
        {
          tmp_mode = S_IRWXU;
-         re_protect = 1;
+         re_protect = true;
        }
       else
        {
          tmp_mode = parent_mode;
-         re_protect = 0;
+         re_protect = false;
        }
 
       /* If we can record the current working directory, we may be able
         to do the chdir optimization.  */
-      do_chdir = !save_cwd (&cwd);
+      do_chdir = (save_cwd (&cwd) == 0);
 
       /* If we've saved the cwd and DIRPATH is an absolute pathname,
         we must chdir to `/' in order to enable the chdir optimization.
          So if chdir ("/") fails, turn off the optimization.  */
       if (do_chdir && *dirpath == '/' && chdir ("/") < 0)
-       do_chdir = 0;
+       do_chdir = false;
 
       slash = dirpath;
 
@@ -257,8 +218,7 @@
 
       while (1)
        {
-         int newly_created_dir;
-         int fail;
+         bool newly_created_dir;
 
          /* slash points to the leftmost unprocessed component of dirpath.  */
          basename_dir = slash;
@@ -273,11 +233,10 @@
            basename_dir = dirpath;
 
          *slash = '\0';
-         fail = make_dir (basename_dir, dirpath, tmp_mode, &newly_created_dir);
-         if (fail)
+         if (! make_dir (basename_dir, dirpath, tmp_mode, &newly_created_dir))
            {
              CLEANUP;
-             return 1;
+             return false;
            }
 
          if (newly_created_dir)
@@ -295,7 +254,7 @@
                  error (0, errno, _("cannot change owner and/or group of %s"),
                         quote (dirpath));
                  CLEANUP;
-                 return 1;
+                 return false;
                }
 
              if (re_protect)
@@ -317,7 +276,7 @@
              error (0, errno, _("cannot chdir to directory %s"),
                     quote (dirpath));
              CLEANUP;
-             return 1;
+             return false;
            }
 
          *slash++ = '/';
@@ -337,10 +296,10 @@
       /* We're done making leading directories.
         Create the final component of the path.  */
 
-      if (make_dir (basename_dir, dirpath, mode, NULL))
+      if (! make_dir (basename_dir, dirpath, mode, NULL))
        {
          CLEANUP;
-         return 1;
+         return false;
        }
 
       if (verbose_fmt_string != NULL)
@@ -356,7 +315,7 @@
            {
              error (0, errno, _("cannot change owner and/or group of %s"),
                     quote (dirpath));
-             retval = 1;
+             retval = false;
            }
        }
 
@@ -370,7 +329,7 @@
        {
          error (0, errno, _("cannot change permissions of %s"),
                 quote (dirpath));
-         retval = 1;
+         retval = false;
        }
 
       CLEANUP_CWD;
@@ -385,7 +344,7 @@
            {
              error (0, errno, _("cannot change permissions of %s"),
                     quote (dirpath));
-             retval = 1;
+             retval = false;
            }
        }
     }
@@ -398,7 +357,7 @@
       if (!S_ISDIR (stats.st_mode))
        {
          error (0, 0, _("%s exists but is not a directory"), quote (dirpath));
-         return 1;
+         return false;
        }
 
       if (!preserve_existing)
@@ -418,13 +377,13 @@
            {
              error (0, errno, _("cannot change owner and/or group of %s"),
                     quote (dirpath));
-             retval = 1;
+             retval = false;
            }
          if (chmod (dirpath, mode))
            {
              error (0, errno, _("cannot change permissions of %s"),
                                 quote (dirpath));
-             retval = 1;
+             retval = false;
            }
        }
     }
Index: lib/makepath.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/makepath.h,v
retrieving revision 1.8
diff -u -r1.8 makepath.h
--- lib/makepath.h      9 Sep 2003 20:09:53 -0000       1.8
+++ lib/makepath.h      7 Aug 2004 00:09:11 -0000
@@ -1,7 +1,7 @@
 /* makepath.c -- Ensure that a directory path exists.
 
-   Copyright (C) 1994, 1995, 1996, 1997, 2000, 2003 Free Software
-   Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 2000, 2003, 2004 Free
+   Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,17 +19,18 @@
 
 /* Written by David MacKenzie <address@hidden> and Jim Meyering.  */
 
+#include <stdbool.h>
 #include <sys/types.h>
 
-int make_path (const char *_argpath,
-              int _mode,
-              int _parent_mode,
-              uid_t _owner,
-              gid_t _group,
-              int _preserve_existing,
-              const char *_verbose_fmt_string);
-
-int make_dir (const char *dir,
-             const char *dirpath,
-             mode_t mode,
-             int *created_dir_p);
+bool make_path (const char *argpath,
+               mode_t mode,
+               mode_t parent_mode,
+               uid_t owner,
+               gid_t group,
+               bool preserve_existing,
+               const char *verbose_fmt_string);
+
+bool make_dir (const char *dir,
+              const char *dirpath,
+              mode_t mode,
+              bool *created_dir_p);
Index: lib/md5.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/md5.c,v
retrieving revision 1.15
diff -u -r1.15 md5.c
--- lib/md5.c   9 Sep 2003 23:33:52 -0000       1.15
+++ lib/md5.c   7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,6 @@
 /* md5.c - Functions to compute MD5 message digest of files or memory blocks
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995, 1996, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2001, 2003, 2004 Free Software Foundation, Inc.
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to address@hidden
 
@@ -26,9 +26,7 @@
 
 #include "md5.h"
 
-#include <sys/types.h>
-
-#include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 #include "unlocked-io.h"
@@ -246,13 +244,8 @@
   if (len >= 64)
     {
 #if !_STRING_ARCH_unaligned
-/* To check alignment gcc has an appropriate operator.  Other
-   compilers don't.  */
-# if __GNUC__ >= 2
-#  define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0)
-# else
-#  define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0)
-# endif
+# define alignof(type) offsetof (struct { char c; type x; }, x)
+# define UNALIGNED_P(p) (((size_t) p) % alignof (md5_uint32) != 0)
       if (UNALIGNED_P (buffer))
        while (len > 64)
          {
Index: lib/md5.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/md5.h,v
retrieving revision 1.14
diff -u -r1.14 md5.h
--- lib/md5.h   16 Jan 2004 07:55:43 -0000      1.14
+++ lib/md5.h   7 Aug 2004 00:09:11 -0000
@@ -1,6 +1,9 @@
 /* md5.h - Declaration of functions and data types used for MD5 sum
    computing library functions.
-   Copyright (C) 1995, 1996, 1999, 2000, 2003 Free Software Foundation, Inc.
+
+   Copyright (C) 1995, 1996, 1999, 2000, 2003, 2004 Free Software
+   Foundation, Inc.
+
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to address@hidden
 
@@ -22,42 +25,16 @@
 #define _MD5_H 1
 
 #include <stdio.h>
-#include <limits.h>
 
-/* The following contortions are an attempt to use the C preprocessor
-   to determine an unsigned integral type that is 32 bits wide.  An
-   alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
-   doing that would require that the configure script compile and *run*
-   the resulting executable.  Locally running cross-compiled executables
-   is usually not possible.  */
-
-#ifdef _LIBC
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H || _LIBC
 # include <stdint.h>
-typedef uint32_t md5_uint32;
-typedef uintptr_t md5_uintptr;
-#else
-# define UINT_MAX_32_BITS 4294967295U
-
-# if UINT_MAX == UINT_MAX_32_BITS
-   typedef unsigned int md5_uint32;
-# else
-#  if USHRT_MAX == UINT_MAX_32_BITS
-    typedef unsigned short md5_uint32;
-#  else
-#   if ULONG_MAX == UINT_MAX_32_BITS
-     typedef unsigned long md5_uint32;
-#   else
-     /* The following line is intended to evoke an error.
-        Using #error is not portable enough.  */
-     "Cannot determine unsigned 32-bit data type."
-#   endif
-#  endif
-# endif
-/* We have to make a guess about the integer type equivalent in size
-   to pointers which should always be correct.  */
-typedef unsigned long int md5_uintptr;
 #endif
 
+typedef uint32_t md5_uint32;
+
 /* Structure to save state of computation between the single steps.  */
 struct md5_ctx
 {
Index: lib/memchr.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/memchr.c,v
retrieving revision 1.16
diff -u -r1.16 memchr.c
--- lib/memchr.c        9 Sep 2003 22:22:46 -0000       1.16
+++ lib/memchr.c        7 Aug 2004 00:09:11 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003 Free
+/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free
    Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (address@hidden),
@@ -31,6 +31,8 @@
 
 #include <string.h>
 
+#include <stddef.h>
+
 #if defined _LIBC
 # include <memcopy.h>
 #else
@@ -38,11 +40,7 @@
 #endif
 
 #include <limits.h>
-#include <stdlib.h>
-
-#define LONG_MAX_32_BITS 2147483647
 
-#include <sys/types.h>
 #if HAVE_BP_SYM_H || defined _LIBC
 # include <bp-sym.h>
 #else
@@ -60,22 +58,22 @@
   const unsigned long int *longword_ptr;
   unsigned long int longword, magic_bits, charmask;
   unsigned reg_char c;
+  int i;
 
   c = (unsigned char) c_in;
 
   /* Handle the first few characters by reading one character at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */
   for (char_ptr = (const unsigned char *) s;
-       n > 0 && ((unsigned long int) char_ptr
-                & (sizeof (longword) - 1)) != 0;
+       n > 0 && (size_t) char_ptr % sizeof longword != 0;
        --n, ++char_ptr)
     if (*char_ptr == c)
       return (void *) char_ptr;
 
   /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
+     but the theory applies equally well to any size longwords.  */
 
-  longword_ptr = (unsigned long int *) char_ptr;
+  longword_ptr = (const unsigned long int *) char_ptr;
 
   /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
      the "holes."  Note that there is a hole just to the left of
@@ -87,26 +85,28 @@
      The 1-bits make sure that carries propagate to the next 0-bit.
      The 0-bits provide holes for carries to fall into.  */
 
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
+  /* Set MAGIC_BITS to be this pattern of 1 and 0 bits.
+     Set CHARMASK to be a longword, each of whose bytes is C.  */
 
-  /* Set up a longword, each of whose bytes is C.  */
+  magic_bits = 0xfefefefe;
   charmask = c | (c << 8);
   charmask |= charmask << 16;
-#if LONG_MAX > LONG_MAX_32_BITS
+#if 0xffffffffU < ULONG_MAX
+  magic_bits |= magic_bits << 32;
   charmask |= charmask << 32;
+  if (8 < sizeof longword)
+    for (i = 64; i < sizeof longword * 8; i *= 2)
+      {
+       magic_bits |= magic_bits << i;
+       charmask |= charmask << i;
+      }
 #endif
+  magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1);
 
   /* Instead of the traditional loop which tests each character,
      we will test a longword at a time.  The tricky part is testing
      if *any of the four* bytes in the longword in question are zero.  */
-  while (n >= sizeof (longword))
+  while (n >= sizeof longword)
     {
       /* We tentatively exit the loop if adding MAGIC_BITS to
         LONGWORD fails to change any of the hole bits of LONGWORD.
@@ -168,19 +168,21 @@
            return (void *) &cp[2];
          if (cp[3] == c)
            return (void *) &cp[3];
-#if LONG_MAX > 2147483647
-         if (cp[4] == c)
+         if (4 < sizeof longword && cp[4] == c)
            return (void *) &cp[4];
-         if (cp[5] == c)
+         if (5 < sizeof longword && cp[5] == c)
            return (void *) &cp[5];
-         if (cp[6] == c)
+         if (6 < sizeof longword && cp[6] == c)
            return (void *) &cp[6];
-         if (cp[7] == c)
+         if (7 < sizeof longword && cp[7] == c)
            return (void *) &cp[7];
-#endif
+         if (8 < sizeof longword)
+           for (i = 8; i < sizeof longword; i++)
+             if (cp[i] == c)
+               return (void *) &cp[i];
        }
 
-      n -= sizeof (longword);
+      n -= sizeof longword;
     }
 
   char_ptr = (const unsigned char *) longword_ptr;
Index: lib/memcoll.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/memcoll.c,v
retrieving revision 1.11
diff -u -r1.11 memcoll.c
--- lib/memcoll.c       9 Sep 2003 22:22:47 -0000       1.11
+++ lib/memcoll.c       7 Aug 2004 00:09:11 -0000
@@ -1,5 +1,5 @@
 /* Locale-specific memory comparison.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,10 +24,6 @@
 #include "memcoll.h"
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
 #include <string.h>
 
 /* Compare S1 (with length S1LEN) and S2 (with length S2LEN) according
Index: lib/memrchr.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/memrchr.c,v
retrieving revision 1.4
diff -u -r1.4 memrchr.c
--- lib/memrchr.c       9 Sep 2003 22:22:47 -0000       1.4
+++ lib/memrchr.c       7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,6 @@
 /* memrchr -- find the last occurrence of a byte in a memory block
 
-   Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003 Free
+   Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free
    Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (address@hidden),
@@ -27,10 +27,11 @@
 # include <config.h>
 #endif
 
-#include <stdlib.h>
 #include <string.h>
 
-#if defined (_LIBC)
+#include <stddef.h>
+
+#if defined _LIBC
 # include <memcopy.h>
 #else
 # define reg_char char
@@ -38,10 +39,6 @@
 
 #include <limits.h>
 
-#define LONG_MAX_32_BITS 2147483647
-
-#include <sys/types.h>
-
 #undef __memrchr
 #undef memrchr
 
@@ -57,22 +54,22 @@
   const unsigned long int *longword_ptr;
   unsigned long int longword, magic_bits, charmask;
   unsigned reg_char c;
+  int i;
 
   c = (unsigned char) c_in;
 
   /* Handle the last few characters by reading one character at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */
   for (char_ptr = (const unsigned char *) s + n;
-       n > 0 && ((unsigned long int) char_ptr
-                & (sizeof (longword) - 1)) != 0;
+       n > 0 && (size_t) char_ptr % sizeof longword != 0;
        --n)
     if (*--char_ptr == c)
       return (void *) char_ptr;
 
   /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
+     but the theory applies equally well to any size longwords.  */
 
-  longword_ptr = (unsigned long int *) char_ptr;
+  longword_ptr = (const unsigned long int *) char_ptr;
 
   /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
      the "holes."  Note that there is a hole just to the left of
@@ -84,26 +81,28 @@
      The 1-bits make sure that carries propagate to the next 0-bit.
      The 0-bits provide holes for carries to fall into.  */
 
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
+  /* Set MAGIC_BITS to be this pattern of 1 and 0 bits.
+     Set CHARMASK to be a longword, each of whose bytes is C.  */
 
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
-
-  /* Set up a longword, each of whose bytes is C.  */
+  magic_bits = 0xfefefefe;
   charmask = c | (c << 8);
   charmask |= charmask << 16;
-#if LONG_MAX > LONG_MAX_32_BITS
+#if 0xffffffffU < ULONG_MAX
+  magic_bits |= magic_bits << 32;
   charmask |= charmask << 32;
+  if (8 < sizeof longword)
+    for (i = 64; i < sizeof longword * 8; i *= 2)
+      {
+       magic_bits |= magic_bits << i;
+       charmask |= charmask << i;
+      }
 #endif
+  magic_bits = (ULONG_MAX >> 1) & (magic_bits | 1);
 
   /* Instead of the traditional loop which tests each character,
      we will test a longword at a time.  The tricky part is testing
      if *any of the four* bytes in the longword in question are zero.  */
-  while (n >= sizeof (longword))
+  while (n >= sizeof longword)
     {
       /* We tentatively exit the loop if adding MAGIC_BITS to
         LONGWORD fails to change any of the hole bits of LONGWORD.
@@ -157,16 +156,18 @@
 
          const unsigned char *cp = (const unsigned char *) longword_ptr;
 
-#if LONG_MAX > 2147483647
-         if (cp[7] == c)
+         if (8 < sizeof longword)
+           for (i = sizeof longword - 1; 8 <= i; i--)
+             if (cp[i] == c)
+               return (void *) &cp[i];
+         if (7 < sizeof longword && cp[7] == c)
            return (void *) &cp[7];
-         if (cp[6] == c)
+         if (6 < sizeof longword && cp[6] == c)
            return (void *) &cp[6];
-         if (cp[5] == c)
+         if (5 < sizeof longword && cp[5] == c)
            return (void *) &cp[5];
-         if (cp[4] == c)
+         if (4 < sizeof longword && cp[4] == c)
            return (void *) &cp[4];
-#endif
          if (cp[3] == c)
            return (void *) &cp[3];
          if (cp[2] == c)
@@ -177,7 +178,7 @@
            return (void *) cp;
        }
 
-      n -= sizeof (longword);
+      n -= sizeof longword;
     }
 
   char_ptr = (const unsigned char *) longword_ptr;
Index: lib/modechange.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/modechange.c,v
retrieving revision 1.26
diff -u -r1.26 modechange.c
--- lib/modechange.c    9 Sep 2003 22:45:09 -0000       1.26
+++ lib/modechange.c    7 Aug 2004 00:09:12 -0000
@@ -1,7 +1,7 @@
 /* modechange.c -- file mode manipulation
 
-   Copyright (C) 1989, 1990, 1997, 1998, 1999, 2001, 2003 Free Software
-   Foundation, Inc.
+   Copyright (C) 1989, 1990, 1997, 1998, 1999, 2001, 2003, 2004 Free
+   Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@
 #include "modechange.h"
 #include <sys/stat.h>
 #include "xstrtol.h"
+#include <stdbool.h>
 #include <stddef.h>
 #include <stdlib.h>
 
@@ -220,12 +221,10 @@
       /* `affected_bits' modified by umask. */
       mode_t affected_masked;
       /* Operators to actually use umask on. */
-      unsigned ops_to_mask = 0;
+      unsigned int ops_to_mask = 0;
 
-      int who_specified_p;
+      bool who_specified_p;
 
-      affected_bits = 0;
-      ops_to_mask = 0;
       /* Turn on all the bits in `affected_bits' for each group given. */
       for (++mode_string;; ++mode_string)
        switch (*mode_string)
@@ -250,10 +249,10 @@
       /* If none specified, affect all bits, except perhaps those
         set in the umask. */
       if (affected_bits)
-       who_specified_p = 1;
+       who_specified_p = true;
       else
        {
-         who_specified_p = 0;
+         who_specified_p = false;
          affected_bits = CHMOD_MODE_BITS;
          ops_to_mask = masked_ops;
        }
Index: lib/modechange.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/modechange.h,v
retrieving revision 1.12
diff -u -r1.12 modechange.h
--- lib/modechange.h    18 Jun 2003 05:52:19 -0000      1.12
+++ lib/modechange.h    7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
 /* modechange.h -- definitions for file mode manipulation
-   Copyright (C) 1989, 1990, 1997, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1997, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@
 # define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
 # define MODE_BAD_REFERENCE (struct mode_change *) 2
 
-struct mode_change *mode_compile (const char *, unsigned);
+struct mode_change *mode_compile (const char *, unsigned int);
 struct mode_change *mode_create_from_ref (const char *);
 mode_t mode_adjust (mode_t, const struct mode_change *);
 void mode_free (struct mode_change *);
Index: lib/mountlist.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/mountlist.c,v
retrieving revision 1.45
diff -u -r1.45 mountlist.c
--- lib/mountlist.c     31 Mar 2004 07:30:08 -0000      1.45
+++ lib/mountlist.c     7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-/* mountlist.c -- return a list of mounted filesystems
+/* mountlist.c -- return a list of mounted file systems
    Copyright (C) 1991, 1992, 1997-2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -26,18 +26,11 @@
 
 #include "xalloc.h"
 
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
 #ifndef strstr
 char *strstr ();
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
@@ -143,39 +136,15 @@
 #include "mountlist.h"
 #include "unlocked-io.h"
 
-#ifdef MOUNTED_GETMNTENT1      /* 4.3BSD, SunOS, HP-UX, Dynix, Irix.  */
-/* Return the value of the hexadecimal number represented by CP.
-   No prefix (like '0x') or suffix (like 'h') is expected to be
-   part of CP. */
-/* FIXME: this can overflow */
-
-static int
-xatoi (char *cp)
-{
-  int val;
-
-  val = 0;
-  while (*cp)
-    {
-      if (*cp >= 'a' && *cp <= 'f')
-       val = val * 16 + *cp - 'a' + 10;
-      else if (*cp >= 'A' && *cp <= 'F')
-       val = val * 16 + *cp - 'A' + 10;
-      else if (*cp >= '0' && *cp <= '9')
-       val = val * 16 + *cp - '0';
-      else
-       break;
-      cp++;
-    }
-  return val;
-}
-#endif /* MOUNTED_GETMNTENT1.  */
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
 
 #if MOUNTED_GETMNTINFO
 
 # if ! HAVE_F_FSTYPENAME_IN_STATFS
 static char *
-fstype_to_string (short t)
+fstype_to_string (short int t)
 {
   switch (t)
     {
@@ -296,13 +265,13 @@
 }
 #endif /* MOUNTED_VMOUNT */
 
-/* Return a list of the currently mounted filesystems, or NULL on error.
+/* Return a list of the currently mounted file systems, or NULL on error.
    Add each entry to the tail of the list so that they stay in order.
-   If NEED_FS_TYPE is nonzero, ensure that the filesystem type fields in
+   If NEED_FS_TYPE is true, ensure that the file system type fields in
    the returned list are valid.  Otherwise, they might not be.  */
 
 struct mount_entry *
-read_filesystem_list (int need_fs_type)
+read_file_system_list (bool need_fs_type)
 {
   struct mount_entry *mount_list;
   struct mount_entry *me;
@@ -360,12 +329,7 @@
        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
        devopt = strstr (mnt->mnt_opts, "dev=");
        if (devopt)
-         {
-           if (devopt[4] == '0' && (devopt[5] == 'x' || devopt[5] == 'X'))
-             me->me_dev = xatoi (devopt + 6);
-           else
-             me->me_dev = xatoi (devopt + 4);
-         }
+         me->me_dev = strtoul (devopt + 4, NULL, 16);
        else
          me->me_dev = (dev_t) -1;      /* Magic; means not known yet. */
 
@@ -438,14 +402,14 @@
 #if defined MOUNTED_FS_STAT_DEV /* BeOS */
   {
     /* The next_dev() and fs_stat_dev() system calls give the list of
-       all filesystems, including the information returned by statvfs()
+       all file systems, including the information returned by statvfs()
        (fs type, total blocks, free blocks etc.), but without the mount
-       point. But on BeOS all filesystems except / are mounted in the
+       point. But on BeOS all file systems except / are mounted in the
        rootfs, directly under /.
        The directory name of the mount point is often, but not always,
        identical to the volume name of the device.
        We therefore get the list of subdirectories of /, and the list
-       of all filesystems, and match the two lists.  */
+       of all file systems, and match the two lists.  */
 
     DIR *dirp;
     struct rootdir_entry
@@ -744,12 +708,12 @@
     int n_entries;
     int i;
 
-    /* Ask how many bytes to allocate for the mounted filesystem info.  */
+    /* Ask how many bytes to allocate for the mounted file system info.  */
     if (mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize) != 0)
       return NULL;
     entries = xmalloc (bufsize);
 
-    /* Get the list of mounted filesystems.  */
+    /* Get the list of mounted file systems.  */
     n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
     if (n_entries < 0)
       {
Index: lib/mountlist.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/mountlist.h,v
retrieving revision 1.11
diff -u -r1.11 mountlist.h
--- lib/mountlist.h     1 Nov 2003 06:00:46 -0000       1.11
+++ lib/mountlist.h     7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,6 @@
-/* mountlist.h -- declarations for list of mounted filesystems
+/* mountlist.h -- declarations for list of mounted file systems
 
-   Copyright (C) 1991, 1992, 1998, 2000, 2001, 2002, 2003 Free
+   Copyright (C) 1991, 1992, 1998, 2000, 2001, 2002, 2003, 2004 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -17,6 +17,8 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#include <stdbool.h>
+
 /* A mount table entry. */
 struct mount_entry
 {
@@ -24,13 +26,13 @@
   char *me_mountdir;           /* Mount point directory pathname. */
   char *me_type;               /* "nfs", "4.2", etc. */
   dev_t me_dev;                        /* Device number of me_mountdir. */
-  unsigned int me_dummy : 1;   /* Nonzero for dummy filesystems. */
+  unsigned int me_dummy : 1;   /* Nonzero for dummy file systems. */
   unsigned int me_remote : 1;  /* Nonzero for remote fileystems. */
   unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
   struct mount_entry *me_next;
 };
 
-struct mount_entry *read_filesystem_list (int need_fs_type);
+struct mount_entry *read_file_system_list (bool need_fs_type);
 
 #ifndef ME_DUMMY
 # define ME_DUMMY(Fs_name, Fs_type) \
Index: lib/nanosleep.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/nanosleep.c,v
retrieving revision 1.12
diff -u -r1.12 nanosleep.c
--- lib/nanosleep.c     13 May 2004 22:20:53 -0000      1.12
+++ lib/nanosleep.c     7 Aug 2004 00:09:12 -0000
@@ -23,14 +23,12 @@
    prototype for rpl_nanosleep. (they'd conflict e.g., on alpha-dec-osf3.2)  */
 #undef nanosleep
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <signal.h>
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #if HAVE_UNISTD_H
 # include <unistd.h>
@@ -77,7 +75,7 @@
 rpl_nanosleep (const struct timespec *requested_delay,
               struct timespec *remaining_delay)
 {
-  static int initialized;
+  static bool initialized;
 
 #ifdef SA_NOCLDSTOP
   struct sigaction oldact, newact;
@@ -100,7 +98,7 @@
       if (signal (SIGCONT, SIG_IGN) != SIG_IGN)
        signal (SIGCONT, sighandler);
 #endif
-      initialized = 1;
+      initialized = true;
     }
 
   my_usleep (requested_delay);
Index: lib/posixtm.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/posixtm.c,v
retrieving revision 1.16
diff -u -r1.16 posixtm.c
--- lib/posixtm.c       10 Sep 2003 03:47:34 -0000      1.16
+++ lib/posixtm.c       7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,7 @@
 /* Parse dates for touch and date.
-   Copyright (C) 1989, 1990, 1991, 1998, 2000-2003 Free Software Foundation 
Inc.
+
+   Copyright (C) 1989, 1990, 1991, 1998, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -45,7 +47,7 @@
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    ISDIGIT_LOCALE unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
 time_t mktime ();
 
@@ -113,7 +115,7 @@
   const char *dot = NULL;
   int pair[6];
   int *p;
-  unsigned int i;
+  size_t i;
 
   size_t s_len = strlen (s);
   size_t len = (((syntax_bits & PDS_SECONDS) && (dot = strchr (s, '.')))
@@ -304,7 +306,7 @@
        {
          printf ("%-15s %2u ", time_str, syntax_bits);
          if (posixtime (&t, time_str, syntax_bits))
-           printf ("%12ld %s", (long) t, ctime (&t));
+           printf ("%12ld %s", (long int) t, ctime (&t));
          else
            printf ("%12s %s", "*", "*\n");
        }
Index: lib/putenv.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/putenv.c,v
retrieving revision 1.27
diff -u -r1.27 putenv.c
--- lib/putenv.c        10 Sep 2003 04:22:10 -0000      1.27
+++ lib/putenv.c        7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997, 1998, 2000, 2003 Free Software Foundation, 
Inc.
+/* Copyright (C) 1991, 1994, 1997, 1998, 2000, 2003, 2004 Free Software 
Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to address@hidden
@@ -26,10 +26,7 @@
 /* Include errno.h *after* sys/types.h to work around header problems
    on AIX 3.2.5.  */
 #include <errno.h>
-#if !_LIBC
-# if !defined errno
-extern int errno;
-# endif
+#ifndef __set_errno
 # define __set_errno(ev) ((errno) = (ev))
 #endif
 
Index: lib/quotearg.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/quotearg.c,v
retrieving revision 1.41
diff -u -r1.41 quotearg.c
--- lib/quotearg.c      5 Feb 2004 19:05:52 -0000       1.41
+++ lib/quotearg.c      7 Aug 2004 00:09:12 -0000
@@ -30,6 +30,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -192,8 +193,8 @@
   size_t len = 0;
   char const *quote_string = 0;
   size_t quote_string_len = 0;
-  int backslash_escapes = 0;
-  int unibyte_locale = MB_CUR_MAX == 1;
+  bool backslash_escapes = false;
+  bool unibyte_locale = MB_CUR_MAX == 1;
 
 #define STORE(c) \
     do \
@@ -208,13 +209,13 @@
     {
     case c_quoting_style:
       STORE ('"');
-      backslash_escapes = 1;
+      backslash_escapes = true;
       quote_string = "\"";
       quote_string_len = 1;
       break;
 
     case escape_quoting_style:
-      backslash_escapes = 1;
+      backslash_escapes = true;
       break;
 
     case locale_quoting_style:
@@ -239,7 +240,7 @@
        char const *right = gettext_quote (N_("'"), quoting_style);
        for (quote_string = left; *quote_string; quote_string++)
          STORE (*quote_string);
-       backslash_escapes = 1;
+       backslash_escapes = true;
        quote_string = right;
        quote_string_len = strlen (quote_string);
       }
@@ -396,12 +397,12 @@
            /* Length of multibyte sequence found so far.  */
            size_t m;
 
-           int printable;
+           bool printable;
 
            if (unibyte_locale)
              {
                m = 1;
-               printable = isprint (c);
+               printable = isprint (c) != 0;
              }
            else
              {
@@ -409,7 +410,7 @@
                memset (&mbstate, 0, sizeof mbstate);
 
                m = 0;
-               printable = 1;
+               printable = true;
                if (argsize == SIZE_MAX)
                  argsize = strlen (arg);
 
@@ -422,12 +423,12 @@
                      break;
                    else if (bytes == (size_t) -1)
                      {
-                       printable = 0;
+                       printable = false;
                        break;
                      }
                    else if (bytes == (size_t) -2)
                      {
-                       printable = 0;
+                       printable = false;
                        while (i + m < argsize && arg[i + m])
                          m++;
                        break;
@@ -449,9 +450,9 @@
                                  goto use_shell_always_quoting_style;
                                }
                          }
-                           
+
                        if (! iswprint (w))
-                         printable = 0;
+                         printable = false;
                        m += bytes;
                      }
                  }
Index: lib/quotearg.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/quotearg.h,v
retrieving revision 1.10
diff -u -r1.10 quotearg.h
--- lib/quotearg.h      5 Feb 2004 19:05:52 -0000       1.10
+++ lib/quotearg.h      7 Aug 2004 00:09:12 -0000
@@ -29,7 +29,7 @@
   {
     /* Output names as-is (ls --quoting-style=literal).  */
     literal_quoting_style,
-    
+
     /* Quote names for the shell if they contain shell metacharacters
        or would cause ambiguous output (ls --quoting-style=shell).  */
     shell_quoting_style,
Index: lib/readtokens.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/readtokens.c,v
retrieving revision 1.13
diff -u -r1.13 readtokens.c
--- lib/readtokens.c    31 Mar 2004 07:46:28 -0000      1.13
+++ lib/readtokens.c    7 Aug 2004 00:09:12 -0000
@@ -96,7 +96,10 @@
       saved_delim = delim;
       memset (isdelim, 0, sizeof isdelim);
       for (j = 0; j < n_delim; j++)
-       isdelim[(unsigned char) delim[j]] = 1;
+       {
+         unsigned char ch = delim[j];
+         isdelim[ch] = 1;
+       }
     }
 
   /* FIXME: don't fool with this caching.  Use strchr instead.  */
Index: lib/readutmp.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/readutmp.c,v
retrieving revision 1.16
diff -u -r1.16 readutmp.c
--- lib/readutmp.c      19 Apr 2004 20:12:23 -0000      1.16
+++ lib/readutmp.c      7 Aug 2004 00:09:12 -0000
@@ -40,28 +40,31 @@
 
   trimmed_name = xmalloc (sizeof (UT_USER (ut)) + 1);
   strncpy (trimmed_name, UT_USER (ut), sizeof (UT_USER (ut)));
-  /* Append a trailing space character.  Some systems pad names shorter than
-     the maximum with spaces, others pad with NULs.  Remove any spaces.  */
-  trimmed_name[sizeof (UT_USER (ut))] = ' ';
-  p = strchr (trimmed_name, ' ');
-  if (p != NULL)
-    *p = '\0';
+  /* Append a trailing NUL.  Some systems pad names shorter than the
+     maximum with spaces, others pad with NULs.  Remove any trailing
+     spaces.  */
+  trimmed_name[sizeof (UT_USER (ut))] = '\0';
+  for (p = trimmed_name + strlen (trimmed_name);
+       trimmed_name < p && p[-1] == ' ';
+       *--p = '\0')
+    continue;
   return trimmed_name;
 }
 
 /* Read the utmp entries corresponding to file FILENAME into freshly-
    malloc'd storage, set *UTMP_BUF to that pointer, set *N_ENTRIES to
    the number of entries, and return zero.  If there is any error,
-   return non-zero and don't modify the parameters.  */
+   return -1, setting errno, and don't modify the parameters.  */
 
 #ifdef UTMP_NAME_FUNCTION
 
 int
-read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf)
+read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf)
 {
-  int n_read;
+  size_t n_read;
+  size_t n_alloc = 4;
+  STRUCT_UTMP *utmp = xmalloc (n_alloc * sizeof *utmp);
   STRUCT_UTMP *u;
-  STRUCT_UTMP *utmp = NULL;
 
   /* Ignore the return value for now.
      Solaris' utmpname returns 1 upon success -- which is contrary
@@ -74,16 +77,12 @@
   n_read = 0;
   while ((u = GET_UTMP_ENT ()) != NULL)
     {
-      STRUCT_UTMP *p;
-      ++n_read;
-      p = (STRUCT_UTMP *) realloc (utmp, n_read * sizeof (STRUCT_UTMP));
-      if (p == NULL)
+      if (n_read == n_alloc)
        {
-         free (utmp);
-         END_UTMP_ENT ();
-         return 1;
+         utmp = xnrealloc (utmp, n_alloc, 2 * sizeof *utmp);
+         n_alloc *= 2;
        }
-      utmp = p;
+      ++n_read;
       utmp[n_read - 1] = *u;
     }
 
@@ -98,7 +97,7 @@
 #else
 
 int
-read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf)
+read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf)
 {
   FILE *utmp;
   struct stat file_stats;
@@ -108,14 +107,14 @@
 
   utmp = fopen (filename, "r");
   if (utmp == NULL)
-    return 1;
+    return -1;
 
   if (fstat (fileno (utmp), &file_stats) != 0)
     {
       int e = errno;
       fclose (utmp);
       errno = e;
-      return 1;
+      return -1;
     }
   size = file_stats.st_size;
   buf = xmalloc (size);
@@ -126,14 +125,14 @@
       free (buf);
       fclose (utmp);
       errno = e;
-      return 1;
+      return -1;
     }
   if (fclose (utmp) != 0)
     {
       int e = errno;
       free (buf);
       errno = e;
-      return 1;
+      return -1;
     }
 
   *n_entries = n_read;
Index: lib/readutmp.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/readutmp.h,v
retrieving revision 1.14
diff -u -r1.14 readutmp.h
--- lib/readutmp.h      16 Aug 2003 03:51:50 -0000      1.14
+++ lib/readutmp.h      7 Aug 2004 00:09:12 -0000
@@ -1,7 +1,7 @@
 /* Declarations for GNU's read utmp module.
 
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003 Free Software Foundation, Inc.
+   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -116,11 +116,11 @@
 # else
 
 #  if HAVE_STRUCT_UTMP_UT_USER
-#   define UT_USER(Utmp) Utmp->ut_user
+#   define UT_USER(Utmp) ((Utmp)->ut_user)
 #  endif
 #  if HAVE_STRUCT_UTMP_UT_NAME
 #   undef UT_USER
-#   define UT_USER(Utmp) Utmp->ut_name
+#   define UT_USER(Utmp) ((Utmp)->ut_name)
 #  endif
 
 # endif
@@ -143,6 +143,8 @@
 
 typedef struct UTMP_STRUCT_NAME STRUCT_UTMP;
 
+enum { UT_USER_SIZE = sizeof UT_USER ((STRUCT_UTMP *) 0) };
+
 # include <time.h>
 # ifdef HAVE_SYS_PARAM_H
 #  include <sys/param.h>
@@ -180,6 +182,6 @@
 # endif
 
 char *extract_trimmed_name (const STRUCT_UTMP *ut);
-int read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf);
+int read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP 
**utmp_buf);
 
 #endif /* __READUTMP_H__ */
Index: lib/rmdir.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/rmdir.c,v
retrieving revision 1.11
diff -u -r1.11 rmdir.c
--- lib/rmdir.c 9 Sep 2003 22:27:55 -0000       1.11
+++ lib/rmdir.c 7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,6 @@
 /* BSD compatible remove directory function for System V
 
-   Copyright (C) 1988, 1990, 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1990, 1999, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,19 +22,9 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
-#if STAT_MACROS_BROKEN
-# undef S_ISDIR
-#endif
-
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
+#include "stat-macros.h"
 
 /* rmdir adapted from GNU tar.  */
 
Index: lib/safe-read.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/safe-read.c,v
retrieving revision 1.23
diff -u -r1.23 safe-read.c
--- lib/safe-read.c     29 May 2003 07:21:59 -0000      1.23
+++ lib/safe-read.c     7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,7 @@
 /* An interface to read and write that retries after interrupts.
-   Copyright (C) 1993, 1994, 1998, 2002-2003 Free Software Foundation, Inc.
+
+   Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -33,9 +35,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #ifdef EINTR
 # define IS_EINTR(x) ((x) == EINTR)
@@ -61,22 +60,23 @@
 size_t
 safe_rw (int fd, void const *buf, size_t count)
 {
-  ssize_t result;
-
-  /* POSIX limits COUNT to SSIZE_MAX, but we limit it further, requiring
-     that COUNT <= INT_MAX, to avoid triggering a bug in Tru64 5.1.
-     When decreasing COUNT, keep the file pointer block-aligned.
-     Note that in any case, read(write) may succeed, yet read(write)
-     fewer than COUNT bytes, so the caller must be prepared to handle
-     partial results.  */
-  if (count > INT_MAX)
-    count = INT_MAX & ~8191;
+  /* Work around a bug in Tru64 5.1.  Attempting to read more than
+     INT_MAX bytes fails with errno == EINVAL.  See
+     <http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>.
+     When decreasing COUNT, keep it block-aligned.  */
+  enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 };
 
-  do
+  for (;;)
     {
-      result = rw (fd, buf, count);
-    }
-  while (result < 0 && IS_EINTR (errno));
+      ssize_t result = rw (fd, buf, count);
 
-  return (size_t) result;
+      if (0 <= result)
+       return result;
+      else if (IS_EINTR (errno))
+       continue;
+      else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count)
+       count = BUGGY_READ_MAXIMUM;
+      else
+       return result;
+    }
 }
Index: lib/save-cwd.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/save-cwd.c,v
retrieving revision 1.16
diff -u -r1.16 save-cwd.c
--- lib/save-cwd.c      12 May 2004 16:23:36 -0000      1.16
+++ lib/save-cwd.c      7 Aug 2004 00:09:12 -0000
@@ -21,6 +21,7 @@
 # include "config.h"
 #endif
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -35,9 +36,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #ifndef O_DIRECTORY
 # define O_DIRECTORY 0
@@ -66,7 +64,7 @@
 int
 save_cwd (struct saved_cwd *cwd)
 {
-  static int have_working_fchdir = 1;
+  static bool have_working_fchdir = true;
 
   cwd->desc = -1;
   cwd->name = NULL;
@@ -80,7 +78,7 @@
       if (cwd->desc < 0)
        {
          cwd->name = xgetcwd ();
-         return cwd->name == NULL;
+         return cwd->name ? 0 : -1;
        }
 
 # if __sun__ || sun
@@ -92,7 +90,7 @@
            {
              close (cwd->desc);
              cwd->desc = -1;
-             have_working_fchdir = 0;
+             have_working_fchdir = false;
            }
          else
            {
@@ -100,13 +98,13 @@
              close (cwd->desc);
              cwd->desc = -1;
              errno = saved_errno;
-             return 1;
+             return -1;
            }
        }
 # endif /* __sun__ || sun */
 #else
 # define fchdir(x) (abort (), 0)
-      have_working_fchdir = 0;
+      have_working_fchdir = false;
 #endif
     }
 
@@ -114,22 +112,22 @@
     {
       cwd->name = xgetcwd ();
       if (cwd->name == NULL)
-       return 1;
+       return -1;
     }
   return 0;
 }
 
 /* Change to recorded location, CWD, in directory hierarchy.
-   Upon failure, return nonzero (errno is set by chdir or fchdir).
+   Upon failure, return -1 (errno is set by chdir or fchdir).
    Upon success, return zero.  */
 
 int
 restore_cwd (const struct saved_cwd *cwd)
 {
   if (0 <= cwd->desc)
-    return fchdir (cwd->desc) < 0;
+    return fchdir (cwd->desc);
   else
-    return chdir (cwd->name) < 0;
+    return chdir (cwd->name);
 }
 
 void
Index: lib/savedir.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/savedir.c,v
retrieving revision 1.22
diff -u -r1.22 savedir.c
--- lib/savedir.c       9 Sep 2003 22:27:55 -0000       1.22
+++ lib/savedir.c       7 Aug 2004 00:09:12 -0000
@@ -1,7 +1,7 @@
 /* savedir.c -- save the list of files in a directory in a string
 
-   Copyright 1990, 1997, 1998, 1999, 2000, 2001, 2003 Free Software
-   Foundation, Inc.
+   Copyright 1990, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free
+   Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,9 +28,6 @@
 #include <sys/types.h>
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
@@ -89,7 +86,7 @@
   while ((dp = readdir (dirp)) != NULL)
     {
       /* Skip "", ".", and "..".  "" is returned by at least one buggy
-         implementation: Solaris 2.4 readdir on NFS filesystems.  */
+         implementation: Solaris 2.4 readdir on NFS file systems.  */
       char const *entry = dp->d_name;
       if (entry[entry[0] != '.' ? 0 : entry[1] != '.' ? 1 : 2] != '\0')
        {
Index: lib/setenv.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/setenv.c,v
retrieving revision 1.10
diff -u -r1.10 setenv.c
--- lib/setenv.c        20 Jan 2004 17:05:34 -0000      1.10
+++ lib/setenv.c        7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1995-1999,2000-2003 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995-1999,2000-2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -21,10 +21,7 @@
 #include <alloca.h>
 
 #include <errno.h>
-#if !_LIBC
-# if !defined errno && !defined HAVE_ERRNO_DECL
-extern int errno;
-# endif
+#ifndef __set_errno
 # define __set_errno(ev) ((errno) = (ev))
 #endif
 
Index: lib/sig2str.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/sig2str.c,v
retrieving revision 1.4
diff -u -r1.4 sig2str.c
--- lib/sig2str.c       23 Nov 2002 16:17:34 -0000      1.4
+++ lib/sig2str.c       7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,6 @@
 /* sig2str.c -- convert between signal names and numbers
 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -253,7 +253,7 @@
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    ISDIGIT_LOCALE unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
 /* Convert the signal name SIGNAME to a signal number.  Return the
    signal number if successful, -1 otherwise.  */
@@ -270,7 +270,7 @@
     }
   else
     {
-      unsigned i;
+      unsigned int i;
       for (i = 0; i < NUMNAME_ENTRIES; i++)
        if (strcmp (numname_table[i].name, signame) == 0)
          return numname_table[i].num;
@@ -315,7 +315,7 @@
 int
 sig2str (int signum, char *signame)
 {
-  unsigned i;
+  unsigned int i;
   for (i = 0; i < NUMNAME_ENTRIES; i++)
     if (numname_table[i].num == signum)
       {
Index: lib/stat.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/stat.c,v
retrieving revision 1.9
diff -u -r1.9 stat.c
--- lib/stat.c  10 Sep 2003 06:59:17 -0000      1.9
+++ lib/stat.c  7 Aug 2004 00:09:12 -0000
@@ -3,7 +3,7 @@
    has this bug.  Also work around a deficiency in Solaris systems (up to at
    least Solaris 9) regarding the semantics of `lstat ("symlink/", sbuf).'
 
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -27,25 +27,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 #if defined LSTAT && ! LSTAT_FOLLOWS_SLASHED_SYMLINK
 # include <stdlib.h>
 # include <string.h>
 
-# ifdef STAT_MACROS_BROKEN
-#  undef S_ISLNK
-# endif
-
-# ifndef S_ISLNK
-#  ifdef S_IFLNK
-#   define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#  else
-#   define S_ISLNK(m) 0
-#  endif
-# endif
-
+# include "stat-macros.h"
 # include "xalloc.h"
 
 /* lstat works differently on Linux and Solaris systems.  POSIX (see
Index: lib/strtoimax.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strtoimax.c,v
retrieving revision 1.9
diff -u -r1.9 strtoimax.c
--- lib/strtoimax.c     12 Sep 2003 18:24:51 -0000      1.9
+++ lib/strtoimax.c     7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,7 @@
 /* Convert string representation of a number into an intmax_t value.
-   Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+   Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,7 +25,8 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
-#elif HAVE_STDINT_H
+#endif
+#if HAVE_STDINT_H
 # include <stdint.h>
 #endif
 
@@ -66,14 +69,14 @@
 {
 #if HAVE_LONG_LONG
   verify (size_is_that_of_long_or_long_long,
-         (sizeof (INT) == sizeof (long)
-          || sizeof (INT) == sizeof (long long)));
+         (sizeof (INT) == sizeof (long int)
+          || sizeof (INT) == sizeof (long long int)));
 
-  if (sizeof (INT) != sizeof (long))
+  if (sizeof (INT) != sizeof (long int))
     return strtoll (ptr, endptr, base);
 #else
   verify (size_is_that_of_long,
-         sizeof (INT) == sizeof (long));
+         sizeof (INT) == sizeof (long int));
 #endif
 
   return strtol (ptr, endptr, base);
Index: lib/strverscmp.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strverscmp.c,v
retrieving revision 1.13
diff -u -r1.13 strverscmp.c
--- lib/strverscmp.c    9 Jul 2003 22:48:53 -0000       1.13
+++ lib/strverscmp.c    7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
 /* Compare strings while treating digits characters numerically.
-   Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jean-Fran├žois Bignolles <address@hidden>, 1997.
 
@@ -43,7 +43,7 @@
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    ISDIGIT_LOCALE unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
 #undef __strverscmp
 #undef strverscmp
Index: lib/userspec.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/userspec.c,v
retrieving revision 1.41
diff -u -r1.41 userspec.c
--- lib/userspec.c      31 Mar 2004 07:47:20 -0000      1.41
+++ lib/userspec.c      7 Aug 2004 00:09:12 -0000
@@ -27,6 +27,7 @@
 
 #include <alloca.h>
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <pwd.h>
@@ -44,6 +45,7 @@
 # include <unistd.h>
 #endif
 
+#include "inttostr.h"
 #include "strdup.h"
 #include "xalloc.h"
 #include "xstrtol.h"
@@ -96,9 +98,9 @@
 #define V_STRDUP(dest, src)                                            \
   do                                                                   \
     {                                                                  \
-      int _len = strlen ((src));                                       \
-      (dest) = (char *) alloca (_len + 1);                             \
-      strcpy (dest, src);                                              \
+      size_t size = strlen (src) + 1;                                  \
+      (dest) = (char *) alloca (size);                                 \
+      memcpy (dest, src, size);                                                
\
     }                                                                  \
   while (0)
 
@@ -109,19 +111,25 @@
    POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
    ISDIGIT_LOCALE unless it's important to use the locale's definition
    of `digit' even when the host does not conform to POSIX.  */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
-/* Return nonzero if STR represents an unsigned decimal integer,
-   otherwise return 0. */
+#ifdef __DJGPP__
+
+/* Return true if STR represents an unsigned decimal integer.  */
 
-static int
+static bool
 is_number (const char *str)
 {
-  for (; *str; str++)
-    if (!ISDIGIT (*str))
-      return 0;
-  return 1;
+  do
+    {
+      if (!ISDIGIT (*str))
+       return false;
+    }
+  while (*++str);
+
+  return true;
 }
+#endif
 
 /* Extract from NAME, which has the form "[user][:.][group]",
    a USERNAME, UID U, GROUPNAME, and GID G.
@@ -209,23 +217,16 @@
       pwd = getpwnam (u);
       if (pwd == NULL)
        {
-
-         if (!is_number (u))
-           error_msg = E_invalid_user;
+         bool use_login_group = (separator != NULL && g == NULL);
+         if (use_login_group)
+           error_msg = E_bad_spec;
          else
            {
-             int use_login_group;
-             use_login_group = (separator != NULL && g == NULL);
-             if (use_login_group)
-               error_msg = E_bad_spec;
-             else
-               {
-                 unsigned long int tmp_long;
-                 if (xstrtoul (u, NULL, 0, &tmp_long, NULL) != LONGINT_OK
-                     || tmp_long > MAXUID)
-                   return _(E_invalid_user);
-                 *uid = tmp_long;
-               }
+             unsigned long int tmp_long;
+             if (! (xstrtoul (u, NULL, 10, &tmp_long, "") == LONGINT_OK
+                    && tmp_long <= MAXUID))
+               return _(E_invalid_user);
+             *uid = tmp_long;
            }
        }
       else
@@ -239,12 +240,9 @@
              grp = getgrgid (pwd->pw_gid);
              if (grp == NULL)
                {
-                 /* This is enough room to hold the unsigned decimal
-                    representation of any 32-bit quantity and the trailing
-                    zero byte.  */
-                 char uint_buf[21];
-                 sprintf (uint_buf, "%u", (unsigned) (pwd->pw_gid));
-                 V_STRDUP (groupname, uint_buf);
+                 char buf[INT_BUFSIZE_BOUND (uintmax_t)];
+                 char const *num = umaxtostr (pwd->pw_gid, buf);
+                 V_STRDUP (groupname, num);
                }
              else
                {
@@ -262,16 +260,11 @@
       grp = getgrnam (g);
       if (grp == NULL)
        {
-         if (!is_number (g))
-           error_msg = E_invalid_group;
-         else
-           {
-             unsigned long int tmp_long;
-             if (xstrtoul (g, NULL, 0, &tmp_long, NULL) != LONGINT_OK
-                 || tmp_long > MAXGID)
-               return _(E_invalid_group);
-             *gid = tmp_long;
-           }
+         unsigned long int tmp_long;
+         if (! (xstrtoul (g, NULL, 10, &tmp_long, "") == LONGINT_OK
+                && tmp_long <= MAXGID))
+           return _(E_invalid_group);
+         *gid = tmp_long;
        }
       else
        *gid = grp->gr_gid;
@@ -336,10 +329,10 @@
       tmp = strdup (argv[i]);
       e = parse_user_spec (tmp, &uid, &gid, &username, &groupname);
       free (tmp);
-      printf ("%s: %u %u %s %s %s\n",
+      printf ("%s: %lu %lu %s %s %s\n",
              argv[i],
-             (unsigned int) uid,
-             (unsigned int) gid,
+             (unsigned long int) uid,
+             (unsigned long int) gid,
              NULL_CHECK (username),
              NULL_CHECK (groupname),
              NULL_CHECK (e));
Index: lib/utime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/utime.c,v
retrieving revision 1.11
diff -u -r1.11 utime.c
--- lib/utime.c 17 Nov 2003 16:16:00 -0000      1.11
+++ lib/utime.c 7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -34,9 +34,6 @@
 
 #include <unistd.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
 
 #include "full-write.h"
 #include "safe-read.h"
Index: lib/version-etc.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/version-etc.c,v
retrieving revision 1.14
diff -u -r1.14 version-etc.c
--- lib/version-etc.c   16 Jan 2004 07:55:43 -0000      1.14
+++ lib/version-etc.c   7 Aug 2004 00:09:12 -0000
@@ -46,7 +46,7 @@
                const char *command_name, const char *package,
                const char *version, va_list authors)
 {
-  unsigned int n_authors;
+  size_t n_authors;
 
   /* Count the number of authors.  */
   {
Index: lib/xgethostname.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xgethostname.c,v
retrieving revision 1.17
diff -u -r1.17 xgethostname.c
--- lib/xgethostname.c  24 Sep 2003 21:09:18 -0000      1.17
+++ lib/xgethostname.c  7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,7 @@
 /* xgethostname.c -- return current hostname with unlimited length
-   Copyright (C) 1992, 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+   Copyright (C) 1992, 1996, 2000, 2001, 2003, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -25,60 +27,56 @@
 #include "xgethostname.h"
 
 #include <stdlib.h>
-#include <sys/types.h>
-
 #include <errno.h>
-#ifndef errno
-extern int errno;
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
 #endif
 
 #include "error.h"
-#include "exit.h"
 #include "xalloc.h"
 
 #ifndef ENAMETOOLONG
-# define ENAMETOOLONG 9999
+# define ENAMETOOLONG 0
 #endif
 
-int gethostname ();
-
 #ifndef INITIAL_HOSTNAME_LENGTH
 # define INITIAL_HOSTNAME_LENGTH 34
 #endif
 
 /* Return the current hostname in malloc'd storage.
    If malloc fails, exit.
-   Upon any other failure, return NULL.  */
+   Upon any other failure, return NULL and set errno.  */
 char *
 xgethostname (void)
 {
-  char *hostname;
-  size_t size;
+  char *hostname = NULL;
+  size_t size = INITIAL_HOSTNAME_LENGTH;
 
-  size = INITIAL_HOSTNAME_LENGTH;
-  /* Use size + 1 here rather than size to work around the bug
-     in SunOS 5.5's gethostname whereby it NUL-terminates HOSTNAME
-     even when the name is longer than the supplied buffer.  */
-  hostname = xmalloc (size + 1);
   while (1)
     {
-      int k = size - 1;
-      int err;
-
+      /* Use SIZE_1 here rather than SIZE to work around the bug in
+        SunOS 5.5's gethostname whereby it NUL-terminates HOSTNAME
+        even when the name is as long as the supplied buffer.  */
+      size_t size_1;
+
+      hostname = x2realloc (hostname, &size);
+      size_1 = size - 1;
+      hostname[size_1 - 1] = '\0';
       errno = 0;
-      hostname[k] = '\0';
-      err = gethostname (hostname, size);
-      if (err >= 0 && hostname[k] == '\0')
-       break;
-      else if (err < 0 && errno != ENAMETOOLONG && errno != 0)
+
+      if (gethostname (hostname, size_1) == 0)
+       {
+         if (! hostname[size_1 - 1])
+           break;
+       }
+      else if (errno != 0 && errno != ENAMETOOLONG && errno != EINVAL)
        {
          int saved_errno = errno;
          free (hostname);
          errno = saved_errno;
          return NULL;
        }
-      size *= 2;
-      hostname = xrealloc (hostname, size + 1);
     }
 
   return hostname;
Index: lib/xmemcoll.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xmemcoll.c,v
retrieving revision 1.3
diff -u -r1.3 xmemcoll.c
--- lib/xmemcoll.c      22 Jul 2003 22:10:56 -0000      1.3
+++ lib/xmemcoll.c      7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
 /* Locale-specific memory comparison.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,10 +22,6 @@
 #endif
 
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
 #include <stdlib.h>
 
 #include "gettext.h"
Index: lib/xreadlink.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xreadlink.c,v
retrieving revision 1.14
diff -u -r1.14 xreadlink.c
--- lib/xreadlink.c     1 Jun 2004 20:27:21 -0000       1.14
+++ lib/xreadlink.c     7 Aug 2004 00:09:12 -0000
@@ -27,10 +27,6 @@
 
 #include <stdio.h>
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
 #include <limits.h>
 #include <sys/types.h>
 #include <stdlib.h>
Index: lib/xstrtod.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtod.c,v
retrieving revision 1.9
diff -u -r1.9 xstrtod.c
--- lib/xstrtod.c       16 Jan 2004 07:55:43 -0000      1.9
+++ lib/xstrtod.c       7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,6 @@
 /* error-checking interface to strtod-like functions
-   Copyright (C) 1996, 1999, 2000, 2003 Free Software Foundation, Inc.
+
+   Copyright (C) 1996, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -34,36 +35,35 @@
 
 /* An interface to strtod that encapsulates all the error checking
    one should usually perform.  Like strtod, but upon successful
-   conversion put the result in *RESULT and return zero.  Return
-   non-zero and don't modify *RESULT upon any failure.  CONVERT
+   conversion put the result in *RESULT and return true.  Return
+   false and don't modify *RESULT upon any failure.  CONVERT
    specifies the conversion function, e.g., strtod itself.  */
 
-int
+bool
 xstrtod (char const *str, char const **ptr, double *result,
         double (*convert) (char const *, char **))
 {
   double val;
   char *terminator;
-  int fail;
+  bool ok = true;
 
-  fail = 0;
   errno = 0;
   val = convert (str, &terminator);
 
   /* Having a non-zero terminator is an error only when PTR is NULL. */
   if (terminator == str || (ptr == NULL && *terminator != '\0'))
-    fail = 1;
+    ok = false;
   else
     {
       /* Allow underflow (in which case strtod returns zero),
         but flag overflow as an error. */
       if (val != 0.0 && errno == ERANGE)
-       fail = 1;
+       ok = false;
     }
 
   if (ptr != NULL)
     *ptr = terminator;
 
   *result = val;
-  return fail;
+  return ok;
 }
Index: lib/xstrtod.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtod.h,v
retrieving revision 1.8
diff -u -r1.8 xstrtod.h
--- lib/xstrtod.h       16 Jan 2004 07:55:43 -0000      1.8
+++ lib/xstrtod.h       7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,6 @@
 /* Error-checking interface to strtod-like functions.
 
-   Copyright (C) 1996, 1998, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,7 +21,9 @@
 #ifndef XSTRTOD_H
 # define XSTRTOD_H 1
 
-int xstrtod (const char *str, const char **ptr, double *result,
-            double (*convert) (char const *, char **));
+# include <stdbool.h>
+
+bool xstrtod (const char *str, const char **ptr, double *result,
+             double (*convert) (char const *, char **));
 
 #endif /* not XSTRTOD_H */
Index: lib/xstrtoimax.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtoimax.c,v
retrieving revision 1.4
diff -u -r1.4 xstrtoimax.c
--- lib/xstrtoimax.c    14 Oct 2003 20:08:26 -0000      1.4
+++ lib/xstrtoimax.c    7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
 /* xstrtoimax.c -- A more useful interface to strtoimax.
-   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,11 +21,7 @@
 # include <config.h>
 #endif
 
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#elif HAVE_STDINT_H
-# include <stdint.h>
-#endif
+#include "xstrtol.h"
 
 #define __strtol strtoimax
 #define __strtol_t intmax_t
Index: lib/xstrtol.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtol.c,v
retrieving revision 1.34
diff -u -r1.34 xstrtol.c
--- lib/xstrtol.c       13 Nov 2003 05:17:20 -0000      1.34
+++ lib/xstrtol.c       7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,6 @@
 /* A more useful interface to strtol.
 
-   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003 Free
+   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -37,15 +37,10 @@
 
 #include <assert.h>
 #include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
 #include <limits.h>
+#include <stdlib.h>
+#include <string.h>
 
 /* The extra casts work around common compiler bugs.  */
 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
@@ -121,9 +116,10 @@
   if (! TYPE_SIGNED (__strtol_t))
     {
       const char *q = s;
-      while (ISSPACE ((unsigned char) *q))
-       ++q;
-      if (*q == '-')
+      unsigned char ch = *q;
+      while (ISSPACE (ch))
+       ch = *++q;
+      if (ch == '-')
        return LONGINT_INVALID;
     }
 
Index: lib/xstrtol.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtol.h,v
retrieving revision 1.18
diff -u -r1.18 xstrtol.h
--- lib/xstrtol.h       24 Jan 2004 07:22:34 -0000      1.18
+++ lib/xstrtol.h       7 Aug 2004 00:09:12 -0000
@@ -22,13 +22,11 @@
 
 # include "exitfail.h"
 
-/* Get uintmax_t.  */
 # if HAVE_INTTYPES_H
 #  include <inttypes.h>
-# else
-#  if HAVE_STDINT_H
-#   include <stdint.h>
-#  endif
+# endif
+# if HAVE_STDINT_H
+#  include <stdint.h>
 # endif
 
 # ifndef _STRTOL_ERROR
Index: lib/xstrtoumax.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtoumax.c,v
retrieving revision 1.8
diff -u -r1.8 xstrtoumax.c
--- lib/xstrtoumax.c    14 Oct 2003 20:08:26 -0000      1.8
+++ lib/xstrtoumax.c    7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
 /* xstrtoumax.c -- A more useful interface to strtoumax.
-   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,11 +21,7 @@
 # include <config.h>
 #endif
 
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#elif HAVE_STDINT_H
-# include <stdint.h>
-#endif
+#include "xstrtol.h"
 
 #define __strtol strtoumax
 #define __strtol_t uintmax_t
Index: m4/acl.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/acl.m4,v
retrieving revision 1.2
diff -u -r1.2 acl.m4
--- m4/acl.m4   31 Dec 2002 13:43:06 -0000      1.2
+++ m4/acl.m4   7 Aug 2004 00:09:12 -0000
@@ -14,7 +14,7 @@
 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 # Written by Paul Eggert.
 
Index: m4/afs.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/afs.m4,v
retrieving revision 1.6
diff -u -r1.6 afs.m4
--- m4/afs.m4   18 Apr 2004 18:12:50 -0000      1.6
+++ m4/afs.m4   7 Aug 2004 00:09:12 -0000
@@ -1,13 +1,12 @@
-#serial 6
+#serial 7
 
 AC_DEFUN([gl_AFS],
   [
-    AC_MSG_CHECKING(for AFS)
-    if test -d /afs; then
+    AC_ARG_WITH(afs,
+                AC_HELP_STRING([--with-afs],
+                               [support for the Andrew File System 
[[default=no]]]),
+    test "$withval" = no || with_afs=yes, with_afs=no)
+    if test "$with_afs" = yes; then
       AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.])
-      ac_result=yes
-    else
-      ac_result=no
     fi
-    AC_MSG_RESULT($ac_result)
   ])
Index: m4/calloc.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/calloc.m4,v
retrieving revision 1.1
diff -u -r1.1 calloc.m4
--- m4/calloc.m4        10 Jun 2004 08:29:26 -0000      1.1
+++ m4/calloc.m4        7 Aug 2004 00:09:12 -0000
@@ -1,8 +1,4 @@
-#serial 1
-
-# FIXME: remove this whole file once we can depend
-# on having the definition from autoconf.
-undefine([AC_FUNC_CALLOC])
+#serial 2
 
 # Determine whether calloc (N, S) returns non-NULL when N*S is zero.
 # If so, define HAVE_CALLOC.  Otherwise, define calloc to rpl_calloc
Index: m4/dirfd.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/dirfd.m4,v
retrieving revision 1.15
diff -u -r1.15 dirfd.m4
--- m4/dirfd.m4 20 Apr 2004 08:57:02 -0000      1.15
+++ m4/dirfd.m4 7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-#serial 7
+#serial 8
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 dnl From Jim Meyering
Index: m4/fsusage.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/fsusage.m4,v
retrieving revision 1.18
diff -u -r1.18 fsusage.m4
--- m4/fsusage.m4       18 Apr 2004 18:12:50 -0000      1.18
+++ m4/fsusage.m4       7 Aug 2004 00:09:12 -0000
@@ -1,11 +1,34 @@
-#serial 12
+# fsusage.m4 serial 13
+# Obtaining file system usage information.
 
-# From fileutils/configure.in
+# Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Written by Jim Meyering.
 
 AC_DEFUN([gl_FSUSAGE],
 [
   AC_CHECK_HEADERS_ONCE(sys/param.h)
-  AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
+  AC_CHECK_HEADERS_ONCE(sys/vfs.h sys/fs_types.h)
+  AC_CHECK_HEADERS(sys/mount.h, [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
   gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
   if test $gl_cv_fs_space = yes; then
     AC_LIBOBJ(fsusage)
@@ -13,7 +36,7 @@
   fi
 ])
 
-# Try to determine how a program can obtain filesystem usage information.
+# Try to determine how a program can obtain file system usage information.
 # If successful, define the appropriate symbol (see fsusage.c) and
 # execute ACTION-IF-FOUND.  Otherwise, execute ACTION-IF-NOT-FOUND.
 #
@@ -22,7 +45,7 @@
 AC_DEFUN([gl_FILE_SYSTEM_USAGE],
 [
 
-echo "checking how to get filesystem space usage..."
+echo "checking how to get file system space usage..."
 ac_fsusage_space=no
 
 # Perform only the link test since it seems there are no variants of the
@@ -199,7 +222,7 @@
   AC_TRY_CPP([#include <sys/filsys.h>
     ],
     AC_DEFINE(STAT_READ_FILSYS, 1,
-      [Define if there is no specific function for reading filesystems usage
+      [Define if there is no specific function for reading file systems usage
        information and you have the <sys/filsys.h> header file.  (SVR2)])
     ac_fsusage_space=yes)
 fi
Index: m4/jm-macros.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/jm-macros.m4,v
retrieving revision 1.150
diff -u -r1.150 jm-macros.m4
--- m4/jm-macros.m4     20 Apr 2004 09:07:30 -0000      1.150
+++ m4/jm-macros.m4     7 Aug 2004 00:09:12 -0000
@@ -1,6 +1,25 @@
-#serial 72   -*- autoconf -*-
+#serial 75   -*- autoconf -*-
 
-dnl Misc type-related macros for fileutils, sh-utils, textutils.
+dnl Misc type-related macros for coreutils.
+
+# Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Written by Jim Meyering.
 
 AC_DEFUN([gl_MACROS],
 [
@@ -73,15 +92,16 @@
 
   # used by sleep and shred
   AC_REQUIRE([gl_CLOCK_TIME])
-  AC_CHECK_FUNCS(gettimeofday)
+  AC_CHECK_FUNCS_ONCE(gettimeofday)
   AC_FUNC_GETTIMEOFDAY_CLOBBER
+  # used by shred
+  AC_CHECK_FUNCS_ONCE(directio)
 
   AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
 
-  AC_CHECK_FUNCS( \
+  AC_CHECK_FUNCS_ONCE( \
     endgrent \
     endpwent \
-    fdatasync \
     ftruncate \
     gethrtime \
     hasmntopt \
@@ -100,17 +120,26 @@
     strrchr \
     sysctl \
     sysinfo \
+    tcgetpgrp \
     wcrtomb \
     tzset \
   )
 
-  # for test.c
-  AC_CHECK_FUNCS(setreuid setregid)
-
   AC_FUNC_STRTOD
+
+  AC_REQUIRE([cu_PREREQ_STAT_PROG])
   AC_REQUIRE([GL_FUNC_GETCWD_PATH_MAX])
   AC_REQUIRE([GL_FUNC_READDIR])
 
+  # for dd.c and shred.c
+  fetish_saved_libs=$LIBS
+    AC_SEARCH_LIBS([fdatasync], [rt posix4],
+                  [test "$ac_cv_search_fdatasync" = "none required" ||
+                   LIB_FDATASYNC=$ac_cv_search_fdatasync])
+    AC_SUBST([LIB_FDATASYNC])
+    AC_CHECK_FUNCS(fdatasync)
+  LIBS=$fetish_saved_libs
+
   # See if linking `seq' requires -lm.
   # It does on nearly every system.  The single exception (so far) is
   # BeOS which has all the math functions in the normal runtime library
@@ -146,7 +175,6 @@
   # If any of these functions don't exist (e.g. DJGPP 2.03),
   # use the corresponding stub.
   AC_CHECK_FUNC([fchdir], , [AC_LIBOBJ(fchdir-stub)])
-  AC_CHECK_FUNC([fchown], , [AC_LIBOBJ(fchown-stub)])
 
   AC_REQUIRE([gl_FUNC_FREE])
 ])
@@ -156,7 +184,7 @@
 # See the definition of ac_includes_default in `configure'.
 AC_DEFUN([gl_CHECK_ALL_HEADERS],
 [
-  AC_CHECK_HEADERS( \
+  AC_CHECK_HEADERS_ONCE( \
     errno.h  \
     fcntl.h \
     float.h \
@@ -177,13 +205,11 @@
     sys/fstyp.h \
     sys/ioctl.h \
     sys/mntent.h \
-    sys/mount.h \
     sys/param.h \
     sys/resource.h \
     sys/socket.h \
     sys/statfs.h \
     sys/statvfs.h \
-    sys/sysctl.h \
     sys/systeminfo.h \
     sys/time.h \
     sys/timeb.h \
@@ -193,8 +219,12 @@
     termios.h \
     unistd.h \
     utime.h \
-    values.h \
   )
+  AC_CHECK_HEADERS(sys/mount.h sys/sysctl.h, [], [],
+    [AC_INCLUDES_DEFAULT
+     [#if HAVE_SYS_PARAM_H
+       #include <sys/param.h>
+      #endif]])
 ])
 
 # This macro must be invoked before any tests that run the compiler.
@@ -240,7 +270,6 @@
   AC_REQUIRE([AC_TYPE_SIZE_T])
   AC_REQUIRE([AC_TYPE_UID_T])
   AC_CHECK_TYPE(ino_t, unsigned long int)
-  AC_CHECK_TYPE(uintptr_t, size_t)
 
   gt_TYPE_SSIZE_T
 
@@ -249,7 +278,9 @@
   AC_CHECK_TYPE(major_t, unsigned int)
   AC_CHECK_TYPE(minor_t, unsigned int)
 
+  AC_REQUIRE([gl_AC_TYPE_UINT32_T])
   AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
+  AC_REQUIRE([gl_AC_TYPE_UINTPTR_T])
   AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG])
 
   AC_REQUIRE([AC_HEADER_MAJOR])
Index: m4/ls-mntd-fs.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ls-mntd-fs.m4,v
retrieving revision 1.27
diff -u -r1.27 ls-mntd-fs.m4
--- m4/ls-mntd-fs.m4    18 Apr 2004 18:12:50 -0000      1.27
+++ m4/ls-mntd-fs.m4    7 Aug 2004 00:09:12 -0000
@@ -1,13 +1,31 @@
-#serial 15
+#serial 17
+# How to list mounted file systems.
+
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 dnl From Jim Meyering.
 dnl
 dnl This is not pretty.  I've just taken the autoconf code and wrapped
-dnl it in an AC_DEFUN.
+dnl it in an AC_DEFUN and made some other fixes.
 dnl
 
-# gl_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-AC_DEFUN([gl_LIST_MOUNTED_FILESYSTEMS],
+# gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS],
   [
 AC_CHECK_FUNCS(listmntent getmntinfo)
 AC_CHECK_HEADERS_ONCE(sys/param.h)
@@ -16,7 +34,13 @@
 # NGROUPS (as the array dimension for a struct member) without a definition.
 AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>])
 
-AC_CHECK_HEADERS(mntent.h sys/mount.h sys/fs_types.h)
+AC_CHECK_HEADERS(sys/mount.h, [], [],
+  [AC_INCLUDES_DEFAULT
+   [#if HAVE_SYS_PARAM_H
+     #include <sys/param.h>
+    #endif]])
+
+AC_CHECK_HEADERS(mntent.h sys/fs_types.h)
     getfsstat_includes="\
 $ac_includes_default
 #if HAVE_SYS_PARAM_H
@@ -35,7 +59,7 @@
 "
 AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
 
-# Determine how to get the list of mounted filesystems.
+# Determine how to get the list of mounted file systems.
 ac_list_mounted_fs=
 
 # If the getmntent function is available but not in the standard library,
@@ -70,7 +94,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_LISTMNTENT, 1,
       [Define if there is a function named listmntent that can be used to
-       list all mounted filesystems. (UNICOS)])
+       list all mounted file systems.  (UNICOS)])
   fi
 fi
 
@@ -86,7 +110,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_VMOUNT, 1,
        [Define if there is a function named mntctl that can be used to read
-         the list of mounted filesystems, and there is a system header file
+         the list of mounted file systems, and there is a system header file
          that declares `struct vmount.'  (AIX)])
   fi
 fi
@@ -125,7 +149,7 @@
       ac_list_mounted_fs=found
       AC_DEFINE(MOUNTED_GETMNTENT1, 1,
         [Define if there is a function named getmntent for reading the list
-         of mounted filesystems, and that function takes a single argument.
+         of mounted file systems, and that function takes a single argument.
          (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
     fi
   fi
@@ -142,7 +166,7 @@
       ac_list_mounted_fs=found
       AC_DEFINE(MOUNTED_GETMNTENT2, 1,
         [Define if there is a function named getmntent for reading the list of
-         mounted filesystems, and that function takes two arguments.  (SVR4)])
+         mounted file systems, and that function takes two arguments.  (SVR4)])
     fi
   fi
 
@@ -173,7 +197,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_GETFSSTAT, 1,
              [Define if there is a function named getfsstat for reading the
-               list of mounted filesystems.  (DEC Alpha running OSF/1)])
+               list of mounted file systems.  (DEC Alpha running OSF/1)])
   fi
 fi
 
@@ -192,7 +216,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
       [Define if (like SVR2) there is no specific function for reading the
-       list of mounted filesystems, and your system has these header files:
+       list of mounted file systems, and your system has these header files:
        <sys/fstyp.h> and <sys/statfs.h>.  (SVR3)])
   fi
 fi
@@ -211,7 +235,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_GETMNTINFO, 1,
              [Define if there is a function named getmntinfo for reading the
-               list of mounted filesystems.  (4.4BSD, Darwin)])
+               list of mounted file systems.  (4.4BSD, Darwin)])
   fi
 fi
 
@@ -229,7 +253,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_GETMNT, 1,
       [Define if there is a function named getmnt for reading the list of
-       mounted filesystems.  (Ultrix)])
+       mounted file systems.  (Ultrix)])
   fi
 fi
 
@@ -250,7 +274,7 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
       [Define if there are functions named next_dev and fs_stat_dev for
-       reading the list of mounted filesystems.  (BeOS)])
+       reading the list of mounted file systems.  (BeOS)])
   fi
 fi
 
@@ -266,13 +290,13 @@
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_FREAD, 1,
              [Define if there is no specific function for reading the list of
-               mounted filesystems.  fread will be used to read /etc/mnttab.
+               mounted file systems.  fread will be used to read /etc/mnttab.
                (SVR2) ])
   fi
 fi
 
 if test -z "$ac_list_mounted_fs"; then
-  AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
+  AC_MSG_ERROR([could not determine how to read list of mounted file systems])
   # FIXME -- no need to abort building the whole package
   # Can't build mountlist.c or anything that needs its functions
 fi
Index: m4/md5.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/md5.m4,v
retrieving revision 1.3
diff -u -r1.3 md5.m4
--- m4/md5.m4   9 Sep 2003 23:33:53 -0000       1.3
+++ m4/md5.m4   7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
-# md5.m4 serial 3
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# md5.m4 serial 5
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -9,7 +9,9 @@
 AC_DEFUN([gl_MD5],
 [
   dnl Prerequisites of lib/md5.h.
-  AC_REQUIRE([AC_C_INLINE])
+  AC_REQUIRE([gl_AC_TYPE_UINT32_T])
 
-  dnl No prerequisites of lib/md5.c.
+  dnl Prerequisites of lib/md5.c.
+  AC_REQUIRE([AC_C_BIGENDIAN])
+  :
 ])
Index: m4/mountlist.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/mountlist.m4,v
retrieving revision 1.4
diff -u -r1.4 mountlist.m4
--- m4/mountlist.m4     1 Jun 2004 20:27:22 -0000       1.4
+++ m4/mountlist.m4     7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-# mountlist.m4 serial 3
+# mountlist.m4 serial 4
 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -8,18 +8,18 @@
 
 AC_DEFUN([gl_MOUNTLIST],
 [
-  gl_LIST_MOUNTED_FILESYSTEMS([gl_cv_list_mounted_fs=yes],
-                              [gl_cv_list_mounted_fs=no])
+  gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes],
+                              [gl_cv_list_mounted_fs=no])
   if test $gl_cv_list_mounted_fs = yes; then
     AC_LIBOBJ(mountlist)
     gl_PREREQ_MOUNTLIST_EXTRA
   fi
 ])
 
-# Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILESYSTEMS.
+# Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS.
 AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA],
 [
-  dnl Note gl_LIST_MOUNTED_FILESYSTEMS checks for mntent.h, not sys/mntent.h.
+  dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h.
   AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
   AC_CHECK_HEADERS(sys/mntent.h)
   gl_FSTYPENAME
Index: m4/prereq.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/prereq.m4,v
retrieving revision 1.68
diff -u -r1.68 prereq.m4
--- m4/prereq.m4        1 Jun 2004 20:27:22 -0000       1.68
+++ m4/prereq.m4        7 Aug 2004 00:09:12 -0000
@@ -1,4 +1,4 @@
-#serial 40
+#serial 44
 
 dnl We use gl_ for non Autoconf macros.
 m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
@@ -17,6 +17,7 @@
   AC_REQUIRE([gl_FUNC_MKSTEMP])
   AC_REQUIRE([gl_ALLOCSA])
   AC_REQUIRE([gl_BACKUPFILE])
+  AC_REQUIRE([gl_C_STRTOLD])
   AC_REQUIRE([gl_CANON_HOST])
   AC_REQUIRE([gl_CLOEXEC])
   AC_REQUIRE([gl_CLOSEOUT])
@@ -24,6 +25,7 @@
   AC_REQUIRE([gl_ERROR])
   AC_REQUIRE([gl_EXCLUDE])
   AC_REQUIRE([gl_EXITFAIL])
+  AC_REQUIRE([gl_FCNTL_SAFER])
   AC_REQUIRE([gl_FILEBLOCKS])
   AC_REQUIRE([gl_FILEMODE])
   AC_REQUIRE([gl_FILE_TYPE])
@@ -31,7 +33,6 @@
   AC_REQUIRE([gl_FUNC_ALLOCA])
   AC_REQUIRE([gl_FUNC_ATEXIT])
   AC_REQUIRE([gl_FUNC_DUP2])
-  AC_REQUIRE([gl_FUNC_EUIDACCESS])
   AC_REQUIRE([gl_FUNC_FNMATCH_GNU])
   AC_REQUIRE([gl_FUNC_GETHOSTNAME])
   AC_REQUIRE([AC_FUNC_GETLOADAVG])
@@ -43,6 +44,7 @@
   AC_REQUIRE([gl_FUNC_MEMRCHR])
   AC_REQUIRE([gl_FUNC_MEMSET])
   AC_REQUIRE([gl_FUNC_MKTIME])
+  AC_REQUIRE([gl_FUNC_NONREENTRANT_EUIDACCESS])
   AC_REQUIRE([gl_FUNC_READLINK])
   AC_REQUIRE([gl_FUNC_RMDIR])
   AC_REQUIRE([gl_FUNC_RPMATCH])
@@ -68,6 +70,7 @@
   AC_REQUIRE([gl_GETNDELIM2])
   AC_REQUIRE([gl_GETOPT])
   AC_REQUIRE([gl_GETPAGESIZE])
+  AC_REQUIRE([gl_GETTIME])
   AC_REQUIRE([gl_GETUGROUPS])
   AC_REQUIRE([gl_HARD_LOCALE])
   AC_REQUIRE([gl_HASH])
@@ -113,6 +116,7 @@
   AC_REQUIRE([gl_XSTRTOD])
   AC_REQUIRE([gl_XSTRTOL])
   AC_REQUIRE([gl_YESNO])
+  AC_REQUIRE([AC_FUNC_CALLOC])
   AC_REQUIRE([gl_FUNC_GLIBC_UNLOCKED_IO])
   AC_REQUIRE([gl_FUNC_GNU_STRFTIME])
   AC_REQUIRE([gl_FUNC_LSTAT])
Index: m4/sha.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/sha.m4,v
retrieving revision 1.2
diff -u -r1.2 sha.m4
--- m4/sha.m4   9 Sep 2003 23:33:53 -0000       1.2
+++ m4/sha.m4   7 Aug 2004 00:09:12 -0000
@@ -1,5 +1,5 @@
-# sha.m4 serial 2
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# sha.m4 serial 3
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
@@ -8,6 +8,7 @@
 
 AC_DEFUN([gl_SHA],
 [
-  dnl Prerequisites of lib/sha.c.
+  dnl Prerequisites of lib/sha1.c.
+  AC_REQUIRE([AC_C_BIGENDIAN])
   :
 ])
Index: modules/canonicalize
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/canonicalize,v
retrieving revision 1.1
diff -u -r1.1 canonicalize
--- modules/canonicalize        6 Aug 2004 05:08:46 -0000       1.1
+++ modules/canonicalize        7 Aug 2004 00:09:12 -0000
@@ -17,7 +17,7 @@
 AC_FUNC_CANONICALIZE_FILE_NAME
 
 Makefile.am:
-lib_SOURCES += canonicalize.h canonicalize.c
+lib_SOURCES += canonicalize.h canonicalize.c stat-macros.h
 
 Include:
 "canonicalize.h"
Index: modules/euidaccess
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/euidaccess,v
retrieving revision 1.5
diff -u -r1.5 euidaccess
--- modules/euidaccess  17 Aug 2003 14:34:12 -0000      1.5
+++ modules/euidaccess  7 Aug 2004 00:09:12 -0000
@@ -4,6 +4,7 @@
 Files:
 lib/euidaccess.h
 lib/euidaccess.c
+lib/stat-macros.h
 m4/euidaccess.m4
 
 Depends-on:
@@ -13,7 +14,7 @@
 gl_FUNC_EUIDACCESS
 
 Makefile.am:
-lib_SOURCES += euidaccess.h
+lib_SOURCES += euidaccess.h stat-macros.h
 
 Include:
 "euidaccess.h"
Index: modules/filemode
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/filemode,v
retrieving revision 1.3
diff -u -r1.3 filemode
--- modules/filemode    20 Jan 2003 10:02:37 -0000      1.3
+++ modules/filemode    7 Aug 2004 00:09:12 -0000
@@ -5,6 +5,7 @@
 Files:
 lib/filemode.h
 lib/filemode.c
+lib/stat-macros.h
 m4/filemode.m4
 
 Depends-on:
@@ -13,7 +14,7 @@
 gl_FILEMODE
 
 Makefile.am:
-lib_SOURCES += filemode.h filemode.c
+lib_SOURCES += filemode.h filemode.c stat-macros.h
 
 Include:
 "filemode.h"
Index: modules/lchown
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/lchown,v
retrieving revision 1.5
diff -u -r1.5 lchown
--- modules/lchown      18 Apr 2004 18:12:50 -0000      1.5
+++ modules/lchown      7 Aug 2004 00:09:12 -0000
@@ -4,6 +4,7 @@
 Files:
 lib/lchown.h
 lib/lchown.c
+lib/stat-macros.h
 m4/lchown.m4
 
 Depends-on:
@@ -13,7 +14,7 @@
 gl_FUNC_LCHOWN
 
 Makefile.am:
-lib_SOURCES += lchown.h
+lib_SOURCES += lchown.h stat-macros.h
 
 Include:
 "lchown.h"
Index: modules/makepath
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/makepath,v
retrieving revision 1.3
diff -u -r1.3 makepath
--- modules/makepath    20 Jan 2003 10:02:38 -0000      1.3
+++ modules/makepath    7 Aug 2004 00:09:12 -0000
@@ -4,6 +4,7 @@
 Files:
 lib/makepath.h
 lib/makepath.c
+lib/stat-macros.h
 m4/afs.m4
 m4/makepath.m4
 
@@ -20,7 +21,7 @@
 gl_MAKEPATH
 
 Makefile.am:
-lib_SOURCES += makepath.h makepath.c
+lib_SOURCES += makepath.h makepath.c stat-macros.h
 
 Include:
 "makepath.h"
Index: modules/rmdir
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/rmdir,v
retrieving revision 1.3
diff -u -r1.3 rmdir
--- modules/rmdir       20 Jan 2003 10:02:38 -0000      1.3
+++ modules/rmdir       7 Aug 2004 00:09:12 -0000
@@ -3,6 +3,7 @@
 
 Files:
 lib/rmdir.c
+lib/stat-macros.h
 m4/rmdir.m4
 
 Depends-on:
@@ -11,6 +12,7 @@
 gl_FUNC_RMDIR
 
 Makefile.am:
+lib_SOURCES += stat-macros.h
 
 Include:
 <unistd.h>
Index: modules/stat
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/stat,v
retrieving revision 1.5
diff -u -r1.5 stat
--- modules/stat        14 Jun 2004 03:50:48 -0000      1.5
+++ modules/stat        7 Aug 2004 00:09:12 -0000
@@ -3,6 +3,7 @@
 
 Files:
 lib/stat.c
+lib/stat-macros.h
 m4/stat.m4
 
 Depends-on:
@@ -12,6 +13,7 @@
 gl_FUNC_STAT
 
 Makefile.am:
+lib_SOURCES += stat-macros.h
 
 Include:
 <sys/stat.h>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]