1FGETPWENT(3)               Linux Programmer's Manual              FGETPWENT(3)
2
3
4

NAME

6       fgetpwent - get password file entry
7

SYNOPSIS

9       #include <stdio.h>
10       #include <sys/types.h>
11       #include <pwd.h>
12
13       struct passwd *fgetpwent(FILE *stream);
14
15   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17       fgetpwent():
18           Since glibc 2.19:
19               _DEFAULT_SOURCE
20           Glibc 2.19 and earlier:
21               _SVID_SOURCE
22

DESCRIPTION

24       The  fgetpwent()  function  returns a pointer to a structure containing
25       the broken out fields of a line in the file stream.  The first time  it
26       is called it returns the first entry; thereafter, it returns successive
27       entries.  The file referred to by stream must have the same  format  as
28       /etc/passwd (see passwd(5)).
29
30       The passwd structure is defined in <pwd.h> as follows:
31
32           struct passwd {
33               char   *pw_name;       /* username */
34               char   *pw_passwd;     /* user password */
35               uid_t   pw_uid;        /* user ID */
36               gid_t   pw_gid;        /* group ID */
37               char   *pw_gecos;      /* real name */
38               char   *pw_dir;        /* home directory */
39               char   *pw_shell;      /* shell program */
40           };
41

RETURN VALUE

43       The  fgetpwent()  function  returns a pointer to a passwd structure, or
44       NULL if there are no more entries or an error occurs.  In the event  of
45       an error, errno is set to indicate the cause.
46

ERRORS

48       ENOMEM Insufficient memory to allocate passwd structure.
49

FILES

51       /etc/passwd
52              password database file
53

ATTRIBUTES

55       For   an   explanation   of   the  terms  used  in  this  section,  see
56       attributes(7).
57
58       ┌────────────┬───────────────┬──────────────────────────┐
59Interface   Attribute     Value                    
60       ├────────────┼───────────────┼──────────────────────────┤
61fgetpwent() │ Thread safety │ MT-Unsafe race:fgetpwent │
62       └────────────┴───────────────┴──────────────────────────┘

CONFORMING TO

64       SVr4.
65

SEE ALSO

67       endpwent(3), fgetpwent_r(3), fopen(3),  getpw(3),  getpwent(3),  getpw‐
68       nam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5)
69

COLOPHON

71       This  page  is  part of release 5.07 of the Linux man-pages project.  A
72       description of the project, information about reporting bugs,  and  the
73       latest     version     of     this    page,    can    be    found    at
74       https://www.kernel.org/doc/man-pages/.
75
76
77
78GNU                               2018-02-02                      FGETPWENT(3)
Impressum