2.9BSD/usr/man/man3/getpwent.3

Compare this file to the similar file:
Show the results in this format:

.TH GETPWENT 3
.SH NAME
getpwent, getpwuid, getpwnam, setpwent, endpwent
\- get password file entry
.SH SYNOPSIS
.B #include <pwd.h>
.PP
.B struct passwd *getpwent();
.PP
.B struct passwd *getpwuid(uid) int uid;
.PP
.B struct passwd *getpwnam(name) char *name;
.PP
.B int setpwent();
.PP
.B int endpwent();
.SH DESCRIPTION
.I Getpwent,
.I getpwuid
and
.I getpwnam
each return a pointer to an object with the
following structure
containing the broken-out
fields of a line in the password file.
.RS
.PP
.nf
struct	passwd { /* see getpwent(3) */
	char	*pw_name;
	char	*pw_passwd;
	int	pw_uid;
	int	pw_gid;
	int	pw_quota;
	char	*pw_comment;
	char	*pw_gecos;
	char	*pw_dir;
	char	*pw_shell;
};
.ft R
.ad
.fi
.RE
.PP
The fields
.I pw\_quota
and
.I pw\_comment
are unused; the others have meanings described in
.IR passwd (5).
.PP
.I Getpwent
reads the next
line (opening the file if necessary);
.I setpwent
rewinds the file;
.I endpwent
closes it.
.PP
.I Getpwuid
and
.I getpwnam
search from the beginning until a matching
.I uid
or
.I name
is found
(or until EOF is encountered).
.SH FILES
/etc/passwd
.SH "SEE ALSO"
getgrent(3), getlogin(3), passwd(5)
.SH DIAGNOSTICS
A null pointer returned on EOF or error.
.SH BUGS
All information is contained in a static area
so it must be copied if it is to be saved.