]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fgetpwent.3
_exit.2, bpf.2, cacheflush.2, capget.2, chdir.2, chmod.2, chroot.2, clock_getres...
[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 2016-03-15 "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 .in -4n
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
48 .in
49 .PP
50 .BR fgetpwent ():
51 Since glibc 2.19:
52 _DEFAULT_SOURCE
53 Glibc 2.19 and earlier:
54 _SVID_SOURCE
55 .SH DESCRIPTION
56 The
57 .BR fgetpwent ()
58 function returns a pointer to a structure containing
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.
62 The file referred to by
63 .I stream
64 must have the same format as
65 .I /etc/passwd
66 (see
67 .BR passwd (5)).
68 .PP
69 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
70 .sp
71 .in +4n
72 .nf
73 struct passwd {
74 char *pw_name; /* username */
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 */
81 };
82 .fi
83 .in
84 .SH RETURN VALUE
85 The
86 .BR fgetpwent ()
87 function returns a pointer to a
88 .I passwd
89 structure, or NULL if
90 there are no more entries or an error occurs.
91 In the event of an error,
92 .I errno
93 is set to indicate the cause.
94 .SH ERRORS
95 .TP
96 .B ENOMEM
97 Insufficient memory to allocate
98 .I passwd
99 structure.
100 .SH FILES
101 .TP
102 .I /etc/passwd
103 password database file
104 .TS
105 allbox;
106 lb lb lb
107 l l l.
108 Interface Attribute Value
109 T{
110 .BR fgetpwent ()
111 T} Thread safety MT-Unsafe race:fgetpwent
112 .TE
113 .\" FIXME: The marking is different from that in the glibc manual,
114 .\" which has:
115 .\"
116 .\" fgetpwent: MT-Unsafe race:fpwent
117 .\"
118 .\" We think race:fpwent in glibc maybe hard for users to understand,
119 .\" and have sent a patch to the GNU libc community for changing it to
120 .\" race:fgetpwent, however, something about the copyright impeded the
121 .\" progress.
122 .SH CONFORMING TO
123 SVr4.
124 .SH SEE ALSO
125 .BR endpwent (3),
126 .BR fgetpwent_r (3),
127 .BR fopen (3),
128 .BR getpw (3),
129 .BR getpwent (3),
130 .BR getpwnam (3),
131 .BR getpwuid (3),
132 .BR putpwent (3),
133 .BR setpwent (3),
134 .BR passwd (5)