getpwent(3) DG/UX 4.30 getpwent(3)
NAME
getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile,
fgetpwent - get password file entry
SYNOPSIS
#include <pwd.h>
struct passwd *getpwuid(uid)
int uid;
struct passwd *getpwnam(name)
char *name;
struct passwd *getpwent()
setpwent()
endpwent()
setpwfile(name)
char *name;
struct passwd *fgetpwent(f)
FILE *f;
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.
struct passwd {
char *pw_name;
char *pw_passwd;
int pw_uid;
int pw_gid;
char *pw_age;
char *pw_comment;
char *pw_gecos;
char *pw_dir;
char *pw_shell;
};
struct comment {
char *c_dept;
char *c_name;
char *c_acct;
char *c_bin;
};
The pw_comment field is not used; the others have meanings
described in passwd(5).
Licensed material--property of copyright holder(s) Page 1
getpwent(3) DG/UX 4.30 getpwent(3)
Setpwent opens the database; endpwent closes it. Getpwuid
and getpwnam search the database (opening it if necessary)
for a matching uid or name. EOF is returned if there is no
entry.
For programs wishing to read the entire database, getpwent
reads the next line (opening the database if necessary). In
addition to opening the database, setpwent can be used to
make getpwent begin its search from the beginning of the
database.
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.
Fgetpwent returns a pointer to the next passwd structure in
the stream f, which matches the format of the password file
/etc/passwd.
FILES
/etc/passwd
SEE ALSO
getlogin(3), getgrent(3), passwd(5), ypserv(8)
DIAGNOSTICS
The routines getpwent, getpwuid, and getpwnam, return a null
pointer (0) on EOF or error.
BUGS
All information is contained in a static area, so it must be
copied if it is to be saved.
STANDARDS
When using m88kbcs as the Software Development Environment
target, the functions mentioned above will be implemented on
top of the bcscat command. Because of this, some
performance degradation may be noticed in comparison to
using these routines in /lib/libc.a.
Licensed material--property of copyright holder(s) Page 2