Merge from coreutils.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 31 Mar 2004 07:47:20 +0000 (07:47 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 31 Mar 2004 07:47:20 +0000 (07:47 +0000)
ChangeLog
config/ChangeLog
lib/ChangeLog
lib/userspec.c
lib/userspec.h
m4/ChangeLog

index 24a85619399a5d5cc02c9ecd99a325d48e1314c4..cfc5ad5946ec972ea274496987c121e6d6932cc3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
 2004-03-30  Paul Eggert  <eggert@twinsun.com>
 
        * modules/inttostr: New file.
+       * modules/getdate: Depend on timespec, stdbool, gettime.
 
 2004-03-29  Paul Eggert  <eggert@twinsun.com>
 
index 8366739cb6ee976d0ced534019e887f8e0625cd6..de2e498c940a9feb545e8b53475b466c63ce3236 100644 (file)
@@ -1,4 +1,4 @@
-2004-03-09  Paul Eggert  <eggert@cs.ucla.edu>
+2004-03-09  Paul Eggert  <eggert@twinsun.com>
 
        * srclistvars.sh: Add GNUWWWLICENSES for eggert.
        * srclist.txt: Sync getopt with libc.  Add getopt_int.h.
index fc6a5ec9879154fba1db4663ee6cdc75cba5f333..1cafcdf4362080b4ec6bd3406909c33adc6499ca 100644 (file)
@@ -1,12 +1,87 @@
 2004-03-30  Paul Eggert  <eggert@twinsun.com>
 
-       * imaxtostr.c, inttostr.c, inttostr.h, offtostr.c, umaxtostr.c:
-       New files.
-
        * lib/cloexec.h, lib/cloexec.c (set_cloexec_flag): Return int
        not bool, to be more consistent with Unix conventions.
        Suggested by Bruno Haible.
 
+       Merge from coreutils.
+
+       * imaxtostr.c, inttostr.c, inttostr.h, offtostr.c, umaxtostr.c:
+       New files.
+
+       * getdate.h: Include stdbool.h, and timespec.h instead of
+       the usual <time.h> dance.
+       (get_date): Change signature to support fractional time stamps.
+       All callers changed.
+       * getdate.y: Include "getdate.h" first, as we can now
+       assume C89 and don't need to worry about 'const'.
+       Similarly, include "unlocked-io.h" near start, not in middle.
+       Include <limits.h>.
+       (textint.value): Use long int rather than int.
+       (textint.digits): Use size_t rather than int.
+       (BILLION, LOG10_BILLION): New constants.
+       (parser_control): New member rel_ns.  Members day_ordinal,
+       time_zone, month, day, hour, minutes, rel_year, rel_month,
+       rel_day, rel_hour, rel_minutes, rel_seconds
+       are now long int, not int.  Member seconds is now struct timespec,
+       not int.  New member timespec_seen.  Members dates_seen, days_seen,
+       local_zones_seen, rels_seen, times_seen, zones_seen are now size_t,
+       not int.
+       (%union.intval): Now long int, not int.
+       New member timespec.
+       (tSDECIMAL_NUMBER, tUDECIMAL_NUMBER): New tokens.
+       (seconds, signed_seconds, unsigned_seconds): New nonterminals.
+       (spec): Now is a timespec or an item list.
+       (timespec, items): New nonterminals.
+       (time, rel, relunit, number, get_date):
+       Add support for fractional seconds.
+       (time): Fix bug: seconds weren't cleared in "00:00 +0000" syntax.
+       (gmtime, localtime, mktime): Remove decls; not needed with C89.
+       (to_hour): First arg is now long int, not int.
+       (to_year): Returns long int, not int.
+       Don't treat year -70 like 70.
+       (tm_diff): Returns long int, not int.
+       (lookup_word): Use bool instead of int when appropriate.
+       (yylex): Use size_t for count, not int.
+       Detect overflow when parsing large integer constants.
+       Add support for fractions.
+       (get_date): Make pointers 'const' if possible.
+       Use more-portable code to detect integer overflow.
+       (main) [TEST]: Adjust to above changes.  Test for localtime failure.
+       Don't use ctime; it's not reliable if the year has >4 digits.
+
+       * human.c (humblock): Inspect BLOCKSIZE if BLOCK_SIZE isn't set.
+       This is for compatibility with BSD.
+
+       * timespec.h (ST_TIME_CMP_NS, ST_TIME_CMP): Define.
+       (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
+       From coreutils' system.h.
+
+       * userspec.c: Don't include "posixver.h".
+       (parse_user_spec): Fall back on USER.GROUP parsing, regardless
+       of POSIX version, as POSIX 1003.1-2001 allows that behavior as a
+       compatible extension.  Simplify code by removing a boolean int
+       that was always nonzero if a string was nonnull.
+       
+2004-03-30  Jim Meyering  <jim@meyering.net>
+
+       Merge from coreutils.
+
+       * mountlist.c [HAVE_SYS_UCRED_H]: Include grp.h before sys/ucred.h.
+
+       * readtokens.c (readtoken): Don't leak 64 bytes when reading
+       an empty input stream.
+
+       * readtokens.c: Include <stdbool.h>.
+       (readtoken): Use `size_t' rather than int/long.
+       All callers adjusted.
+       Use `bool' rather than `int' where appropriate.
+       Use memset rather than an explicit loop.
+       Use x2nrealloc rather than xrealloc.
+       Allow the use of `\0' as a delimiter.
+       (readtokens): Likewise.
+       * readtokens.h (readtoken, readtokens): Update prototypes.
+
 2004-03-30  Bruno Haible  <bruno@clisp.org>
 
        * getloadavg.c (getloadavg): Don't assume setlocale returns
index 8cf62391a310a0ef72e98a467b6d529cd91ab224..a997c6ff4b35040a9690014db07f705df39806a6 100644 (file)
 # include <config.h>
 #endif
 
-#include <alloca.h>
-
 /* Specification.  */
 #include "userspec.h"
 
+#include <alloca.h>
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <pwd.h>
@@ -45,7 +45,6 @@
 #endif
 
 #include "strdup.h"
-#include "posixver.h"
 #include "xalloc.h"
 #include "xstrtol.h"
 
@@ -157,7 +156,6 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
   struct group *grp;
   char *g, *u, *separator;
   char *groupname;
-  int maybe_retry = 0;
   char *dot = NULL;
 
   error_msg = NULL;
@@ -170,17 +168,14 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
   separator = strchr (spec, ':');
 
   /* If there is no colon, then see if there's a `.'.  */
-  if (separator == NULL && posix2_version () < 200112)
+  if (separator == NULL)
     {
       dot = strchr (spec, '.');
       /* If there's no colon but there is a `.', then first look up the
         whole spec, in case it's an OWNER name that includes a dot.
         If that fails, then we'll try again, but interpreting the `.'
-        as a separator.  */
-      /* FIXME: accepting `.' as the separator is contrary to POSIX.
-        someday we should drop support for this.  */
-      if (dot)
-       maybe_retry = 1;
+        as a separator.  This is a compatible extension to POSIX, since
+        the POSIX-required behavior is always tried first.  */
     }
 
  retry:
@@ -310,10 +305,10 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
        }
     }
 
