Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getpwent(3) — UNIX 2.8BSD

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getlogin(3)

getgrent(3)

getmap(3)

lseek(2)

passwd(5)

GETPWENT(3)  —  UNIX Programmer’s Manual

 

NAME

getpwent, getpwuid, getpwnam, getpwmap, setpwent, endpwent − get password file entry

SYNOPSIS

#include <pwd.h>
#include <sys/types.h>
#include <pwtable.h>

struct passwd *getpwent();

struct passwd *getpwuid(uid) int uid;

struct passwd *getpwnam(name) char *name;

struct passwd *getpwmap(map) struct pwtable *map;

setpwent();

endpwent();

DESCRIPTION

Getpwent, getpwuid, getpwnam and getpwmap each return a pointer to an object with the following structure containing the broken-out fields of a line in the password file. 

The fields pw_quota and pw_comment are unused; the others have meanings described in passwd(5).

Getpwent reads the next line (opening the file if necessary); setpwent rewinds the file; endpwent closes it. 

Getpwmap uses the offset given by the password map to seek directly to the proper entry.  If the entry found has the proper uid and name then, a pointer to it will be returned. 

Getpwuid and getpwnam first try to use getpwmap to find the entry directly.  Should this fail, they search from the beginning until a matching uid or name is found (or until EOF is encountered). 

FILES

/etc/passwd

SEE ALSO

getlogin(3), getgrent(3), getmap(3), lseek(2), passwd(5)

DIAGNOSTICS

Null pointer (0) returned on EOF or error. 

BUGS

All information is contained in a static area so it must be copied if it is to be saved. 

7th Edition

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026