01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GETPWENT ( 30 ) GETPWENT ( 30 )<br />

NAME<br />

getpwent, getpwuid, getpwnam, setpwent, endpwent - get password<br />

file entry<br />

SYNOPSIS<br />

#include <br />

struct passwd tgetpwent ( )<br />

struct passwd tgetpwuid (uid)<br />

int uid;<br />

struct passwd tgetpwnam (name)<br />

char •name;<br />

void setpwent ( )<br />

void endpwent ( )<br />

DESCRIPTION<br />

Getpwent, getpwuid and getpwnam each returns a pointer to an<br />

object with the following structure containing the broken-out<br />

fields of a line in the /etcfpasswd file. Each line in the file contains<br />

a "passwd" structure, declared in the header<br />

file:<br />

struct passwd {<br />

char •pw_name;<br />

char •pw_passwd;<br />

int pw_uid;<br />

int pw_gid;<br />

char tpw_age;<br />

char •pw_comment;<br />

char •pw_gecos;<br />

char •pw_dir;<br />

char •pw_shell;<br />

};<br />

struct comment {<br />

char •c_dept;<br />

char •c_name;<br />

char •c_acct;<br />

char •c_bin;<br />

};<br />

This structure is declared in < pwd.h > so it is not necessary to<br />

redeclare it.<br />

The pw_comment field is unused; the others have meanings<br />

described in passwd( 4).<br />

Getpwent when first called returns a pointer to the first passwd<br />

structure in the file; thereafter, it returns a pointer to the next<br />

passwd structure in the file; so successive calls can be used to<br />

search the entire file. Getpwuid searches from the beginning of<br />

the file until a numerical user ID matching uid is found and<br />

returns a pointer to the particular structure in which it was found.<br />

Getpwnam searches from the beginning of the file until a login<br />

name matching name is found, and returns a pointer to the<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!