-  if (error_msg && maybe_retry)
+  if (error_msg && dot)
     {
-      maybe_retry = 0;
       separator = dot;
+      dot = NULL;
       error_msg = NULL;
       goto retry;
     }
index 8f01d64d30eea4bbef04dc23f93c508e9334381f..8a09eaea0c912d9d80e7f92d534727c5c4c5da9b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef USERSPEC_H
 # define USERSPEC_H 1
 
-# include <stddef.h>
+# include <sys/types.h>
 
 const char *
 parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
index def865bb018a8359ba7058c9b81fd82d7ce51b4b..67311a508ddcac5ac869364be240f935efe55fd1 100644 (file)
 
 2004-03-30  Paul Eggert  <eggert@twinsun.com>
 
+       Merge from coreutils.
+       
        * inttostr.m4: New file.
+       * getdate.m4 (gl_GETDATE): Remove time-related stuff.
+       Require AM_STDBOOL_H and gl_TIMESPEC instead.
+       Require gl_CLOCK_TIME.
+       * clock_time.m4 (gl_CLOCK_TIME): Require AC_GNU_SOURCE.
+
+2004-03-30  Jim Meyering  <jim@meyering.net>
+
+       Merge from coreutils.
+
+       Avoid a configure-time warning about sys/ucred.h on OSF V4.0.
+       * ls-mntd-fs.m4: Test for sys/ucred.h separately, since
+       on some systems one must include <grp.h> before it.
+       Reported by Christian Krackowizer.
 
 2004-03-29  Paul Eggert  <eggert@twinsun.com>