1PUTPWENT(3) Linux Programmer's Manual PUTPWENT(3)
2
3
4
6 putpwent - write a password file entry
7
9 #include <stdio.h>
10 #include <sys/types.h>
11 #include <pwd.h>
12
13 int putpwent(const struct passwd *restrict p, FILE *restrict stream);
14
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 putpwent():
18 Since glibc 2.19:
19 _DEFAULT_SOURCE
20 Glibc 2.19 and earlier:
21 _SVID_SOURCE
22
24 The putpwent() function writes a password entry from the structure p in
25 the file associated with stream.
26
27 The passwd structure is defined in <pwd.h> as follows:
28
29 struct passwd {
30 char *pw_name; /* username */
31 char *pw_passwd; /* user password */
32 uid_t pw_uid; /* user ID */
33 gid_t pw_gid; /* group ID */
34 char *pw_gecos; /* real name */
35 char *pw_dir; /* home directory */
36 char *pw_shell; /* shell program */
37 };
38
40 The putpwent() function returns 0 on success. On failure, it returns
41 -1, and errno is set to indicate the error.
42
44 EINVAL Invalid (NULL) argument given.
45
47 For an explanation of the terms used in this section, see at‐
48 tributes(7).
49
50 ┌─────────────────────────────────────┬───────────────┬────────────────┐
51 │Interface │ Attribute │ Value │
52 ├─────────────────────────────────────┼───────────────┼────────────────┤
53 │putpwent() │ Thread safety │ MT-Safe locale │
54 └─────────────────────────────────────┴───────────────┴────────────────┘
55
57 SVr4.
58
60 endpwent(3), fgetpwent(3), getpw(3), getpwent(3), getpwnam(3), getp‐
61 wuid(3), setpwent(3)
62
64 This page is part of release 5.13 of the Linux man-pages project. A
65 description of the project, information about reporting bugs, and the
66 latest version of this page, can be found at
67 https://www.kernel.org/doc/man-pages/.
68
69
70
71GNU 2021-03-22 PUTPWENT(3)