]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" References consulted: | |
26 | .\" Linux libc source code | |
27 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
28 | .\" 386BSD man pages | |
29 | .\" | |
30 | .\" Modified Sat Jul 24 19:37:37 1993 by Rik Faith (faith@cs.unc.edu) | |
31 | .\" Modified Mon May 27 22:40:48 1996 by Martin Schulze (joey@linux.de) | |
32 | .\" | |
8538a62b | 33 | .TH FGETPWENT 3 2018-02-02 "GNU" "Linux Programmer's Manual" |
fea681da MK |
34 | .SH NAME |
35 | fgetpwent \- get password file entry | |
36 | .SH SYNOPSIS | |
37 | .nf | |
38 | .B #include <stdio.h> | |
39 | .B #include <sys/types.h> | |
40 | .B #include <pwd.h> | |
68e4db0a | 41 | .PP |
fea681da MK |
42 | .BI "struct passwd *fgetpwent(FILE *" stream ); |
43 | .fi | |
68e4db0a | 44 | .PP |
cc4615cc MK |
45 | .in -4n |
46 | Feature Test Macro Requirements for glibc (see | |
47 | .BR feature_test_macros (7)): | |
48 | .in | |
68e4db0a | 49 | .PP |
cc4615cc | 50 | .BR fgetpwent (): |
51c612fb MK |
51 | Since glibc 2.19: |
52 | _DEFAULT_SOURCE | |
53 | Glibc 2.19 and earlier: | |
54 | _SVID_SOURCE | |
fea681da | 55 | .SH DESCRIPTION |
60a90ecd MK |
56 | The |
57 | .BR fgetpwent () | |
58 | function returns a pointer to a structure containing | |
c13182ef MK |
59 | the broken out fields of a line in the file \fIstream\fP. |
60 | The first time it is called it returns the first entry; | |
61 | thereafter, it returns successive entries. | |
279325d8 MK |
62 | The file referred to by |
63 | .I stream | |
64 | must have the same format as | |
920aac2c | 65 | .I /etc/passwd |
279325d8 MK |
66 | (see |
67 | .BR passwd (5)). | |
fea681da MK |
68 | .PP |
69 | The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows: | |
51f5698d | 70 | .PP |
a08ea57c | 71 | .in +4n |
b8302363 | 72 | .EX |
fea681da | 73 | struct passwd { |
18701562 | 74 | char *pw_name; /* username */ |
7295b7ed MK |
75 | char *pw_passwd; /* user password */ |
76 | uid_t pw_uid; /* user ID */ | |
77 | gid_t pw_gid; /* group ID */ | |
78 | char *pw_gecos; /* real name */ | |
79 | char *pw_dir; /* home directory */ | |
80 | char *pw_shell; /* shell program */ | |
fea681da | 81 | }; |
b8302363 | 82 | .EE |
a08ea57c | 83 | .in |
47297adb | 84 | .SH RETURN VALUE |
60a90ecd MK |
85 | The |
86 | .BR fgetpwent () | |
fc7709a8 MK |
87 | function returns a pointer to a |
88 | .I passwd | |
89 | structure, or NULL if | |
fea681da | 90 | there are no more entries or an error occurs. |
26f5e1b9 MK |
91 | In the event of an error, |
92 | .I errno | |
93 | is set to indicate the cause. | |
fea681da MK |
94 | .SH ERRORS |
95 | .TP | |
96 | .B ENOMEM | |
fc7709a8 MK |
97 | Insufficient memory to allocate |
98 | .I passwd | |
99 | structure. | |
fea681da MK |
100 | .SH FILES |
101 | .TP | |
102 | .I /etc/passwd | |
103 | password database file | |
0578c69d MK |
104 | .SH ATTRIBUTES |
105 | For an explanation of the terms used in this section, see | |
106 | .BR attributes (7). | |
1ec27c36 ZL |
107 | .TS |
108 | allbox; | |
109 | lb lb lb | |
110 | l l l. | |
111 | Interface Attribute Value | |
112 | T{ | |
113 | .BR fgetpwent () | |
ef661130 MK |
114 | T} Thread safety MT-Unsafe race:fgetpwent |
115 | .TE | |
116 | .\" FIXME: The marking is different from that in the glibc manual, | |
117 | .\" which has: | |
118 | .\" | |
119 | .\" fgetpwent: MT-Unsafe race:fpwent | |
120 | .\" | |
1ec27c36 ZL |
121 | .\" We think race:fpwent in glibc maybe hard for users to understand, |
122 | .\" and have sent a patch to the GNU libc community for changing it to | |
d07f4209 MK |
123 | .\" race:fgetpwent, however, something about the copyright impeded the |
124 | .\" progress. | |
47297adb | 125 | .SH CONFORMING TO |
44a2c328 | 126 | SVr4. |
47297adb | 127 | .SH SEE ALSO |
fea681da MK |
128 | .BR endpwent (3), |
129 | .BR fgetpwent_r (3), | |
279325d8 | 130 | .BR fopen (3), |
fea681da MK |
131 | .BR getpw (3), |
132 | .BR getpwent (3), | |
133 | .BR getpwnam (3), | |
134 | .BR getpwuid (3), | |
135 | .BR putpwent (3), | |
136 | .BR setpwent (3), | |
137 | .BR passwd (5) |