1putpwent(3) Library Functions Manual putpwent(3)
2
3
4
6 putpwent - write a password file entry
7
9 Standard C library (libc, -lc)
10
12 #include <stdio.h>
13 #include <sys/types.h>
14 #include <pwd.h>
15
16 int putpwent(const struct passwd *restrict p, FILE *restrict stream);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 putpwent():
21 Since glibc 2.19:
22 _DEFAULT_SOURCE
23 glibc 2.19 and earlier:
24 _SVID_SOURCE
25
27 The putpwent() function writes a password entry from the structure p in
28 the file associated with stream.
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
43 The putpwent() function returns 0 on success. On failure, it returns
44 -1, and errno is set to indicate the error.
45
47 EINVAL Invalid (NULL) argument given.
48
50 For an explanation of the terms used in this section, see at‐
51 tributes(7).
52
53 ┌─────────────────────────────────────┬───────────────┬────────────────┐
54 │Interface │ Attribute │ Value │
55 ├─────────────────────────────────────┼───────────────┼────────────────┤
56 │putpwent() │ Thread safety │ MT-Safe locale │
57 └─────────────────────────────────────┴───────────────┴────────────────┘
58
60 None.
61
63 SVr4.
64
66 endpwent(3), fgetpwent(3), getpw(3), getpwent(3), getpwnam(3),
67 getpwuid(3), setpwent(3)
68
69
70
71Linux man-pages 6.05 2023-07-20 putpwent(3)