GETPWENT(S) XENIX System V GETPWENT(S)
Name
getpwent, getpwuid, getpwnam, setpwent, endpwent - Gets
password file entry.
Syntax
#include <pwd.h>
struct passwd *getpwent ( );
struct passwd *getpwuid (uid)
int uid;
struct passwd *getpwnam (name)
char *name;
int setpwent ( );
int endpwent ( );
Description
getpwent, getpwuid and getpwnam each returns a pointer to a
structure containing the fields of an entry line in the
password file. The structure of a password entry is defined
in /usr/include/pwd.h.
The fields have meanings described in passwd(M). (The
pw_comment field is unused.)
getpwent reads the next line in the file, so successive
calls can be used to search the entire file. getpwuid and
getpwnam search from the beginning of the file until a
matching uid or name is found, or EOF is encountered.
A call to setpwent has the effect of rewinding the password
file to allow repeated searches. endpwent may be called to
close the password file when processing is complete.
Files
/etc/passwd
See Also
getlogin(S), getgrent(S), passwd(M)
Diagnostics
Null pointer (0) returned on EOF or error.
Notes
All information is contained in a static area so it must be
copied if it is to be saved.
Page 1 (printed 8/7/87)