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