xref: /original-bsd/lib/libc/gen/getpwent.3 (revision cfde0222)
@(#)getpwent.3 6.1 (Berkeley) 05/15/85

GETPWENT 3 ""
.AT 3
NAME
getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile - get password file entry
SYNOPSIS
 #include <pwd.h> 

struct passwd *getpwent()

struct passwd *getpwuid(uid) int uid;

struct passwd *getpwnam(name) char *name;

int setpwent()

int endpwent()

setpwfile(name) char *name;

DESCRIPTION
Getpwent, getpwuid and getpwnam each return a pointer to an object with the following structure containing the broken-out fields of a line in the password file.

The fields pw_quota and pw_comment are unused; the others have meanings described in passwd (5).

Getpwent reads the next line (opening the file if necessary); setpwent rewinds the file; endpwent closes it.

Setpwfile changes the default password file to name thus allowing alternate password files to be used. Note that it does not close the previous file. If this is desired, endpwent should be called prior to it.

Getpwuid and getpwnam search from the beginning until a matching uid or name is found (or until EOF is encountered).

FILES
/etc/passwd
"SEE ALSO"
getlogin(3), getgrent(3), passwd(5)
DIAGNOSTICS
Null pointer (0) returned on EOF or error.
BUGS
All information is contained in a static area so it must be copied if it is to be saved.