Manual Page Result
0
Command: getpwent | Section: 3 | Source: UNIX v10 | File: getpwent.3
GETPWENT(3) Library Functions Manual GETPWENT(3)
NAME
getpwent, getpwuid, getpwnam, setpwent, endpwent, pwdecode - get pass-
word 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()
struct passwd *pwdecode(p)
char *p;
DESCRIPTION
Getpwent, getpwuid and getpwnam each return a pointer to a structure
containing the broken-out fields of a line in
struct passwd {
char *pw_name; login name
char *pw_passwd; encrypted password
int pw_uid; numeric userid
int pw_gid; numeric groupid
int pw_quota; unused
char *pw_comment; unused
char *pw_gecos; field for local use
char *pw_dir; login directory
char *pw_shell; program to use as Shell
};
Getpwent reads the next line (opening the file if necessary); setpwent
rewinds the file; endpwent closes it.
Getpwuid and getpwnam search from the beginning until a matching uid or
name is found (or until end-of-file is encountered).
Pwdecode breaks out a null-terminated character string p containing a
password file entry. The input string is modified by the call and the
output structure contains pointers into it.
FILES
SEE ALSO
getlogin(3), getgrent(3), passwd(5)
DIAGNOSTICS
These routines return 0 for end of file or error.
BUGS
The return values point to static data whose content is overwritten by
each call.
GETPWENT(3)