From cb052e4f6cc723bc408f32963e921705f3286c94 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 9 Jul 2006 16:59:05 +0000 Subject: Update from gnulib. --- lib/ChangeLog | 83 +++++++++++++++++++++++++++ lib/Makefile.in | 157 +++++++++++++++++++++++++++++++++------------------ lib/backupfile.c | 29 ++-------- lib/dirfd.h | 16 ++---- lib/exclude.c | 16 +----- lib/exit.h | 2 +- lib/fnmatch.c | 34 +---------- lib/fnmatch_loop.c | 24 ++++---- lib/fts.c | 25 +++----- lib/getaddrinfo.c | 21 ++++--- lib/getaddrinfo.h | 8 +++ lib/getcwd.c | 16 +----- lib/getdate.y | 26 +++------ lib/getloadavg.c | 20 +++---- lib/getopt.c | 2 +- lib/getpagesize.h | 4 +- lib/getusershell.c | 16 ++---- lib/mbswidth.c | 16 +----- lib/memcasecmp.c | 25 +++----- lib/posixtm.c | 6 +- lib/regex_internal.h | 2 +- lib/savedir.c | 10 +--- lib/sig2str.c | 6 +- lib/stdint_.h | 4 +- lib/strftime.c | 15 ++--- lib/strnumcmp-in.h | 8 +-- lib/strtod.c | 16 +----- lib/strtol.c | 11 +--- lib/strverscmp.c | 6 +- lib/userspec.c | 6 +- lib/xstrtol.c | 12 +--- 31 files changed, 311 insertions(+), 331 deletions(-) (limited to 'lib') diff --git a/lib/ChangeLog b/lib/ChangeLog index d8a3495eb..2f9da0822 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,86 @@ +2006-07-08 Paul Eggert + + * Makefile.am (stdint.h): FULL_PATH_STDINT_H -> ABSOLUTE_STDINT_H, + to accommodate update from gnulib. + + Update from gnulib, as follows: + + 2006-07-06 Jim Hyslop (tiny change) + + * lib/getaddrinfo.c: Changes to compile under MSVC6: changed + '#if WIN32_NATIVE' to '#ifdef' & moved WSAAPI macro inside + brackets. Other minor changes to suppress some compiler + warnings. + + 2006-07-06 Paul Eggert + + * getloadavg.c: Use __VMS, not VMS. + * getopt.c: Likewise. + * getpagesize.h: Likewise. + + 2006-07-06 Derek R. Price + and Paul Eggert + + * backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]: + Don't worry about this obsolete case any more. + (HAVE_DIR): Remove. All uses removed; we now assume you can read + directories. + * dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't + worry about this obsolete case any more. + * fts.c: Likewise. + * getcwd.c: Likewise. + * savedir.c: Likewise. + + 2006-07-06 Paul Eggert + + * fnmatch.c (ISBLANK): Remove. All uses changed to isblank. + (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro. + (ISGRAPH): Remove. All uses changed to isgraph. + (FOLD) [!defined _LIBC]: Remove special case. + * getdate.y (lookup_word): Remove no-longer-needed call to islower. + * regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not + HAVE_ISBLANK. + * strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special case. + + 2006-07-06 Ralf Wildenhues + + * strtod.c (strtod): cast the argument of tolower to unsigned char. + + 2006-07-05 Paul Eggert + + * memcasecmp.c: Include . + (memcasecmp): Don't assume UCHAR_MAX <= INT_MAX. + * strtod.c (strtod): Don't assume isspace works on negative chars. + Don't assume isdigit succeeds only on '0' through '9'. + + 2006-07-05 Derek R. Price + + * exclude.c (IN_CTYPE_DOMAIN, is_space): Remove; no longer needed. + All uses of is_space replaced by isspace. + * exit.h: Don't talk about STDC_HEADERS. + * fnmatch.c (ISASCII): Remove; no longer needed. All uses removed. + (ISPRINT, ISDIGIT, ISALNUM, ISALPHA, ISCNTRL, ISLOWER, ISPUNCT): + (ISSPACE, ISUPPER, ISXDIGIT): Remove; no longer needed. All uses + replaced by isprint etc. + * getdate.y (IN_CTYPE_DOMAIN, ISSPACE, ISALPHA, ISLOWER): Likewise. + * getusershell.c (IN_CTYPE_DOMAIN, ISSPACE): Likewise. + * memcasecmp.c (IN_CTYPE_DOMAIN, ISLOWER, TOUPPER): Likewise. + * strtod.c (IN_CTYPE_DOMAIN, ISSPACE, ISDIGIT, TOLOWER): Likewise. + * strtol.c (IN_CTYPE_DOMAIN): Likewise. + * xstrtol.c (IN_CTYPE_DOMAIN, ISSPACE): Likewise. + + 2006-07-05 Eric Blake + + * getaddrinfo.h (NI_NUMERICHOST, NI_NUMERICSERV): Define if + missing from netdb.h. + * getaddrinfo.c (includes): Include inet_ntop and snprintf. + + 2006-06-27 Bruno Haible + + Assume ANSI C header files and functions. + * mbswidth.c (IN_CTYPE_DOMAIN, ISPRINT, ISCNTRL): Remove macros. + (mbsnwidth): Use isprint, iscntrl instead. + 2006-07-08 Jim Meyering * getndelim2.h (getndelim2): Remove doubled "after" in comment. diff --git a/lib/Makefile.in b/lib/Makefile.in index 995182bde..030415dc8 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -82,24 +82,25 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ rmdir.c root-dev-ino.c root-dev-ino.h rpmatch.c safe-read.c \ safe-read.h safe-write.c safe-write.h same-inode.h same.c \ same.h save-cwd.c save-cwd.h savedir.c savedir.h setenv.c \ - setenv.h settime.c sha1.c sha1.h sha256.c sha256.h sha512.c \ - sha512.h sig2str.c sig2str.h stat-macros.h stat-time.h \ - stdio--.h stdio-safer.h stdlib--.h stdlib-safer.h stpcpy.c \ - strcasecmp.c strcspn.c strdup.c strdup.h strftime.c strftime.h \ - strintcmp.c stripslash.c strncasecmp.c strndup.c strndup.h \ - strnlen.c strnlen.h strnumcmp-in.h strnumcmp.c strnumcmp.h \ - strpbrk.c strstr.c strtod.c strtoimax.c strtol.c strtoll.c \ - strtoul.c strtoull.c strtoumax.c strverscmp.c strverscmp.h \ - tempname.c time_r.c time_r.h timespec.h umaxtostr.c unistd--.h \ + settime.c sha1.c sha1.h sha256.c sha256.h sha512.c sha512.h \ + sig2str.c sig2str.h stat-macros.h stat-time.h stdio--.h \ + stdio-safer.h stdlib--.h stdlib-safer.h stpcpy.c strcasecmp.c \ + strcspn.c strdup.c strdup.h strftime.c strftime.h strintcmp.c \ + stripslash.c strncasecmp.c strndup.c strndup.h strnlen.c \ + strnlen.h strnumcmp-in.h strnumcmp.c strnumcmp.h strpbrk.c \ + strstr.c strtod.c strtoimax.c strtol.c strtoll.c strtoul.c \ + strtoull.c strtoumax.c strverscmp.c strverscmp.h tempname.c \ + time_r.c time_r.h timespec.h umaxtostr.c unistd--.h \ unistd-safer.h unlinkdir.c unlinkdir.h unlocked-io.h \ unsetenv.c userspec.c userspec.h utime.c utimecmp.c utimecmp.h \ utimens.c utimens.h vasnprintf.c vasprintf.c version-etc-fsf.c \ version-etc.c version-etc.h xalloc.h xfts.c xfts.h xgetcwd.c \ xgetcwd.h xmalloc.c xnanosleep.c xnanosleep.h xreadlink.c \ - xreadlink.h xstrtod.c xstrtod.h xstrtol.c xstrtol.h xstrtoul.c \ - xtime.h yesno.c yesno.h + xreadlink.h xstrtod.c xstrtod.h xstrtol.c xstrtol.h xstrtold.c \ + xstrtoul.c xtime.h yesno.c yesno.h ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ + $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \ $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ $(top_srcdir)/m4/argmatch.m4 $(top_srcdir)/m4/assert.m4 \ $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/autobuild.m4 \ @@ -129,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \ $(top_srcdir)/m4/fstypename.m4 $(top_srcdir)/m4/fsusage.m4 \ $(top_srcdir)/m4/ftruncate.m4 $(top_srcdir)/m4/fts.m4 \ $(top_srcdir)/m4/getaddrinfo.m4 \ + $(top_srcdir)/m4/getcwd-abort-bug.m4 \ $(top_srcdir)/m4/getcwd-path-max.m4 $(top_srcdir)/m4/getcwd.m4 \ $(top_srcdir)/m4/getdate.m4 $(top_srcdir)/m4/getdelim.m4 \ $(top_srcdir)/m4/getgroups.m4 $(top_srcdir)/m4/gethostname.m4 \ @@ -146,12 +148,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \ $(top_srcdir)/m4/idcache.m4 $(top_srcdir)/m4/intmax_t.m4 \ $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/jm-macros.m4 $(top_srcdir)/m4/jm-winsz1.m4 \ - $(top_srcdir)/m4/jm-winsz2.m4 $(top_srcdir)/m4/lchmod.m4 \ - $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/lib-check.m4 \ - $(top_srcdir)/m4/lib-ignore.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/linebuffer.m4 $(top_srcdir)/m4/link-follow.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/jm-macros.m4 \ + $(top_srcdir)/m4/jm-winsz1.m4 $(top_srcdir)/m4/jm-winsz2.m4 \ + $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/lchown.m4 \ + $(top_srcdir)/m4/lib-check.m4 $(top_srcdir)/m4/lib-ignore.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/linebuffer.m4 \ + $(top_srcdir)/m4/link-follow.m4 \ $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/long-options.m4 \ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ @@ -168,29 +171,29 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \ $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/modechange.m4 \ $(top_srcdir)/m4/mountlist.m4 $(top_srcdir)/m4/nanosleep.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/obstack.m4 \ - $(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/openat.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perl.m4 \ - $(top_srcdir)/m4/physmem.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/posixtm.m4 $(top_srcdir)/m4/posixver.m4 \ - $(top_srcdir)/m4/prereq.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/putenv.m4 $(top_srcdir)/m4/quote.m4 \ - $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/readlink.m4 \ - $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rename.m4 \ - $(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/rmdir-errno.m4 \ - $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/root-dev-ino.m4 \ - $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \ - $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \ - $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \ - $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/settime.m4 \ - $(top_srcdir)/m4/sha1.m4 $(top_srcdir)/m4/sha256.m4 \ - $(top_srcdir)/m4/sha512.m4 $(top_srcdir)/m4/sig2str.m4 \ - $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/socklen.m4 \ - $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ - $(top_srcdir)/m4/st_dm_mode.m4 $(top_srcdir)/m4/stat-macros.m4 \ - $(top_srcdir)/m4/stat-prog.m4 $(top_srcdir)/m4/stat-time.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/openat.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/physmem.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posixtm.m4 \ + $(top_srcdir)/m4/posixver.m4 $(top_srcdir)/m4/prereq.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/putenv.m4 \ + $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ + $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readtokens.m4 \ + $(top_srcdir)/m4/readutmp.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/restrict.m4 \ + $(top_srcdir)/m4/rmdir-errno.m4 $(top_srcdir)/m4/rmdir.m4 \ + $(top_srcdir)/m4/root-dev-ino.m4 $(top_srcdir)/m4/rpmatch.m4 \ + $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \ + $(top_srcdir)/m4/same.m4 $(top_srcdir)/m4/save-cwd.m4 \ + $(top_srcdir)/m4/savedir.m4 $(top_srcdir)/m4/setenv.m4 \ + $(top_srcdir)/m4/settime.m4 $(top_srcdir)/m4/sha1.m4 \ + $(top_srcdir)/m4/sha256.m4 $(top_srcdir)/m4/sha512.m4 \ + $(top_srcdir)/m4/sig2str.m4 $(top_srcdir)/m4/signed.m4 \ + $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \ + $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ + $(top_srcdir)/m4/stat-macros.m4 $(top_srcdir)/m4/stat-prog.m4 \ + $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ $(top_srcdir)/m4/strcase.m4 $(top_srcdir)/m4/strcspn.m4 \ $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \ @@ -214,13 +217,13 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \ $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \ $(top_srcdir)/m4/utimes.m4 $(top_srcdir)/m4/vasnprintf.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/version-etc.m4 \ - $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ - $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xfts.m4 \ - $(top_srcdir)/m4/xgetcwd.m4 $(top_srcdir)/m4/xnanosleep.m4 \ - $(top_srcdir)/m4/xreadlink.m4 $(top_srcdir)/m4/xstrtod.m4 \ - $(top_srcdir)/m4/xstrtoimax.m4 $(top_srcdir)/m4/xstrtol.m4 \ - $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/m4/yesno.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcwidth.m4 \ + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ + $(top_srcdir)/m4/xfts.m4 $(top_srcdir)/m4/xgetcwd.m4 \ + $(top_srcdir)/m4/xnanosleep.m4 $(top_srcdir)/m4/xreadlink.m4 \ + $(top_srcdir)/m4/xstrtod.m4 $(top_srcdir)/m4/xstrtoimax.m4 \ + $(top_srcdir)/m4/xstrtol.m4 $(top_srcdir)/m4/xstrtoumax.m4 \ + $(top_srcdir)/m4/yesno.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs @@ -260,6 +263,7 @@ DIST_SOURCES = $(libcoreutils_a_SOURCES) t-fpending.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -270,6 +274,11 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -293,8 +302,16 @@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ GNU_PACKAGE = @GNU_PACKAGE@ GREP = @GREP@ -HAVE_LONG_64BIT = @HAVE_LONG_64BIT@ -HAVE_LONG_LONG_64BIT = @HAVE_LONG_LONG_64BIT@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE__BOOL = @HAVE__BOOL@ HELP2MAN = @HELP2MAN@ INSTALL_DATA = @INSTALL_DATA@ @@ -338,10 +355,13 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ POSUB = @POSUB@ POW_LIB = @POW_LIB@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ SEQ_LIBM = @SEQ_LIBM@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ STDBOOL_H = @STDBOOL_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ @@ -349,6 +369,8 @@ SYS_SOCKET_H = @SYS_SOCKET_H@ U = @U@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ XGETTEXT = @XGETTEXT@ YACC = @YACC@ YFLAGS = @YFLAGS@ @@ -403,11 +425,12 @@ libcoreutils_a_SOURCES = allocsa.c allocsa.h base64.c base64.h \ buffer-lcm.c buffer-lcm.h euidaccess.h exit.h full-read.c \ full-read.h full-write.c full-write.h getaddrinfo.h gettext.h \ localcharset.c localcharset.h mbchar.h mbswidth.c mbswidth.h \ - mbuiter.h readtokens0.c readtokens0.h strcase.h strnlen1.c \ - strnlen1.h strstr.h unicodeio.c unicodeio.h verify.h \ - xalloc-die.c xgethostname.c xgethostname.h xmemcoll.c \ - xmemcoll.h xstrndup.c xstrndup.h xstrtoimax.c xstrtoumax.c \ - printf-args.h printf-parse.h vasprintf.h vasnprintf.h + mbuiter.h readtokens0.c readtokens0.h setenv.h strcase.h \ + strnlen1.c strnlen1.h strstr.h unicodeio.c unicodeio.h \ + verify.h wcwidth.h xalloc-die.c xgethostname.c xgethostname.h \ + xmemcoll.c xmemcoll.h xstrndup.c xstrndup.h xstrtoimax.c \ + xstrtoumax.c printf-args.h printf-parse.h vasprintf.h \ + vasnprintf.h libcoreutils_a_LIBADD = $(LIBOBJS) $(ALLOCA) lib_OBJECTS = $(libcoreutils_a_OBJECTS) BUILT_SOURCES = getdate.c $(STDBOOL_H) $(STDINT_H) $(ALLOCA_H) \ @@ -655,6 +678,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xreadlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xstrtod.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xstrtol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xstrtold.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xstrtoul.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/yesno.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocsa.Po@am__quote@ @@ -931,7 +955,28 @@ stdbool.h: stdbool_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdint.h: stdint_.h - sed -e 's/@''HAVE_LONG_64BIT''@/$(HAVE_LONG_64BIT)/g;s/@''HAVE_LONG_LONG_64BIT@/$(HAVE_LONG_LONG_64BIT)/g' < $(srcdir)/stdint_.h > $@-t + sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + < $(srcdir)/stdint_.h > $@-t mv $@-t $@ # We need the following in order to create an when the system diff --git a/lib/backupfile.c b/lib/backupfile.c index a990addec..13c471583 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -47,21 +47,7 @@ #else # define dirent direct # define NLENGTH(direct) ((size_t) (direct)->d_namlen) -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif -#endif - -#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H -# define HAVE_DIR 1 -#else -# define HAVE_DIR 0 +# include #endif #if D_INO_IN_DIRENT @@ -95,11 +81,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + ISDIGIT 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 int) (c) - '0' <= 9) @@ -166,8 +152,6 @@ check_extension (char *file, size_t filelen, char e) } } -#if HAVE_DIR - /* Returned values for NUMBERED_BACKUP. */ enum numbered_backup_result @@ -282,7 +266,6 @@ numbered_backup (char **buffer, size_t buffer_size, size_t filelen) *buffer = buf; return result; } -#endif /* HAVE_DIR */ /* Return the name of the new backup file for the existing file FILE, allocated with malloc. Report an error and fail if out of memory. @@ -301,14 +284,13 @@ find_backup_file_name (char const *file, enum backup_type backup_type) size_t simple_backup_suffix_size = strlen (simple_backup_suffix) + 1; size_t backup_suffix_size_guess = simple_backup_suffix_size; enum { GUESS = sizeof ".~12345~" }; - if (HAVE_DIR && backup_suffix_size_guess < GUESS) + if (backup_suffix_size_guess < GUESS) backup_suffix_size_guess = GUESS; ssize = filelen + backup_suffix_size_guess + 1; s = xmalloc (ssize); memcpy (s, file, filelen + 1); -#if HAVE_DIR if (backup_type != simple_backups) switch (numbered_backup (&s, ssize, filelen)) { @@ -323,7 +305,6 @@ find_backup_file_name (char const *file, enum backup_type backup_type) simple = (backup_type == numbered_existing_backups); break; } -#endif if (simple) memcpy (s + filelen, simple_backup_suffix, simple_backup_suffix_size); diff --git a/lib/dirfd.h b/lib/dirfd.h index 1223b51d2..601332c8b 100644 --- a/lib/dirfd.h +++ b/lib/dirfd.h @@ -1,5 +1,5 @@ /* Declare dirfd, if necessary. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2006 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,18 +21,10 @@ #if HAVE_DIRENT_H # include -#else /* not HAVE_DIRENT_H */ +#else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ -# if HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ -# if HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include +#endif #ifndef HAVE_DECL_DIRFD "this configure-time declaration test was not run" diff --git a/lib/exclude.c b/lib/exclude.c index 6bd7339f4..f5978a966 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -43,18 +43,6 @@ # include "unlocked-io.h" #endif -#if STDC_HEADERS || (! defined isascii && ! HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(c) true -#else -# define IN_CTYPE_DOMAIN(c) isascii (c) -#endif - -static inline bool -is_space (unsigned char c) -{ - return IN_CTYPE_DOMAIN (c) && isspace (c); -} - /* Non-GNU systems lack these options, so we don't need to check them. */ #ifndef FNM_CASEFOLD # define FNM_CASEFOLD 0 @@ -244,12 +232,12 @@ add_exclude_file (void (*add_func) (struct exclude *, char const *, int), { char *pattern_end = p; - if (is_space (line_end)) + if (isspace ((unsigned char) line_end)) { for (; ; pattern_end--) if (pattern_end == pattern) goto next_pattern; - else if (! is_space (pattern_end[-1])) + else if (! isspace ((unsigned char) pattern_end[-1])) break; } diff --git a/lib/exit.h b/lib/exit.h index 9dbfb7ce8..e8f773883 100644 --- a/lib/exit.h +++ b/lib/exit.h @@ -21,7 +21,7 @@ /* Get exit() declaration. */ #include -/* Some systems do not define EXIT_*, even with STDC_HEADERS. */ +/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 #endif diff --git a/lib/fnmatch.c b/lib/fnmatch.c index c5a4e4071..bd4135885 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -86,34 +86,10 @@ extern int fnmatch (const char *pattern, const char *string, int flags); #if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU -# if defined STDC_HEADERS || !defined isascii -# define ISASCII(c) 1 -# else -# define ISASCII(c) isascii(c) -# endif - -# ifdef isblank -# define ISBLANK(c) (ISASCII (c) && isblank (c)) -# else -# define ISBLANK(c) ((c) == ' ' || (c) == '\t') -# endif -# ifdef isgraph -# define ISGRAPH(c) (ISASCII (c) && isgraph (c)) -# else -# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) +# if ! (defined isblank || HAVE_DECL_ISBLANK) +# define isblank(c) ((c) == ' ' || (c) == '\t') # endif -# define ISPRINT(c) (ISASCII (c) && isprint (c)) -# define ISDIGIT(c) (ISASCII (c) && isdigit (c)) -# define ISALNUM(c) (ISASCII (c) && isalnum (c)) -# define ISALPHA(c) (ISASCII (c) && isalpha (c)) -# define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) -# define ISLOWER(c) (ISASCII (c) && islower (c)) -# define ISPUNCT(c) (ISASCII (c) && ispunct (c)) -# define ISSPACE(c) (ISASCII (c) && isspace (c)) -# define ISUPPER(c) (ISASCII (c) && isupper (c)) -# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) - # define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) # if defined _LIBC || WIDE_CHAR_SUPPORT @@ -169,11 +145,7 @@ static int posixly_correct; # endif /* Note that this evaluates C many times. */ -# ifdef _LIBC -# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c)) -# else -# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c)) -# endif +# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c)) # define CHAR char # define UCHAR unsigned char # define INT int diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index 2b5897c44..308d311f9 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -288,18 +288,18 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, goto matched; # endif #else - if ((STREQ (str, L_("alnum")) && ISALNUM ((UCHAR) *n)) - || (STREQ (str, L_("alpha")) && ISALPHA ((UCHAR) *n)) - || (STREQ (str, L_("blank")) && ISBLANK ((UCHAR) *n)) - || (STREQ (str, L_("cntrl")) && ISCNTRL ((UCHAR) *n)) - || (STREQ (str, L_("digit")) && ISDIGIT ((UCHAR) *n)) - || (STREQ (str, L_("graph")) && ISGRAPH ((UCHAR) *n)) - || (STREQ (str, L_("lower")) && ISLOWER ((UCHAR) *n)) - || (STREQ (str, L_("print")) && ISPRINT ((UCHAR) *n)) - || (STREQ (str, L_("punct")) && ISPUNCT ((UCHAR) *n)) - || (STREQ (str, L_("space")) && ISSPACE ((UCHAR) *n)) - || (STREQ (str, L_("upper")) && ISUPPER ((UCHAR) *n)) - || (STREQ (str, L_("xdigit")) && ISXDIGIT ((UCHAR) *n))) + if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n)) + || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n)) + || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n)) + || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n)) + || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n)) + || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n)) + || (STREQ (str, L_("lower")) && islower ((UCHAR) *n)) + || (STREQ (str, L_("print")) && isprint ((UCHAR) *n)) + || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n)) + || (STREQ (str, L_("space")) && isspace ((UCHAR) *n)) + || (STREQ (str, L_("upper")) && isupper ((UCHAR) *n)) + || (STREQ (str, L_("xdigit")) && isxdigit ((UCHAR) *n))) goto matched; #endif c = *p++; diff --git a/lib/fts.c b/lib/fts.c index 5ea139700..3b577a867 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -78,26 +78,17 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; # include "unistd--.h" #endif -#if defined _LIBC +#if HAVE_DIRENT_H || _LIBC # include -# define NAMLEN(dirent) _D_EXACT_NAMLEN (dirent) -#else -# if HAVE_DIRENT_H -# include -# define NAMLEN(dirent) strlen ((dirent)->d_name) +# ifdef _D_EXACT_NAMLEN +# define NAMLEN(dirent) _D_EXACT_NAMLEN (dirent) # else -# define dirent direct -# define NAMLEN(dirent) (dirent)->d_namlen -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +# define NAMLEN(dirent) strlen ((dirent)->d_name) # endif +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# include #endif #ifdef _LIBC diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c index 2cba44387..e6bad1103 100644 --- a/lib/getaddrinfo.c +++ b/lib/getaddrinfo.c @@ -38,6 +38,8 @@ #define _(String) gettext (String) #define N_(String) String +#include "inet_ntop.h" +#include "snprintf.h" #include "strdup.h" #if defined _WIN32 || defined __WIN32__ @@ -45,11 +47,11 @@ #endif #ifdef WIN32_NATIVE -typedef int WSAAPI (*getaddrinfo_func) (const char*, const char*, +typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*, const struct addrinfo*, struct addrinfo**); -typedef void WSAAPI (*freeaddrinfo_func) (struct addrinfo*); -typedef int WSAAPI (*getnameinfo_func) (const struct sockaddr*, +typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*); +typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*, socklen_t, char*, DWORD, char*, DWORD, int); @@ -72,9 +74,9 @@ use_win32_p (void) if (h) { - getaddrinfo_ptr = GetProcAddress (h, "getaddrinfo"); - freeaddrinfo_ptr = GetProcAddress (h, "freeaddrinfo"); - getnameinfo_ptr = GetProcAddress (h, "getnameinfo"); + getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo"); + freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo"); + getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo"); } /* If either is missing, something is odd. */ @@ -294,7 +296,10 @@ freeaddrinfo (struct addrinfo *ai) { #ifdef WIN32_NATIVE if (use_win32_p ()) - return freeaddrinfo_ptr (ai); + { + freeaddrinfo_ptr (ai); + return; + } #endif while (ai) @@ -314,7 +319,7 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, char *restrict service, socklen_t servicelen, int flags) { -#if WIN32_NATIVE +#ifdef WIN32_NATIVE if (use_win32_p ()) return getnameinfo_ptr (sa, salen, node, nodelen, service, servicelen, flags); diff --git a/lib/getaddrinfo.h b/lib/getaddrinfo.h index bbf71f22e..d87485ef8 100644 --- a/lib/getaddrinfo.h +++ b/lib/getaddrinfo.h @@ -142,4 +142,12 @@ extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, # endif +/* Possible flags for getnameinfo. */ +# ifndef NI_NUMERICHOST +# define NI_NUMERICHOST 1 +# endif +# ifndef NI_NUMERICSERV +# define NI_NUMERICSERV 2 +# endif + #endif /* GETADDRINFO_H */ diff --git a/lib/getcwd.c b/lib/getcwd.c index ba226799d..a67dc0c07 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -38,23 +38,13 @@ #if HAVE_DIRENT_H || _LIBC # include -# ifndef _D_EXACT_NAMLEN -# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) -# endif #else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +# define _D_EXACT_NAMLEN(d) (d)->d_namlen +# include #endif #ifndef _D_EXACT_NAMLEN -# define _D_EXACT_NAMLEN(d) ((d)->d_namlen) +# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) #endif #ifndef _D_ALLOC_NAMLEN # define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) diff --git a/lib/getdate.y b/lib/getdate.y index 018504825..d874d689e 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -68,19 +68,10 @@ #include "setenv.h" #include "xalloc.h" -#if STDC_HEADERS || (! defined isascii && ! HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii (c) -#endif - -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) -#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) -#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to isdigit unless it's important to use the locale's definition @@ -896,8 +887,7 @@ lookup_word (parser_control const *pc, char *word) for (p = word; *p; p++) { unsigned char ch = *p; - if (ISLOWER (ch)) - *p = toupper (ch); + *p = toupper (ch); } for (tp = meridian_table; tp->name; tp++) @@ -962,7 +952,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc) for (;;) { - while (c = *pc->input, ISSPACE (c)) + while (c = *pc->input, isspace (c)) pc->input++; if (ISDIGIT (c) || c == '-' || c == '+') @@ -973,7 +963,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc) if (c == '-' || c == '+') { sign = c == '-' ? -1 : 1; - while (c = *++pc->input, ISSPACE (c)) + while (c = *++pc->input, isspace (c)) continue; if (! ISDIGIT (c)) /* skip the '-' sign */ @@ -1077,7 +1067,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc) } } - if (ISALPHA (c)) + if (isalpha (c)) { char buff[20]; char *p = buff; @@ -1089,7 +1079,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc) *p++ = c; c = *++pc->input; } - while (ISALPHA (c) || c == '.'); + while (isalpha (c) || c == '.'); *p = '\0'; tp = lookup_word (pc, buff); @@ -1201,7 +1191,7 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) if (! tmp) return false; - while (c = *p, ISSPACE (c)) + while (c = *p, isspace (c)) p++; if (strncmp (p, "TZ=\"", 4) == 0) diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 2a5013148..687952715 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -279,7 +279,7 @@ # endif -# ifndef FSCALE +# ifndef FSCALE /* SunOS and some others define FSCALE in sys/param.h. */ @@ -358,7 +358,7 @@ # ifdef LOAD_AVE_TYPE -# ifndef VMS +# ifndef __VMS # ifndef __linux__ # ifndef NLIST_STRUCT # include @@ -385,7 +385,7 @@ # endif /* LDAV_SYMBOL */ # endif /* __linux__ */ -# else /* VMS */ +# else /* __VMS */ # ifndef eunice # include @@ -393,7 +393,7 @@ # else /* eunice */ # include # endif /* eunice */ -# endif /* VMS */ +# endif /* __VMS */ # ifndef LDAV_CVT # define LDAV_CVT(n) ((double) (n)) @@ -473,9 +473,9 @@ static bool getloadavg_initialized; /* Offset in kmem to seek to read load average, or 0 means invalid. */ static long offset; -# if !defined (VMS) && !defined (sgi) && !defined (__linux__) +# if ! defined __VMS && ! defined sgi && ! defined __linux__ static struct nlist nl[2]; -# endif /* Not VMS or sgi */ +# endif # ifdef SUNOS_5 static kvm_t *kd; @@ -813,7 +813,7 @@ getloadavg (double loadavg[], int nelem) : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale)); # endif /* OSF_ALPHA */ -# if !defined (LDAV_DONE) && defined (VMS) +# if ! defined LDAV_DONE && defined __VMS /* VMS specific code -- read from the Load Ave driver. */ LOAD_AVE_TYPE load_ave[3]; @@ -851,9 +851,9 @@ getloadavg (double loadavg[], int nelem) if (!getloadavg_initialized) return -1; -# endif /* VMS */ +# endif /* ! defined LDAV_DONE && defined __VMS */ -# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) && !defined (VMS) +# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS /* UNIX-specific code -- read the average from /dev/kmem. */ @@ -953,7 +953,7 @@ getloadavg (double loadavg[], int nelem) if (offset == 0 || !getloadavg_initialized) return -1; -# endif /* LOAD_AVE_TYPE and not VMS */ +# endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */ # if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */ if (nelem > 0) diff --git a/lib/getopt.c b/lib/getopt.c index 83bd6db43..f37a837bc 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -31,7 +31,7 @@ #include #include -#ifdef VMS +#ifdef __VMS # include #endif diff --git a/lib/getpagesize.h b/lib/getpagesize.h index 5cce3c908..b09b2c24b 100644 --- a/lib/getpagesize.h +++ b/lib/getpagesize.h @@ -21,12 +21,12 @@ #include #if !defined getpagesize && defined _SC_PAGESIZE -# if !(defined VMS && __VMS_VER < 70000000) +# if ! (defined __VMS && __VMS_VER < 70000000) # define getpagesize() sysconf (_SC_PAGESIZE) # endif #endif -#if !defined getpagesize && defined VMS +#if !defined getpagesize && defined __VMS # ifdef __ALPHA # define getpagesize() 8192 # else diff --git a/lib/getusershell.c b/lib/getusershell.c index ec35aa241..a75d4fd48 100644 --- a/lib/getusershell.c +++ b/lib/getusershell.c @@ -1,7 +1,7 @@ /* getusershell.c -- Return names of valid user shells. - Copyright (C) 1991, 1997, 2000, 2001, 2003, 2004, 2005 Free Software - Foundation, Inc. + Copyright (C) 1991, 1997, 2000, 2001, 2003, 2004, 2005, 2006 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 @@ -43,14 +43,6 @@ # include "unlocked-io.h" #endif -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif - -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) - static size_t readname (char **, size_t *, FILE *); #if ! defined ADDITIONAL_DEFAULT_SHELLS && defined __MSDOS__ @@ -152,14 +144,14 @@ readname (char **name, size_t *size, FILE *stream) size_t name_index = 0; /* Skip blank space. */ - while ((c = getc (stream)) != EOF && ISSPACE (c)) + while ((c = getc (stream)) != EOF && isspace (c)) /* Do nothing. */ ; for (;;) { if (*size <= name_index) *name = x2nrealloc (*name, size, sizeof **name); - if (c == EOF || ISSPACE (c)) + if (c == EOF || isspace (c)) break; (*name)[name_index++] = c; c = getc (stream); diff --git a/lib/mbswidth.c b/lib/mbswidth.c index ef8398a78..48da6639d 100644 --- a/lib/mbswidth.c +++ b/lib/mbswidth.c @@ -60,18 +60,6 @@ # endif #endif -/* Get ISPRINT. */ -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif -/* Undefine to protect against the definition in wctype.h of Solaris 2.6. */ -#undef ISPRINT -#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) -#undef ISCNTRL -#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) - /* Returns the number of columns needed to represent the multibyte character string pointed to by STRING. If a non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. @@ -195,10 +183,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags) { unsigned char c = (unsigned char) *p++; - if (ISPRINT (c)) + if (isprint (c)) width++; else if (!(flags & MBSW_REJECT_UNPRINTABLE)) - width += (ISCNTRL (c) ? 0 : 1); + width += (iscntrl (c) ? 0 : 1); else return -1; } diff --git a/lib/memcasecmp.c b/lib/memcasecmp.c index b0a492590..9aebb3e9c 100644 --- a/lib/memcasecmp.c +++ b/lib/memcasecmp.c @@ -1,5 +1,5 @@ /* Case-insensitive buffer comparator. - Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000, 2003, 2006 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,23 +21,11 @@ # include #endif -#include - -#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(Char) 1 -#else -# define IN_CTYPE_DOMAIN(Char) isascii (Char) -#endif -#define ISLOWER(Char) (IN_CTYPE_DOMAIN (Char) && islower (Char)) - -#if _LIBC || STDC_HEADERS -# define TOUPPER(Char) toupper (Char) -#else -# define TOUPPER(Char) (ISLOWER (Char) ? toupper (Char) : (Char)) -#endif - #include "memcasecmp.h" +#include +#include + /* Like memcmp, but ignore differences in case. Convert to upper case (not lower) before comparing so that join -i works with sort -f. */ @@ -52,7 +40,10 @@ memcasecmp (const void *vs1, const void *vs2, size_t n) { unsigned char u1 = s1[i]; unsigned char u2 = s2[i]; - int diff = TOUPPER (u1) - TOUPPER (u2); + int U1 = toupper (u1); + int U2 = toupper (u2); + int diff = (UCHAR_MAX <= INT_MAX ? U1 - U2 + : U1 < U2 ? -1 : U2 < U1); if (diff) return diff; } diff --git a/lib/posixtm.c b/lib/posixtm.c index 5023c3442..43161d2e0 100644 --- a/lib/posixtm.c +++ b/lib/posixtm.c @@ -44,11 +44,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit 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 int) (c) - '0' <= 9) diff --git a/lib/regex_internal.h b/lib/regex_internal.h index b2c44fe18..993c9923e 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -56,7 +56,7 @@ #endif /* In case that the system doesn't have isblank(). */ -#if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank +#if !defined _LIBC && !HAVE_DECL_ISBLANK && !defined isblank # define isblank(ch) ((ch) == ' ' || (ch) == '\t') #endif diff --git a/lib/savedir.c b/lib/savedir.c index d5ced6cd3..c68547054 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -33,15 +33,7 @@ # include #else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +# include #endif #include diff --git a/lib/sig2str.c b/lib/sig2str.c index 00089be78..bf4b7cbe8 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c @@ -247,11 +247,11 @@ static struct numname { int num; char const name[8]; } numname_table[] = #define NUMNAME_ENTRIES (sizeof numname_table / sizeof numname_table[0]) /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit 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 int) (c) - '0' <= 9) diff --git a/lib/stdint_.h b/lib/stdint_.h index 932329be8..adab4d7c2 100644 --- a/lib/stdint_.h +++ b/lib/stdint_.h @@ -43,14 +43,14 @@ Include it before , since any "#include " in would reinclude us, skipping our contents because _GL_STDINT_H is defined. */ -# include @FULL_PATH_STDINT_H@ +# include @ABSOLUTE_STDINT_H@ #endif /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). MacOS X 10.4.6 includes (which is us), but relies on the system definitions, so include - after @FULL_PATH_STDINT_H@. */ + after @ABSOLUTE_STDINT_H@. */ #if @HAVE_SYS_TYPES_H@ # include #endif diff --git a/lib/strftime.c b/lib/strftime.c index cfeac4e56..4a4ac0662 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -278,17 +278,12 @@ extern char *tzname[]; # define TOLOWER(Ch, L) towlower (Ch) # endif #else -# ifdef _LIBC -# ifdef USE_IN_EXTENDED_LOCALE_MODEL -# define TOUPPER(Ch, L) __toupper_l (Ch, L) -# define TOLOWER(Ch, L) __tolower_l (Ch, L) -# else -# define TOUPPER(Ch, L) toupper (Ch) -# define TOLOWER(Ch, L) tolower (Ch) -# endif +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define TOUPPER(Ch, L) __toupper_l (Ch, L) +# define TOLOWER(Ch, L) __tolower_l (Ch, L) # else -# define TOUPPER(Ch, L) (islower (Ch) ? toupper (Ch) : (Ch)) -# define TOLOWER(Ch, L) (isupper (Ch) ? tolower (Ch) : (Ch)) +# define TOUPPER(Ch, L) toupper (Ch) +# define TOLOWER(Ch, L) tolower (Ch) # endif #endif /* We don't use `isdigit' here since the locale dependent diff --git a/lib/strnumcmp-in.h b/lib/strnumcmp-in.h index b80623552..9b968cb30 100644 --- a/lib/strnumcmp-in.h +++ b/lib/strnumcmp-in.h @@ -1,7 +1,7 @@ /* Compare numeric strings. This is an internal include file. Copyright (C) 1988, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 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 @@ -30,11 +30,11 @@ # define NUMERIC_ZERO '0' /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit 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 int) (c) - '0' <= 9) diff --git a/lib/strtod.c b/lib/strtod.c index b8aab679e..73f01f974 100644 --- a/lib/strtod.c +++ b/lib/strtod.c @@ -22,16 +22,6 @@ #include -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif - -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) -#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) -#define TOLOWER(c) (IN_CTYPE_DOMAIN (c) ? tolower(c) : (c)) - #include #include @@ -64,7 +54,7 @@ strtod (const char *nptr, char **endptr) s = nptr; /* Eat whitespace. */ - while (ISSPACE (*s)) + while (isspace ((unsigned char) *s)) ++s; /* Get the sign. */ @@ -78,7 +68,7 @@ strtod (const char *nptr, char **endptr) exponent = 0; for (;; ++s) { - if (ISDIGIT (*s)) + if ('0' <= *s && *s <= '9') { got_digit = 1; @@ -111,7 +101,7 @@ strtod (const char *nptr, char **endptr) if (!got_digit) goto noconv; - if (TOLOWER (*s) == 'e') + if (tolower ((unsigned char) *s) == 'e') { /* Get the exponent specified after the `e' or `E'. */ int save = errno; diff --git a/lib/strtol.c b/lib/strtol.c index eda2d2699..cdcd15a31 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -208,11 +208,6 @@ # define TOUPPER(Ch) towupper (Ch) # endif #else -# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(c) 1 -# else -# define IN_CTYPE_DOMAIN(c) isascii(c) -# endif # define L_(Ch) Ch # define UCHAR_TYPE unsigned char # define STRING_TYPE char @@ -221,9 +216,9 @@ # define ISALPHA(Ch) __isalpha_l ((Ch), loc) # define TOUPPER(Ch) __toupper_l ((Ch), loc) # else -# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch)) -# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch)) -# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch)) +# define ISSPACE(Ch) isspace (Ch) +# define ISALPHA(Ch) isalpha (Ch) +# define TOUPPER(Ch) toupper (Ch) # endif #endif diff --git a/lib/strverscmp.c b/lib/strverscmp.c index 6276bca0f..5361a5cc5 100644 --- a/lib/strverscmp.c +++ b/lib/strverscmp.c @@ -37,11 +37,11 @@ /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit 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 int) (c) - '0' <= 9) diff --git a/lib/userspec.c b/lib/userspec.c index b09c8d8a1..fbdc2f9a1 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -76,11 +76,11 @@ #endif /* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. + - Its arg may be any int or unsigned int; it need not be an unsigned char + or EOF. - It's typically faster. POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - ISDIGIT_LOCALE unless it's important to use the locale's definition + isdigit 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 int) (c) - '0' <= 9) diff --git a/lib/xstrtol.c b/lib/xstrtol.c index d01db3ca9..e7fb06810 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -1,6 +1,6 @@ /* A more useful interface to strtol. - Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005 + Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -51,14 +51,6 @@ # define STRTOL_T_MAXIMUM TYPE_MAXIMUM (__strtol_t) #endif -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif - -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) - #if !HAVE_DECL_STRTOIMAX && !defined strtoimax intmax_t strtoimax (); #endif @@ -112,7 +104,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base, { const char *q = s; unsigned char ch = *q; - while (ISSPACE (ch)) + while (isspace (ch)) ch = *++q; if (ch == '-') return LONGINT_INVALID; -- cgit v1.2.3-54-g00ecf