Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getlogin(3)

getgrent(3)

passwd(5)

ypserv(8)

GETPWENT(3)  —  C LIBRARY FUNCTIONS

NAME

getpwent, getpwuid, getpwnam, setpwent, endpwent − get password 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()

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. 

/∗@(#)pwd.h 1.1 85/12/18 SMI; from UCB 4.1 83/05/03∗/
 structpasswd { /∗ see getpwent(3) ∗/
char∗pw_name;
char∗pw_passwd;
intpw_uid;
intpw_gid;
intpw_quota;
char∗pw_comment;
char∗pw_gecos;
char∗pw_dir;
char∗pw_shell;
};
 struct passwd ∗getpwent(), ∗getpwuid(), ∗getpwnam();

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. 

Getpwuid and getpwnam search from the beginning until a matching uid or name is found (or until EOF is encountered). 

FILES

/etc/passwd
/etc/yp/domainname/passwd.byname
/etc/yp/domainname/passwd.byuid

SEE ALSO

getlogin(3), getgrent(3), passwd(5), ypserv(8)

DIAGNOSTICS

Null pointer (0) returned on EOF or error. 

BUGS

The return value points to static information which is overwritten on each call. 

Sun Release 3.0β  —  Last change: 28 February 1985

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