ioctl_tty.2: Update DTR example
[man-pages.git] / man3 / putgrent.3
blob3b4b4d925dbf1ff25b788e29a9adc2ccf9b417f8
1 .\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
5 .\" %%%LICENSE_END
6 .\"
7 .TH PUTGRENT 3 2021-03-22 "GNU" "Linux Programmer's Manual"
8 .SH NAME
9 putgrent \- write a group database entry to a file
10 .SH SYNOPSIS
11 .nf
12 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
13 .B #include <grp.h>
14 .PP
15 .BI "int putgrent(const struct group *restrict " grp \
16 ", FILE *restrict " stream );
17 .fi
18 .SH DESCRIPTION
19 The
20 .BR putgrent ()
21 function is the counterpart for
22 .BR fgetgrent (3).
23 The function writes the content of the provided
24 .IR "struct group"
25 into the
26 .IR stream .
27 The list of group members must be NULL-terminated or NULL-initialized.
28 .PP
29 The
30 .IR "struct group"
31 is defined as follows:
32 .PP
33 .in +4n
34 .EX
35 struct group {
36     char   *gr_name;      /* group name */
37     char   *gr_passwd;    /* group password */
38     gid_t   gr_gid;       /* group ID */
39     char  **gr_mem;       /* group members */
41 .EE
42 .in
43 .SH RETURN VALUE
44 The function returns zero on success, and a nonzero value on error.
45 .SH ATTRIBUTES
46 For an explanation of the terms used in this section, see
47 .BR attributes (7).
48 .ad l
49 .nh
50 .TS
51 allbox;
52 lbx lb lb
53 l l l.
54 Interface       Attribute       Value
56 .BR putgrent ()
57 T}      Thread safety   MT-Safe
58 .TE
59 .hy
60 .ad
61 .sp 1
62 .SH CONFORMING TO
63 This function is a GNU extension.
64 .SH SEE ALSO
65 .BR fgetgrent (3),
66 .BR getgrent (3),
67 .BR group (5)