Commit Graph

50 Commits

Author SHA1 Message Date
Paul Eggert
2d0c5eefd0 Sync from gnulib. 2005-09-22 06:05:39 +00:00
Jim Meyering
410f98fc2b Assume HAVE_UNISTD_H, i.e., include <unistd.h> unconditionally. 2005-07-02 08:41:46 +00:00
Paul Eggert
4ab39ecf75 (getpwnam, getgrnam, getgrgid)
[!defined _POSIX_VERSION]: Remove decls; not needed these days.
2005-05-30 07:31:12 +00:00
Jim Meyering
116e6fb244 Update FSF postal mail address. 2005-05-14 07:58:06 +00:00
Paul Eggert
81e7c85bca Include intprops.h.
(TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove.
2005-03-09 19:24:37 +00:00
Paul Eggert
00873ce076 Rename xclone to xmemdup. Remove obsolete xalloc macros.
Remove xstrdup.c and move xstrdup implementation to xmalloc.c.
2004-10-05 06:52:09 +00:00
Paul Eggert
5e93200bbc Don't use <alloca.h>, so that we don't use alloca on
strings on unbounded length.  alloca's performance benefits aren't
that important here.
(V_STRDUP): Remove.
(parse_with_separator): New function, with most of the internals
of the old parse_user_spec.  Allow user to omit both user and group,
for compatibility with FreeBSD.
Clone only the user name, not the entire spec.
Do not set *uid, *gid unless entirely successful.
Avoid memory leak in some failing cases.
Fix regression for USER.GROUP reported by Dmitry V. Levin in
<http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
(parse_user_spec): Rewrite to use parse_with_separator.
2004-08-19 20:04:42 +00:00
Paul Eggert
8ad3011df3 Remove dependency of xalloc on error, etc. 2004-08-09 18:44:46 +00:00
Paul Eggert
a07018a24d Include <stdbool.h>, "inttostr.h".
(V_STRDUP): Don't assume the string's length fits in int.
(ISDIGIT): unsigned -> unsigned int
(is_number): Define only ifdef __DJGPP__; not needed elsewhere.
Use bool instead of int where appropriate.
Do not allow empty strings.
(parse_user_spec): Parse numbers as decimal integers, even if
they have a leading 0.  Don't assume uids and gids fit in int.
2004-07-28 23:06:11 +00:00
Jim Meyering
8c5584a151 Sync from gnulib. 2004-04-04 06:51:11 +00:00
Jim Meyering
3d8b65f73c 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-03 07:57:33 +00:00
Jim Meyering
50dc32eafe wrap long copyright line 2003-11-03 14:57:41 +00:00
Jim Meyering
ec118e6018 Include "userspec.h". 2003-10-15 14:23:25 +00:00
Jim Meyering
dce9582d2c Update from gnulib. 2003-09-13 22:01:20 +00:00
Jim Meyering
5b9ea05b6a Include "posixver.h".
(parse_user_spec): Accept `.' as a separator only in pre-POSIX-200112 mode.
2003-07-10 20:43:42 +00:00
Jim Meyering
06b486287f Update from gnulib. 2003-06-06 19:36:00 +00:00
Jim Meyering
5bd75e7682 Include gettext.h instead of <libintl.h>. 2002-11-23 15:43:13 +00:00
Jim Meyering
bc3a5c4e5f add 2002 to Copyright line 2002-01-16 22:38:04 +00:00
Jim Meyering
d298aab8a2 (ISDIGIT): Comment fix. 2002-01-16 22:36:52 +00:00
Jim Meyering
608b347584 This bug had a serious impact on chown: `chown N:M FILE' (for integer
N and M) would have treated it like `chown N:N FILE'.
(parse_user_spec): Fix typo: s/u/g/.
2000-12-16 13:28:13 +00:00
Jim Meyering
ad31d9b60c tweak a comment 2000-12-16 13:01:24 +00:00
Jim Meyering
7708d86636 (parse_user_spec): Remove debugging printf I'd added.
Argh!
2000-09-21 05:40:28 +00:00
Jim Meyering
7d5c9847aa Don't use atoi.
Include sys/param.h and limits.h.
Include xstrtol.h.
(CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
(UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
(parse_user_spec): Use xstrtoul, not atoi when converting numeric
UID, GID.  Check range.
2000-09-09 07:20:46 +00:00
Jim Meyering
cab29a570d (same_name): Invoke xalloc_die instead of printing our own message.
(parse_user_spec):
Don't translate a message until just before returning,
to avoid unnecessary translation.
2000-08-07 16:56:29 +00:00
Jim Meyering
f25e10f24d (parse_user_spec): If there is no :' but there is a .',
then first look up the entire `.'-containing string as a login name.
2000-02-27 11:13:16 +00:00
Jim Meyering
31ef40d60b <libintl.h>: Include.
(_ and N_): Define.
(parse_user_spec): Mark translatable strings.
2000-02-12 10:41:37 +00:00
Jim Meyering
66a4b0e7a3 add FIXME comments for use of atoi 2000-02-12 10:11:54 +00:00
Jim Meyering
3d9c2a6c35 (ISDIGIT): Define it.
(isdigit): Remove definition.
(is_number): Use ISDIGIT, not isdigit.
2000-02-12 10:10:40 +00:00
Jim Meyering
9497429d9b break long line 1998-12-19 17:20:03 +00:00
Jim Meyering
b80e127286 break long line 1998-12-19 17:19:13 +00:00
Jim Meyering
7d60769bea ansideclify 1998-12-07 03:12:10 +00:00
Jim Meyering
e7d6615b76 Don't declare strdup if it's defined as a macro.
Reported by Lorne Baker.
1998-05-10 16:04:39 +00:00
Jim Meyering
bfbc3ce20c Use #if, not #ifdef with HAVE_ macros 1998-03-15 11:09:10 +00:00
Jim Meyering
7f0867df00 (parse_user_spec) [__DJGPP__]: Make function know
about any arbitrary user and group by pretending to be the user
and to belong to the group specified in `spec_arg' argument.
1998-03-10 22:49:04 +00:00
Jim Meyering
0735c835a9 Change some #ifdef to #if.
Indent a cpp directive.
1997-07-06 11:57:38 +00:00
Jim Meyering
e8b07e3796 update FSF address in copyright 1996-07-15 03:36:16 +00:00
Jim Meyering
fc2e23b1ad [HAVE_ENDGRENT]: Define away endgrent.
[HAVE_ENDPWENT]: Define away endpwent.
1995-10-18 15:59:12 +00:00
Jim Meyering
c3f2e69471 (isnumber): Rename to is_number.
(parse_user_spec): Rename uses, too.
1995-08-05 03:13:16 +00:00
Jim Meyering
7ce06ceca7 (parse_user_spec): Use strchr, not index.
[!HAVE_STRING_H]: Define strchr in terms of index, not the other way around.
1995-05-13 13:25:42 +00:00
Jim Meyering
f1ce35a10c merge with 3.9h 1994-10-02 05:43:03 +00:00
Jim Meyering
a32610143c (main): Change #ifdef TESTING to TEST. 1994-07-01 15:23:47 +00:00
Jim Meyering
844a6c1a11 Include alloca directives.
Replace 3 lines with V_STRDUP equivalent.
1994-07-01 14:04:23 +00:00
Jim Meyering
9e01db73f9 Rewrite. 1994-07-01 13:58:06 +00:00
Jim Meyering
3e13a5f6dc . 1994-03-14 18:47:31 +00:00
Jim Meyering
bd25077b16 . 1994-03-14 18:41:13 +00:00
Jim Meyering
ce4dbc8513 merge with 3.9a 1993-10-26 23:39:04 +00:00
Jim Meyering
7691d2fba0 merge with 3.8.4c 1993-10-12 20:24:09 +00:00
Jim Meyering
f2080b7714 merge with 3.8.3b 1993-10-06 16:44:26 +00:00
Jim Meyering
7f7cd1d678 * system.h [rindex, incl, bcopy, bzero]: Ditto.
* userspec.c [index]: Ditto.
1993-04-05 00:53:40 +00:00
Jim Meyering
14fd34b788 Initial revision 1992-10-31 20:42:48 +00:00