Debian Codegraph @

upstream/debian-trixie/man3/fgetpwent.3

raw
1 '\" t
2 .\" Copyright 1993 David Metcalfe ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" 386BSD man pages
10 .\"
11 .\" Modified Sat Jul 24 19:37:37 1993 by Rik Faith ([email protected])
12 .\" Modified Mon May 27 22:40:48 1996 by Martin Schulze ([email protected])
13 .\"
14 .TH fgetpwent 3 2024-05-02 "Linux man-pages 6.9.1"
15 .SH NAME
16 fgetpwent \- get password file entry
17 .SH LIBRARY
18 Standard C library
19 .RI ( libc ", " \-lc )
20 .SH SYNOPSIS
21 .nf
22 .B #include <stdio.h>
23 .B #include <sys/types.h>
24 .B #include <pwd.h>
25 .P
26 .BI "struct passwd *fgetpwent(FILE *" stream );
27 .fi
28 .P
29 .RS -4
30 Feature Test Macro Requirements for glibc (see
31 .BR feature_test_macros (7)):
32 .RE
33 .P
34 .BR fgetpwent ():
35 .nf
36 Since glibc 2.19:
37 _DEFAULT_SOURCE
38 glibc 2.19 and earlier:
39 _SVID_SOURCE
40 .fi
41 .SH DESCRIPTION
42 The
43 .BR fgetpwent ()
44 function returns a pointer to a structure containing
45 the broken out fields of a line in the file \fIstream\fP.
46 The first time it is called it returns the first entry;
47 thereafter, it returns successive entries.
48 The file referred to by
49 .I stream
50 must have the same format as
51 .I /etc/passwd
52 (see
53 .BR passwd (5)).
54 .P
55 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
56 .P
57 .in +4n
58 .EX
59 struct passwd {
60 char *pw_name; /* username */
61 char *pw_passwd; /* user password */
62 uid_t pw_uid; /* user ID */
63 gid_t pw_gid; /* group ID */
64 char *pw_gecos; /* real name */
65 char *pw_dir; /* home directory */
66 char *pw_shell; /* shell program */
67 };
68 .EE
69 .in
70 .SH RETURN VALUE
71 The
72 .BR fgetpwent ()
73 function returns a pointer to a
74 .I passwd
75 structure, or NULL if
76 there are no more entries or an error occurs.
77 In the event of an error,
78 .I errno
79 is set to indicate the error.
80 .SH ERRORS
81 .TP
82 .B ENOMEM
83 Insufficient memory to allocate
84 .I passwd
85 structure.
86 .SH FILES
87 .TP
88 .I /etc/passwd
89 password database file
90 .SH ATTRIBUTES
91 For an explanation of the terms used in this section, see
92 .BR attributes (7).
93 .TS
94 allbox;
95 lbx lb lb
96 l l l.
97 Interface Attribute Value
98 T{
99 .na
100 .nh
101 .BR fgetpwent ()
102 T} Thread safety MT-Unsafe race:fgetpwent
103 .TE
104 .\" FIXME: The marking is different from that in the glibc manual,
105 .\" which has:
106 .\"
107 .\" fgetpwent: MT-Unsafe race:fpwent
108 .\"
109 .\" We think race:fpwent in glibc maybe hard for users to understand,
110 .\" and have sent a patch to the GNU libc community for changing it to
111 .\" race:fgetpwent, however, something about the copyright impeded the
112 .\" progress.
113 .SH STANDARDS
114 None.
115 .SH HISTORY
116 SVr4.
117 .SH SEE ALSO
118 .BR endpwent (3),
119 .BR fgetpwent_r (3),
120 .BR fopen (3),
121 .BR getpw (3),
122 .BR getpwent (3),
123 .BR getpwnam (3),
124 .BR getpwuid (3),
125 .BR putpwent (3),
126 .BR setpwent (3),
127 .BR passwd (5)