OSDN Git Service

80d6d1761e02793424bdc75501a36b91b9f01f8f
[linuxjm/LDP_man-pages.git] / original / 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  2013-04-19 "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 .sp
42 .BI "struct passwd *fgetpwent(FILE *" stream );
43 .fi
44 .sp
45 .in -4n
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
48 .in
49 .sp
50 .BR fgetpwent ():
51 _SVID_SOURCE
52 .SH DESCRIPTION
53 The
54 .BR fgetpwent ()
55 function returns a pointer to a structure containing
56 the broken out fields of a line in the file \fIstream\fP.
57 The first time it is called it returns the first entry;
58 thereafter, it returns successive entries.
59 The file referred to by
60 .I stream
61 must have the same format as
62 .I /etc/passwd
63 (see
64 .BR passwd (5)).
65 .PP
66 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
67 .sp
68 .in +4n
69 .nf
70 struct passwd {
71     char   *pw_name;       /* username */
72     char   *pw_passwd;     /* user password */
73     uid_t   pw_uid;        /* user ID */
74     gid_t   pw_gid;        /* group ID */
75     char   *pw_gecos;      /* real name */
76     char   *pw_dir;        /* home directory */
77     char   *pw_shell;      /* shell program */
78 };
79 .fi
80 .in
81 .SH RETURN VALUE
82 The
83 .BR fgetpwent ()
84 function returns a pointer to a
85 .I passwd
86 structure, or NULL if
87 there are no more entries or an error occurs.
88 In the event of an error,
89 .I errno
90 is set to indicate the cause.
91 .SH ERRORS
92 .TP
93 .B ENOMEM
94 Insufficient memory to allocate
95 .I passwd
96 structure.
97 .SH FILES
98 .TP
99 .I /etc/passwd
100 password database file
101 .SH CONFORMING TO
102 SVr4.
103 .SH SEE ALSO
104 .BR endpwent (3),
105 .BR fgetpwent_r (3),
106 .BR fopen (3),
107 .BR getpw (3),
108 .BR getpwent (3),
109 .BR getpwnam (3),
110 .BR getpwuid (3),
111 .BR putpwent (3),
112 .BR setpwent (3),
113 .BR passwd (5)
114 .SH COLOPHON
115 This page is part of release 3.64 of the Linux
116 .I man-pages
117 project.
118 A description of the project,
119 and information about reporting bugs,
120 can be found at
121 \%http://www.kernel.org/doc/man\-pages/.