1fgetpwent(3)               Library Functions Manual               fgetpwent(3)
2
3
4

NAME

6       fgetpwent - get password file entry
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

51       ENOMEM Insufficient memory to allocate passwd structure.
52

FILES

54       /etc/passwd
55              password database file
56

ATTRIBUTES

58       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
59       tributes(7).
60
61       ┌───────────────────────────┬───────────────┬──────────────────────────┐
62Interface                  Attribute     Value                    
63       ├───────────────────────────┼───────────────┼──────────────────────────┤
64fgetpwent()                │ Thread safety │ MT-Unsafe race:fgetpwent │
65       └───────────────────────────┴───────────────┴──────────────────────────┘
66

STANDARDS

68       None.
69

HISTORY

71       SVr4.
72

SEE ALSO

74       endpwent(3), fgetpwent_r(3), fopen(3),  getpw(3),  getpwent(3),  getpw‐
75       nam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5)
76
77
78
79Linux man-pages 6.04              2023-03-30                      fgetpwent(3)
Impressum