Blob Blame History Raw
.\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\"
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
.\" Distributed under GPL
.\" %%%LICENSE_END
.\"
.TH PUTGRENT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
.SH NAME
putgrent \- write a group database entry to a file
.SH SYNOPSIS
.BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
.br
.B #include <grp.h>
.PP
.BI "int putgrent(const struct group *" grp ", FILE *" stream );
.SH DESCRIPTION
The
.BR putgrent ()
function is the counterpart for
.BR fgetgrent (3).
The function writes the content of the provided
.IR "struct group"
into the
.IR stream .
The list of group members must be NULL-terminated or NULL-initialized.
.PP
The
.IR "struct group"
is defined as follows:
.PP
.in +4n
.EX
struct group {
    char   *gr_name;      /* group name */
    char   *gr_passwd;    /* group password */
    gid_t   gr_gid;       /* group ID */
    char  **gr_mem;       /* group members */
};
.EE
.in
.SH RETURN VALUE
The function returns zero on success, and a nonzero value on error.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.TS
allbox;
lb lb lb
l l l.
Interface	Attribute	Value
T{
.BR putgrent ()
T}	Thread safety	MT-Safe
.TE
.sp 1
.SH CONFORMING TO
This function is a GNU extension.
.SH SEE ALSO
.BR fgetgrent (3),
.BR getgrent (3),
.BR group (5)
.SH COLOPHON
This page is part of release 4.15 of the Linux
.I man-pages
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
\%https://www.kernel.org/doc/man\-pages/.