Debian Codegraph @

upstream/debian-trixie/man3/putpwent.3

raw
1 '\" t
2 .\" Copyright 1993 David Metcalfe ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" 386BSD man pages
10 .\" Modified Sat Jul 24 18:43:46 1993 by Rik Faith ([email protected])
11 .TH putpwent 3 2024-05-02 "Linux man-pages 6.9.1"
12 .SH NAME
13 putpwent \- write a password file entry
14 .SH LIBRARY
15 Standard C library
16 .RI ( libc ", " \-lc )
17 .SH SYNOPSIS
18 .nf
19 .B #include <stdio.h>
20 .B #include <sys/types.h>
21 .B #include <pwd.h>
22 .P
23 .BI "int putpwent(const struct passwd *restrict " p \
24 ", FILE *restrict " stream );
25 .fi
26 .P
27 .RS -4
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
30 .RE
31 .P
32 .BR putpwent ():
33 .nf
34 Since glibc 2.19:
35 _DEFAULT_SOURCE
36 glibc 2.19 and earlier:
37 _SVID_SOURCE
38 .fi
39 .SH DESCRIPTION
40 The
41 .BR putpwent ()
42 function writes a password entry from the
43 structure \fIp\fP in the file associated with \fIstream\fP.
44 .P
45 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
46 .P
47 .in +4n
48 .EX
49 struct passwd {
50 char *pw_name; /* username */
51 char *pw_passwd; /* user password */
52 uid_t pw_uid; /* user ID */
53 gid_t pw_gid; /* group ID */
54 char *pw_gecos; /* real name */
55 char *pw_dir; /* home directory */
56 char *pw_shell; /* shell program */
57 };
58 .EE
59 .in
60 .SH RETURN VALUE
61 The
62 .BR putpwent ()
63 function returns 0 on success.
64 On failure, it returns \-1, and
65 .I errno
66 is set to indicate the error.
67 .SH ERRORS
68 .TP
69 .B EINVAL
70 Invalid (NULL) argument given.
71 .SH ATTRIBUTES
72 For an explanation of the terms used in this section, see
73 .BR attributes (7).
74 .TS
75 allbox;
76 lbx lb lb
77 l l l.
78 Interface Attribute Value
79 T{
80 .na
81 .nh
82 .BR putpwent ()
83 T} Thread safety MT-Safe locale
84 .TE
85 .SH STANDARDS
86 None.
87 .SH HISTORY
88 SVr4.
89 .SH SEE ALSO
90 .BR endpwent (3),
91 .BR fgetpwent (3),
92 .BR getpw (3),
93 .BR getpwent (3),
94 .BR getpwnam (3),
95 .BR getpwuid (3),
96 .BR setpwent (3)