diff options
author | Jim Meyering <jim@meyering.net> | 2004-03-03 07:57:33 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-03-03 07:57:33 +0000 |
commit | 3d8b65f73c10745c9f36f374a840d93ce0d6c21b (patch) | |
tree | 9620d0e6434c2aa88bd68bc6df7d84d96e1fc2a0 /lib | |
parent | abea7c171ba2da36be6e891ccb1d95b6e4289d1d (diff) | |
download | coreutils-3d8b65f73c10745c9f36f374a840d93ce0d6c21b.tar.xz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/userspec.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/userspec.c b/lib/userspec.c index 4ae083f47..474fb6062 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -1,5 +1,5 @@ /* userspec.c -- Parse a user and group string. - Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2003 Free Software + Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -42,7 +42,6 @@ #endif #include "userspec.h" -#include "posixver.h" #include "xalloc.h" #include "xstrtol.h" @@ -158,7 +157,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; @@ -171,17 +169,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: @@ -311,10 +306,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; } |