X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/0f4556f12c8f75078501c9d1338ae7648a97f975..95f51977ddc18faa2e212f30c00a39540b39f325:/usr/man/man3/getpwent.3 diff --git a/usr/man/man3/getpwent.3 b/usr/man/man3/getpwent.3 index 04ca062b81..afd405b5cb 100644 --- a/usr/man/man3/getpwent.3 +++ b/usr/man/man3/getpwent.3 @@ -1,21 +1,27 @@ -.TH GETPWENT 3 "19 January 1983" +.\" @(#)getpwent.3 6.3 (Berkeley) 5/15/86 +.\" +.TH GETPWENT 3 "May 15, 1986" +.AT 3 .SH NAME -getpwent, getpwuid, getpwnam, setpwent, endpwent \- get password file entry +getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile \- get password file entry .SH SYNOPSIS .nf .B #include .PP -.B struct passwd *getpwent() -.PP .B struct passwd *getpwuid(uid) .B int uid; .PP .B struct passwd *getpwnam(name) .B char *name; .PP -.B int setpwent() +.B struct passwd *getpwent() +.PP +.B setpwent() .PP -.B int endpwent() +.B endpwent() +.PP +.B setpwfile(name) +.B char *name; .fi .SH DESCRIPTION .I Getpwent, @@ -42,33 +48,54 @@ and are unused; the others have meanings described in .IR passwd (5). .PP -.I Getpwent -reads the next -line (opening the file if necessary); -.I setpwent -rewinds the file; +Searching of the password file is done using the \fIndbm\fP +database access routines. +.I Setpwent +opens the database; .I endpwent closes it. -.PP .I Getpwuid and .I getpwnam -search from the beginning until a matching +search the database (opening it if necessary) for a matching .I uid or +.IR name . +EOF is returned if there is no entry. +.PP +For programs wishing to read the entire database, +.I getpwent +reads the next +line (opening the database if necessary). +In addition to opening the database, +.I setpwent +can be used to make +.I getpwent +begin its search from the beginning of the database. +.PP +.I Setpwfile +changes the default password file to .I name -is found -(or until EOF is encountered). +thus allowing alternate password files to be used. +Note that it does +.I not +close the previous file. +If this is desired, +.I endpwent +should be called prior to it. .SH FILES /etc/passwd .SH "SEE ALSO" getlogin(3), getgrent(3), passwd(5) .SH DIAGNOSTICS -Null pointer -(0) returned on EOF or error. +The routines +.IR getpwent , +.IR getpwuid , +and +.IR getpwnam , +return a null pointer (0) on EOF or error. .SH BUGS All information is contained in a static area so it must be copied if it is to be saved. -.br