| 1 | .TH GETPWENT 3 |
| 2 | .SH NAME |
| 3 | getpwent, getpwuid, getpwnam, setpwent, endpwent \- get password file entry |
| 4 | .SH SYNOPSIS |
| 5 | .B #include <pwd.h> |
| 6 | .PP |
| 7 | .B struct passwd *getpwent(); |
| 8 | .PP |
| 9 | .B struct passwd *getpwuid(uid) int uid; |
| 10 | .PP |
| 11 | .B struct passwd *getpwnam(name) char *name; |
| 12 | .PP |
| 13 | .B int setpwent(); |
| 14 | .PP |
| 15 | .B int endpwent(); |
| 16 | .SH DESCRIPTION |
| 17 | .I Getpwent, |
| 18 | .I getpwuid |
| 19 | and |
| 20 | .I getpwnam |
| 21 | each return a pointer to an object with the |
| 22 | following structure |
| 23 | containing the broken-out |
| 24 | fields of a line in the password file. |
| 25 | .RS |
| 26 | .PP |
| 27 | .nf |
| 28 | .so /usr/include/pwd.h |
| 29 | .ft R |
| 30 | .ad |
| 31 | .fi |
| 32 | .RE |
| 33 | .PP |
| 34 | The fields |
| 35 | .I pw_quota |
| 36 | and |
| 37 | .I pw_comment |
| 38 | are unused; the others have meanings described in |
| 39 | .IR passwd (5). |
| 40 | .PP |
| 41 | .I Getpwent |
| 42 | reads the next |
| 43 | line (opening the file if necessary); |
| 44 | .I setpwent |
| 45 | rewinds the file; |
| 46 | .I endpwent |
| 47 | closes it. |
| 48 | .PP |
| 49 | .I Getpwuid |
| 50 | and |
| 51 | .I getpwnam |
| 52 | search from the beginning until a matching |
| 53 | .I uid |
| 54 | or |
| 55 | .I name |
| 56 | is found |
| 57 | (or until EOF is encountered). |
| 58 | .SH FILES |
| 59 | /etc/passwd |
| 60 | .SH "SEE ALSO" |
| 61 | getlogin(3), getgrent(3), passwd(5) |
| 62 | .SH DIAGNOSTICS |
| 63 | Null pointer |
| 64 | (0) returned on EOF or error. |
| 65 | .SH BUGS |
| 66 | All information |
| 67 | is contained in a static area |
| 68 | so it must be copied if it is |
| 69 | to be saved. |
| 70 | .br |