1PUTGRENT(3) Linux Programmer's Manual PUTGRENT(3)
2
3
4
6 putgrent - write a group database entry to a file
7
9 #define _GNU_SOURCE /* See feature_test_macros(7) */
10 #include <grp.h>
11
12 int putgrent(const struct group *restrict grp, FILE *restrict stream);
13
15 The putgrent() function is the counterpart for fgetgrent(3). The func‐
16 tion writes the content of the provided struct group into the stream.
17 The list of group members must be NULL-terminated or NULL-initialized.
18
19 The struct group is defined as follows:
20
21 struct group {
22 char *gr_name; /* group name */
23 char *gr_passwd; /* group password */
24 gid_t gr_gid; /* group ID */
25 char **gr_mem; /* group members */
26 };
27
29 The function returns zero on success, and a nonzero value on error.
30
32 For an explanation of the terms used in this section, see at‐
33 tributes(7).
34
35 ┌────────────────────────────────────────────┬───────────────┬─────────┐
36 │Interface │ Attribute │ Value │
37 ├────────────────────────────────────────────┼───────────────┼─────────┤
38 │putgrent() │ Thread safety │ MT-Safe │
39 └────────────────────────────────────────────┴───────────────┴─────────┘
40
42 This function is a GNU extension.
43
45 fgetgrent(3), getgrent(3), group(5)
46
48 This page is part of release 5.13 of the Linux man-pages project. A
49 description of the project, information about reporting bugs, and the
50 latest version of this page, can be found at
51 https://www.kernel.org/doc/man-pages/.
52
53
54
55GNU 2021-03-22 PUTGRENT(3)