GETPWWHO(3)

From James.Gosling@CMU-VLSI@CMU-10A Thu Sep 10 07:17:42 1981 Date: 10 Sep 1981 10:08:10-EDT From: James.Gosling at CMU-VLSI at CMU-10A Reply-To: James.Gosling at CMU-10A To: IngVAX.eric@Berkeley Subject: getpwwho.1 Status: R

NAME
getpwwho - get password file entry using liberal name matching.

SYNOPSIS
#include <pwd.h>
extern struct gecos *_gecos;

struct passwd *getpwwho(name)
char *name;

struct passwd *getpwambig();

DESCRIPTION
Getpwwho is much like getpwnam(3), except that it is much more liberal about the names that it will match. Name may be a full login name or it may be the unique abbreviation of a persons last name, or it may be a unique abbreviation of a persons first and last name.

The subroutine getpwambig may be used to iterate through all the matches for the name given to the last call to getpwwho. If getpwwho returns -1 then name does not uniquely determine a person, a program can then print out all the names that match by repeatedly calling getpwambig until getpwambig returns 0.

Both getpwwho and getpwambig return with _gecos pointing to a gecos structure that results from parsing the GECOS field of the passwd entry that is returned.

FILES
/etc/passwd    The password file.

SEE ALSO
getpwnam(3), parsgecos(3)

EXAMPLE
getpwwho("harry bovik");
getpwwho("bovik");
getpwwho("H Bovik");
getpwwho("hb");
    All of these match the person "Harry Q. Bovik", who has "hb" as his login name.

DIAGNOSTICS
Getpwwho return 0 if the person isn't found, -1 if the name is ambiguous. In the case that the name is ambiguous a program can iterate through all the possibilities by using getpwambig.

HISTORY

09-May-80  James Gosling (jag) at Carnegie-Mellon University
    Created.