Prefer "$@" to "poll.h" in rule for building poll.h.
All this is for consistency with alloca and fnmatch.
+ * modules/same: Depend on stdbool.
+
2003-12-03 Bruno Haible <bruno@clisp.org>
Upgrade from gettext-0.13.
+2004-01-15 Jim Meyering <jim@meyering.net>
+
+ Merge from coreutils.
+
+ * md5.h (rol) [__GNUC__ && __i386__]: Don't use `asm' code. These
+ days, gcc-3.x does better all by itself. Patch from Dean Gaudet:
+ http://mail.gnu.org/archive/html/bug-coreutils/2003-11/msg00144.html
+
+ * posixver.c (DEFAULT_POSIX2_VERSION): Use definition of new,
+ optional configure-time default.
+
+ * version-etc.c (version_etc_copyright): Update copyright date.
+
+ * xreadlink.c (xreadlink): Correct outdated comment.
+
+2004-01-15 Paul Eggert <eggert@twinsun.com>
+
+ Merge from coreutils.
+
+ * posixver.c: Include posixver.h.
+
+ * same.c: Include <stdbool.h>, <limits.h>.
+ (_POSIX_NAME_MAX): Define if not defined.
+ (MIN): New macro.
+ (same_name): If file names are silently truncated, report
+ that the file names are the same if they are the same after
+ the silent truncation.
+
+ * xstrtod.h (xstrtod): Accept an extra arg, specifying the
+ conversion function.
+ * xstrtod.c (xstrtod): Likewise. All callers changed to
+ include c-strtod.h and use c_strtod. Don't include stdlib.h; no
+ longer needed.
+
2004-01-14 Paul Eggert <eggert@twinsun.com>
* fnmatch_loop.c (ALLOCA_LIMIT): Remove macro, which collided
digest. */
extern void *md5_buffer (const char *buffer, size_t len, void *resblock);
-/* The following is from gnupg-1.0.2's cipher/bithelp.h. */
-/* Rotate a 32 bit integer by n bytes */
-#if defined __GNUC__ && defined __i386__
-static inline md5_uint32
-rol(md5_uint32 x, int n)
-{
- __asm__("roll %%cl,%0"
- :"=r" (x)
- :"0" (x),"c" (n));
- return x;
-}
-#else
-# define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
-#endif
+#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
#endif
/* Which POSIX version to conform to, for utilities.
- 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
# include <config.h>
#endif
+#include "posixver.h"
+
#include <limits.h>
#include <stdlib.h>
# define _POSIX2_VERSION 0
#endif
+#ifndef DEFAULT_POSIX2_VERSION
+# define DEFAULT_POSIX2_VERSION _POSIX2_VERSION
+#endif
+
/* The POSIX version that utilities should conform to. The default is
specified by the system. */
int
posix2_version (void)
{
- long int v = _POSIX2_VERSION;
+ long int v = DEFAULT_POSIX2_VERSION;
char const *s = getenv ("_POSIX2_VERSION");
if (s && *s)
# include <config.h>
#endif
+#include <stdbool.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#include <string.h>
+#include <limits.h>
+#ifndef _POSIX_NAME_MAX
+# define _POSIX_NAME_MAX 14
+#endif
+
#include "same.h"
#include "dirname.h"
#include "error.h"
#include "xalloc.h"
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
&& (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
char const *dest_basename = base_name (dest);
size_t source_baselen = base_len (source_basename);
size_t dest_baselen = base_len (dest_basename);
+ bool identical_basenames =
+ (source_baselen == dest_baselen
+ && memcmp (source_basename, dest_basename, dest_baselen) == 0);
+ bool compare_dirs = identical_basenames;
+ bool same = false;
+
+#if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
+ /* This implementation silently truncates pathname components. If
+ the base names might be truncated, check whether the truncated
+ base names are the same, while checking the directories. */
+ size_t slen_max = HAVE_LONG_FILE_NAMES ? 255 : _POSIX_NAME_MAX;
+ size_t min_baselen = MIN (source_baselen, dest_baselen);
+ if (slen_max <= min_baselen
+ && memcmp (source_basename, dest_basename, slen_max) == 0)
+ compare_dirs = true;
+#endif
- if (source_baselen == dest_baselen
- && memcmp (source_basename, dest_basename, dest_baselen) == 0)
+ if (compare_dirs)
{
struct stat source_dir_stats;
struct stat dest_dir_stats;
error (1, errno, "%s", dest_dirname);
}
+ same = SAME_INODE (source_dir_stats, dest_dir_stats);
+
+#if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX
+ if (same && ! identical_basenames)
+ {
+ long name_max = (errno = 0, pathconf (dest_dirname, _PC_NAME_MAX));
+ if (name_max < 0)
+ {
+ if (errno)
+ {
+ /* Shouldn't happen. */
+ error (1, errno, "%s", dest_dirname);
+ }
+ same = false;
+ }
+ else
+ same = (name_max <= min_baselen
+ && memcmp (source_basename, dest_basename, name_max) == 0);
+ }
+#endif
+
free (source_dirname);
free (dest_dirname);
-
- if (SAME_INODE (source_dir_stats, dest_dir_stats))
- return 1;
}
- return 0;
+ return same;
}
/* Utility to help print --version output in a consistent format.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 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
const char* version_etc_copyright =
/* Do *not* mark this string for translation. */
- "Copyright (C) 2003 Free Software Foundation, Inc.";
+ "Copyright (C) 2004 Free Software Foundation, Inc.";
/* Like version_etc, below, but with the NULL-terminated author list
# include <unistd.h>
#endif
-#include "xalloc.h"
-#include "xreadlink.h"
-
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif
+#include "xalloc.h"
+#include "xreadlink.h"
+
/* Call readlink to get the symbolic link value of FILENAME.
Return a pointer to that NUL-terminated string in malloc'd storage.
If readlink fails, return NULL (caller may use errno to diagnose).
- If realloc fails, or if the link value is longer than SIZE_MAX :-),
+ If malloc fails, or if the link value is longer than SSIZE_MAX :-),
give a diagnostic and exit. */
char *
-/* xstrtod.c - error-checking interface to strtod
+/* error-checking interface to strtod-like functions
Copyright (C) 1996, 1999, 2000, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
#include <errno.h>
#include <limits.h>
#include <stdio.h>
-#include <stdlib.h>
/* Tell the compiler that non-default rounding modes are used. */
#if 199901 <= __STDC_VERSION__
/* 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. */
+ non-zero and don't modify *RESULT upon any failure. CONVERT
+ specifies the conversion function, e.g., strtod itself. */
int
-xstrtod (char const *str, char const **ptr, double *result)
+xstrtod (char const *str, char const **ptr, double *result,
+ double (*convert) (char const *, char **))
{
double val;
char *terminator;
fail = 0;
errno = 0;
- val = strtod (str, &terminator);
+ val = convert (str, &terminator);
/* Having a non-zero terminator is an error only when PTR is NULL. */
if (terminator == str || (ptr == NULL && *terminator != '\0'))
-/* Error-checking interface to strtod.
+/* Error-checking interface to strtod-like functions.
Copyright (C) 1996, 1998, 2003 Free Software Foundation, Inc.
#ifndef XSTRTOD_H
# define XSTRTOD_H 1
-int xstrtod (const char *str, const char **ptr, double *result);
+int xstrtod (const char *str, const char **ptr, double *result,
+ double (*convert) (char const *, char **));
#endif /* not XSTRTOD_H */
+2004-01-15 Paul Eggert <eggert@twinsun.com>
+
+ Merge from coreutils.
+
+ * jm-macros.m4 (jm_CHECK_ALL_TYPES): Check for uintptr_t.
+ * posixver.m4 (gl_POSIXVER): Require gl_DEFAULT_POSIX2_VERSION.
+ (gl_DEFAULT_POSIX2_VERSION): Move
+ the documentation from 'configure' into 'config.hin',
+ so that 'configure --help' isn't burdened by it and
+ we don't have to worry about its formatting there.
+ Reword the documentation so that it's more succinct
+ and can be run together into a single paragraph.
+ * same.m4 (gl_SAME): Check for pathconf.
+
+2004-01-15 Jim Meyering <jim@meyering.net>
+
+ Merge from coreutils.
+
+ * clock_time.m4 (gl_CLOCK_TIME): Don't set LIB_CLOCK_GETTIME
+ if no library is required.
+ * jm-macros.m4: Don't require UTILS_SYS_OPEN_MAX.
+ * jm-macros.m4 (jm_MACROS): Require gl_FUNC_FREE.
+ * jm-macros.m4 (jm_MACROS): Require autoconf-2.58.
+ (AC_LANG_SOURCE): Remove definition, now that we require autoconf-2.58.
+ * jm-macros.m4 (jm_MACROS): Don't require AC_FUNC_FTW.
+ * lib-check.m4 (jm_LIB_CHECK): Do not set LIB_CRYPT to the
+ value, $ac_cv_search_crypt, if it's "none required".
+ * posixver.m4 (gl_DEFAULT_POSIX2_VERSION): New macro.
+ * prereq.m4 (jm_PREREQ): Require AC_FUNC_GETLOADAVG,
+ not gl_FUNC_GETLOADAVG.
+ * prereq.m4 (jm_PREREQ): Require gl_READTOKENS, gl_MD5, gl_MAKEPATH,
+ gl_LONG_OPTIONS, and gl_IDCACHE, gl_GETUGROUPS.
+
+2004-01-15 Alexandre Duret-Lutz <adl@gnu.org>
+
+ Merge from coreutils.
+
+ * nanosleep.m4 (jm_FUNC_NANOSLEEP): Do not set LIB_NANOSLEEP to the
+ value, $ac_cv_search_nanosleep, if it's "none required".
+
2003-12-03 Bruno Haible <bruno@clisp.org>
* gettext.m4: Upgrade from gettext-0.13.
-# clock_time.m4 serial 2
+# clock_time.m4 serial 3
dnl Copyright (C) 2002, 2003 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
# library, inducing unnecessary run-time overhead.
fetish_saved_libs=$LIBS
AC_SEARCH_LIBS(clock_gettime, [rt posix4],
- [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+ [test "$ac_cv_search_clock_gettime" = "none required" ||
+ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
AC_SUBST(LIB_CLOCK_GETTIME)
AC_CHECK_FUNCS(clock_gettime clock_settime)
LIBS=$fetish_saved_libs
-#serial 68 -*- autoconf -*-
-
-m4_undefine([AC_LANG_SOURCE(C)])
-dnl The following is identical to the definition in c.m4
-dnl from the autoconf cvs repository on 2003-03-07.
-dnl FIXME: remove this code once we upgrade to autoconf-2.58.
-
-# We can't use '#line $LINENO "configure"' here, since
-# Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09)
-# rejects $LINENO greater than 32767, and some configure scripts
-# are longer than 32767 lines.
-m4_define([AC_LANG_SOURCE(C)],
-[/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$1])
-
+#serial 70 -*- autoconf -*-
dnl Misc type-related macros for fileutils, sh-utils, textutils.
AC_DEFUN([jm_MACROS],
[
- AC_PREREQ(2.57)
+ AC_PREREQ(2.58)
GNU_PACKAGE="GNU $PACKAGE"
AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
AC_REQUIRE([UTILS_FUNC_DIRFD])
AC_REQUIRE([AC_FUNC_ACL])
- AC_REQUIRE([AC_FUNC_FTW])
AC_REQUIRE([jm_FUNC_LCHOWN])
AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
AC_REQUIRE([jm_FUNC_CHOWN])
AC_CHECK_FUNCS(setreuid setregid)
AC_FUNC_STRTOD
- AC_REQUIRE([UTILS_SYS_OPEN_MAX])
AC_REQUIRE([GL_FUNC_GETCWD_PATH_MAX])
AC_REQUIRE([GL_FUNC_READDIR])
# 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])
])
# These tests must be run before any use of AC_CHECK_TYPE,
AC_REQUIRE([AC_TYPE_SIGNAL])
AC_REQUIRE([AC_TYPE_SIZE_T])
AC_REQUIRE([AC_TYPE_UID_T])
- AC_CHECK_TYPE(ino_t, unsigned long)
+ AC_CHECK_TYPE(ino_t, unsigned long int)
+ AC_CHECK_TYPE(uintptr_t, size_t)
gt_TYPE_SSIZE_T
-#serial 5
+#serial 6
dnl Misc lib-related macros for fileutils, sh-utils, textutils.
# SCO-ODT-3.0 is reported to need -lufc for crypt.
# NetBSD needs -lcrypt for crypt.
ac_su_saved_lib="$LIBS"
- AC_SEARCH_LIBS(crypt, [ufc crypt], [LIB_CRYPT="$ac_cv_search_crypt"])
+ AC_SEARCH_LIBS(crypt, [ufc crypt],
+ [test "$ac_cv_search_crypt" = "none required" ||
+ LIB_CRYPT="$ac_cv_search_crypt"])
LIBS="$ac_su_saved_lib"
AC_SUBST(LIB_CRYPT)
])
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
- AC_SEARCH_LIBS(nanosleep, [rt posix4], [LIB_NANOSLEEP=$ac_cv_search_nanosleep])
- AC_SUBST(LIB_NANOSLEEP)
+ AC_SEARCH_LIBS([nanosleep], [rt posix4],
+ [test "$ac_cv_search_nanosleep" = "none required" ||
+ LIB_NANOSLEEP=$ac_cv_search_nanosleep])
+ AC_SUBST([LIB_NANOSLEEP])
AC_CACHE_CHECK([whether nanosleep works],
jm_cv_func_nanosleep_works,
-# posixver.m4 serial 2
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# posixver.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
dnl Public License, this file may be distributed as part of a program
AC_DEFUN([gl_POSIXVER],
[
AC_CHECK_HEADERS_ONCE(unistd.h)
+ AC_REQUIRE([gl_DEFAULT_POSIX2_VERSION])
+])
+
+# Set the default level of POSIX conformance at configure-time.
+# Build with `./configure DEFAULT_POSIX2_VERSION=199209 ...' to
+# support the older version, thus preserving portability with
+# scripts that use sort +1, tail +32, head -1, etc.
+# Note however, that this breaks tools that might run commands
+# like `sort +some-file' that conform with the newer standard.
+AC_DEFUN([gl_DEFAULT_POSIX2_VERSION],
+[
+ AC_MSG_CHECKING([for desired default level of POSIX conformance])
+ gl_default_posix2_version=none-specified
+ if test -n "$ac_cv_env_DEFAULT_POSIX2_VERSION_set"; then
+ gl_default_posix2_version=$ac_cv_env_DEFAULT_POSIX2_VERSION_value
+ AC_DEFINE_UNQUOTED(DEFAULT_POSIX2_VERSION,
+ $gl_default_posix2_version,
+ [Define the default level of POSIX conformance. The value is of
+ the form YYYYMM, specifying the year and month the standard was
+ adopted. If not defined here, it defaults to the value of
+ _POSIX2_VERSION in <unistd.h>. Define to 199209 to default to
+ POSIX 1003.2-1992, which makes standard programs like `head',
+ `tail', and `sort' accept obsolete options like `+10' and
+ `-10'. Define to 200112 to default to POSIX 1003.1-2001, which
+ makes these standard programs treat leading-`+' operands as
+ file names and require modern usages like `-n 10' instead of
+ `-10'. Whether defined here or not, the default can be
+ overridden at run time via the _POSIX2_VERSION environment
+ variable.])
+ fi
+ AC_MSG_RESULT($gl_default_posix2_version)
+ AC_ARG_VAR(
+ [DEFAULT_POSIX2_VERSION],
+ [POSIX version to default to; see 'config.hin'.])
])
-#serial 36
+#serial 37
dnl We use jm_ for non Autoconf macros.
m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
AC_REQUIRE([gl_FUNC_EUIDACCESS])
AC_REQUIRE([gl_FUNC_FNMATCH_GNU])
AC_REQUIRE([gl_FUNC_GETHOSTNAME])
- AC_REQUIRE([gl_FUNC_GETLOADAVG])
+ AC_REQUIRE([AC_FUNC_GETLOADAVG])
AC_REQUIRE([gl_FUNC_GETPASS])
AC_REQUIRE([gl_FUNC_GETUSERSHELL])
AC_REQUIRE([gl_FUNC_MEMCHR])
AC_REQUIRE([gl_GETNDELIM2])
AC_REQUIRE([gl_GETOPT])
AC_REQUIRE([gl_GETPAGESIZE])
+ AC_REQUIRE([gl_GETUGROUPS])
AC_REQUIRE([gl_HARD_LOCALE])
AC_REQUIRE([gl_HASH])
AC_REQUIRE([gl_HUMAN])
+ AC_REQUIRE([gl_IDCACHE])
+ AC_REQUIRE([gl_LONG_OPTIONS])
+ AC_REQUIRE([gl_MAKEPATH])
AC_REQUIRE([gl_MBSWIDTH])
+ AC_REQUIRE([gl_MD5])
AC_REQUIRE([gl_MEMCOLL])
AC_REQUIRE([gl_MODECHANGE])
AC_REQUIRE([gl_MOUNTLIST])
AC_REQUIRE([gl_POSIXVER])
AC_REQUIRE([gl_QUOTEARG])
AC_REQUIRE([gl_QUOTE])
+ AC_REQUIRE([gl_READTOKENS])
AC_REQUIRE([gl_READUTMP])
AC_REQUIRE([gl_REGEX])
AC_REQUIRE([gl_SAFE_READ])
[
dnl Prerequisites of lib/same.c.
AC_CHECK_HEADERS_ONCE(unistd.h)
+ AC_CHECK_FUNCS(pathconf)
])
xalloc
error
dirname
+stdbool
configure.ac:
gl_SAME