~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/userspec.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* userspec.c -- Parse a user and group string.
2
 
   Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2011 Free Software
 
2
   Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2012 Free Software
3
3
   Foundation, Inc.
4
4
 
5
5
   This program is free software: you can redistribute it and/or modify
79
79
   - It's typically faster.
80
80
   POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
81
81
   isdigit unless it's important to use the locale's definition
82
 
   of `digit' even when the host does not conform to POSIX.  */
 
82
   of "digit" even when the host does not conform to POSIX.  */
83
83
# define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
84
84
 
85
85
/* Return true if STR represents an unsigned decimal integer.  */
145
145
 
146
146
#ifdef __DJGPP__
147
147
  /* Pretend that we are the user U whose group is G.  This makes
148
 
     pwd and grp functions ``know'' about the UID and GID of these.  */
 
148
     pwd and grp functions "know" about the UID and GID of these.  */
149
149
  if (u && !is_number (u))
150
150
    setenv ("USER", u, 1);
151
151
  if (g && !is_number (g))
232
232
   Either user or group, or both, must be present.
233
233
   If the group is omitted but the separator is given,
234
234
   use the given user's login group.
235
 
   If SPEC contains a `:', then use that as the separator, ignoring
236
 
   any `.'s.  If there is no `:', but there is a `.', then first look
 
235
   If SPEC contains a ':', then use that as the separator, ignoring
 
236
   any '.'s.  If there is no ':', but there is a '.', then first look
237
237
   up the entire SPEC as a login name.  If that look-up fails, then
238
 
   try again interpreting the `.'  as a separator.
 
238
   try again interpreting the '.'  as a separator.
239
239
 
240
240
   USERNAME and GROUPNAME will be in newly malloc'd memory.
241
241
   Either one might be NULL instead, indicating that it was not