Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | GETPWENT |
2 | !!!GETPWENT | ||
3 | NAME | ||
4 | SYNOPSIS | ||
5 | DESCRIPTION | ||
6 | RETURN VALUE | ||
7 | ERRORS | ||
8 | FILES | ||
9 | CONFORMING TO | ||
10 | SEE ALSO | ||
11 | ---- | ||
12 | !!NAME | ||
13 | |||
14 | |||
15 | getpwent, setpwent, endpwent - get password file entry | ||
16 | !!SYNOPSIS | ||
17 | |||
18 | |||
19 | __#include | ||
20 | __ | ||
21 | !!DESCRIPTION | ||
22 | |||
23 | |||
24 | The __getpwent()__ function returns a pointer to a | ||
25 | structure containing the broken out fields of a line from | ||
26 | ''/etc/passwd''. The first time it is called it returns | ||
27 | the first entry; thereafter, it returns successive | ||
28 | entries. | ||
29 | |||
30 | |||
31 | The __setpwent()__ function rewinds the file pointer to | ||
32 | the beginning of the ''/etc/passwd'' file. | ||
33 | |||
34 | |||
35 | The __endpwent()__ function closes the ''/etc/passwd'' | ||
36 | file. | ||
37 | |||
38 | |||
39 | The ''passwd'' structure is defined in | ||
40 | '''' as follows: | ||
41 | |||
42 | |||
43 | struct passwd { | ||
44 | char *pw_name; /* user name */ | ||
45 | char *pw_passwd; /* user password */ | ||
46 | uid_t pw_uid; /* user id */ | ||
47 | gid_t pw_gid; /* group id */ | ||
48 | char *pw_gecos; /* real name */ | ||
49 | char *pw_dir; /* home directory */ | ||
50 | char *pw_shell; /* shell program */ | ||
51 | }; | ||
52 | !!RETURN VALUE | ||
53 | |||
54 | |||
55 | The __getpwent()__ function returns the ''passwd'' | ||
56 | structure, or NULL if there are no more entries or an error | ||
57 | occurs. | ||
58 | !!ERRORS | ||
59 | |||
60 | |||
61 | __ENOMEM__ | ||
62 | |||
63 | |||
64 | Insufficient memory to allocate passwd | ||
65 | structure. | ||
66 | !!FILES | ||
67 | |||
68 | |||
69 | ''/etc/passwd'' | ||
70 | |||
71 | |||
72 | password database file | ||
73 | !!CONFORMING TO | ||
74 | |||
75 | |||
76 | SVID 3, BSD 4.3 | ||
77 | !!SEE ALSO | ||
78 | |||
79 | |||
80 | fgetpwent(3), getpwnam(3), getpwuid(3), | ||
81 | getpw(3), putpwent(3), | ||
82 | passwd(5) | ||
83 | ---- |