1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
33 .TH FGETPWENT 3 2021-03-22 "GNU" "Linux Programmer's Manual"
35 fgetpwent \- get password file entry
39 .B #include <sys/types.h>
42 .BI "struct passwd *fgetpwent(FILE *" stream );
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
54 Glibc 2.19 and earlier:
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
66 must have the same format as
71 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
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 */
89 function returns a pointer to a
92 there are no more entries or an error occurs.
93 In the event of an error,
95 is set to indicate the error.
99 Insufficient memory to allocate
105 password database file
107 For an explanation of the terms used in this section, see
115 Interface Attribute Value
118 T} Thread safety MT-Unsafe race:fgetpwent
123 .\" FIXME: The marking is different from that in the glibc manual,
126 .\" fgetpwent: MT-Unsafe race:fpwent
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