putgrent(3)
πΈ putgrent(3) β Library Functions Manual πΈ
okay bestie, so this one is putgrent, from the Library Functions Manual, and it lives in the Standard C library (libc, -lc). it's the glow-up twin of writing group entries to a file. let's get into it π
β¨ NAME β¨
putgrent β write a group database entry to a file
π LIBRARY π
Standard C library (libc, -lc)
π«Ά SYNOPSIS π«Ά
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <grp.h>
int putgrent(const struct group *restrict grp, FILE *restrict stream);
π DESCRIPTION π
so putgrent() is literally the counterpart for fgetgrent(3). the way that it writes the content of the struct group you hand it into the stream. that's the whole vibe. π¦
heads up bestie: the list of group members must beNULL-terminated orNULL-initialized. no half-finished lists, okay? that's the rule and we respect it. π
and the struct group is defined like this, no cap:
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group ID */
char **gr_mem; /* group members */
};
β RETURN VALUE β
the function returns zero on success, and a nonzero value on error. that's it, that's the tea. β¨
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
putgrent()β Thread safety:MT-Safe
periodt. it's MT-Safe, she's safe, she's fine, she's iconic. π
π STANDARDS π
GNU. (iykyk, it's a GNU thing π)
π¦ SEE ALSO π¦
and that's the whole page, bestie!! this one's from Linux man-pages 6.20, dated 2026-02-08 ππ mwah, go forth and write those group entries responsibly, ily, bye!! π§β¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-1.0-or-later
- Copyright 2003, Walter Harms <walter.harms@informatik.uni-oldenburg.de>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms