bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] userspec merge from coreutils


From: Paul Eggert
Subject: [Bug-gnulib] userspec merge from coreutils
Date: Tue, 30 Mar 2004 23:41:39 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I installed this:

2004-03-30  Paul Eggert  <address@hidden>

        * lib/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.

Index: lib/userspec.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/userspec.c,v
retrieving revision 1.40
diff -p -u -r1.40 userspec.c
--- lib/userspec.c      25 Feb 2004 19:45:35 -0000      1.40
+++ lib/userspec.c      31 Mar 2004 07:40:15 -0000
@@ -22,11 +22,11 @@
 # 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, u
   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, u
   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, u
        }
     }
 
-  if (error_msg && maybe_retry)
+  if (error_msg && dot)
     {
-      maybe_retry = 0;
       separator = dot;
+      dot = NULL;
       error_msg = NULL;
       goto retry;
     }




reply via email to

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