]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fgetpwent.3
Various pages: add missing .nf/.fi in FTM info
[thirdparty/man-pages.git] / man3 / fgetpwent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
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 .\"
33 .TH FGETPWENT 3 2018-02-02 "GNU" "Linux Programmer's Manual"
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>
41 .PP
42 .BI "struct passwd *fgetpwent(FILE *" stream );
43 .fi
44 .PP
45 .RS -4
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
48 .RE
49 .PP
50 .BR fgetpwent ():
51 .nf
52 Since glibc 2.19:
53 _DEFAULT_SOURCE
54 Glibc 2.19 and earlier:
55 _SVID_SOURCE
56 .fi
57 .SH DESCRIPTION
58 The
59 .BR fgetpwent ()
60 function returns a pointer to a structure containing
61 the broken out fields of a line in the file \fIstream\fP.
62 The first time it is called it returns the first entry;
63 thereafter, it returns successive entries.
64 The file referred to by
65 .I stream
66 must have the same format as
67 .I /etc/passwd
68 (see
69 .BR passwd (5)).
70 .PP
71 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
72 .PP
73 .in +4n
74 .EX
75 struct passwd {
76 char *pw_name; /* username */
77 char *pw_passwd; /* user password */
78 uid_t pw_uid; /* user ID */
79 gid_t pw_gid; /* group ID */
80 char *pw_gecos; /* real name */
81 char *pw_dir; /* home directory */
82 char *pw_shell; /* shell program */
83 };
84 .EE
85 .in
86 .SH RETURN VALUE
87 The
88 .BR fgetpwent ()
89 function returns a pointer to a
90 .I passwd
91 structure, or NULL if
92 there are no more entries or an error occurs.
93 In the event of an error,
94 .I errno
95 is set to indicate the cause.
96 .SH ERRORS
97 .TP
98 .B ENOMEM
99 Insufficient memory to allocate
100 .I passwd
101 structure.
102 .SH FILES
103 .TP
104 .I /etc/passwd
105 password database file
106 .SH ATTRIBUTES
107 For an explanation of the terms used in this section, see
108 .BR attributes (7).
109 .ad l
110 .nh
111 .TS
112 allbox;
113 lbx lb lb
114 l l l.
115 Interface Attribute Value
116 T{
117 .BR fgetpwent ()
118 T} Thread safety MT-Unsafe race:fgetpwent
119 .TE
120 .hy
121 .ad
122 .sp 1
123 .\" FIXME: The marking is different from that in the glibc manual,
124 .\" which has:
125 .\"
126 .\" fgetpwent: MT-Unsafe race:fpwent
127 .\"
128 .\" We think race:fpwent in glibc maybe hard for users to understand,
129 .\" and have sent a patch to the GNU libc community for changing it to
130 .\" race:fgetpwent, however, something about the copyright impeded the
131 .\" progress.
132 .SH CONFORMING TO
133 SVr4.
134 .SH SEE ALSO
135 .BR endpwent (3),
136 .BR fgetpwent_r (3),
137 .BR fopen (3),
138 .BR getpw (3),
139 .BR getpwent (3),
140 .BR getpwnam (3),
141 .BR getpwuid (3),
142 .BR putpwent (3),
143 .BR setpwent (3),
144 .BR passwd (5)