GETPWENT(3-BSD) RISC/os Reference Manual GETPWENT(3-BSD)
NAME
getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile
- 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;
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.
#ifndef BSD43_
# include <bsd43/bsd43_.h>
#endif BSD43_
struct bsd43_(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;
};
struct bsd43_(passwd) *bsd43_(getpwent)(),
*bsd43_(getpwuid)(), *bsd43_(getpwnam)();
The fields pwquota and pwcomment are unused; the others
have meanings described in passwd(4).
Printed 11/19/92 Page 1
GETPWENT(3-BSD) RISC/os Reference Manual GETPWENT(3-BSD)
Searching of the password file is done using the ndbm data-
base access routines. setpwent opens the database; endpwent
closes it. getpwuid and getpwnam search the database (open-
ing it if necessary) for a matching uid or name. A NULL
pointer 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.
FILES
/etc/passwd
SEE ALSO
getlogin(3), getgrent(3), passwd(4).
DIAGNOSTICS
The routines getpwent, getpwuid, and getpwnam, return a NULL
pointer (0) on EOF or error.
ERRORS
All information is contained in a static area so it must be
copied if it is to be saved.
Page 2 Printed 11/19/92