| 1 |
'\" t |
| 2 |
.\" Copyright 2003, Walter Harms <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 6 |
.\" |
| 7 |
.TH putgrent 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
putgrent \- write a group database entry to a file |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
| 16 |
.B #include <grp.h> |
| 17 |
.P |
| 18 |
.BI "int putgrent(const struct group *restrict " grp \ |
| 19 |
", FILE *restrict " stream ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
The |
| 23 |
.BR putgrent () |
| 24 |
function is the counterpart for |
| 25 |
.BR fgetgrent (3). |
| 26 |
The function writes the content of the provided |
| 27 |
.I struct group |
| 28 |
into the |
| 29 |
.IR stream . |
| 30 |
The list of group members must be NULL-terminated or NULL-initialized. |
| 31 |
.P |
| 32 |
The |
| 33 |
.I struct group |
| 34 |
is defined as follows: |
| 35 |
.P |
| 36 |
.in +4n |
| 37 |
.EX |
| 38 |
struct group { |
| 39 |
char *gr_name; /* group name */ |
| 40 |
char *gr_passwd; /* group password */ |
| 41 |
gid_t gr_gid; /* group ID */ |
| 42 |
char **gr_mem; /* group members */ |
| 43 |
}; |
| 44 |
.EE |
| 45 |
.in |
| 46 |
.SH RETURN VALUE |
| 47 |
The function returns zero on success, and a nonzero value on error. |
| 48 |
.SH ATTRIBUTES |
| 49 |
For an explanation of the terms used in this section, see |
| 50 |
.BR attributes (7). |
| 51 |
.TS |
| 52 |
allbox; |
| 53 |
lbx lb lb |
| 54 |
l l l. |
| 55 |
Interface Attribute Value |
| 56 |
T{ |
| 57 |
.na |
| 58 |
.nh |
| 59 |
.BR putgrent () |
| 60 |
T} Thread safety MT-Safe |
| 61 |
.TE |
| 62 |
.SH STANDARDS |
| 63 |
GNU. |
| 64 |
.SH SEE ALSO |
| 65 |
.BR fgetgrent (3), |
| 66 |
.BR getgrent (3), |
| 67 |
.BR group (5) |