Debian Codegraph @

upstream/debian-unstable/man3/fgetgrent.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH fgetgrent 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 fgetgrent \- get group file entry
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <stdio.h>
16 .B #include <sys/types.h>
17 .B #include <grp.h>
18 .P
19 .BI "struct group *fgetgrent(FILE *" stream );
20 .fi
21 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
27 .BR fgetgrent ():
28 .nf
29 Since glibc 2.19:
30 _DEFAULT_SOURCE
31 glibc 2.19 and earlier:
32 _SVID_SOURCE
33 .fi
34 .SH DESCRIPTION
35 The
36 .BR fgetgrent ()
37 function returns a pointer to a structure containing
38 the group information from the file referred to by
39 .IR stream .
40 The first time it is called
41 it returns the first entry;
42 thereafter,
43 it returns successive entries.
44 The file referred to by
45 .I stream
46 must have the same format as
47 .I /etc/group
48 (see
49 .BR group (5)).
50 .P
51 The
52 .I group
53 structure is defined in
54 .I <grp.h>
55 as follows:
56 .P
57 .in +4n
58 .EX
59 struct group {
60 char *gr_name; /* group name */
61 char *gr_passwd; /* group password */
62 gid_t gr_gid; /* group ID */
63 char **gr_mem; /* NULL\-terminated array of pointers
64 to names of group members */
65 };
66 .EE
67 .in
68 .SH RETURN VALUE
69 The
70 .BR fgetgrent ()
71 function returns a pointer to a
72 .I group
73 structure,
74 or NULL if there are no more entries or an error occurs.
75 In the event of an error,
76 .I errno
77 is set to indicate the error.
78 .SH ERRORS
79 .TP
80 .B ENOMEM
81 Insufficient memory to allocate
82 .I group
83 structure.
84 .SH ATTRIBUTES
85 For an explanation of the terms used in this section, see
86 .BR attributes (7).
87 .TS
88 allbox;
89 lbx lb lb
90 l l l.
91 Interface Attribute Value
92 T{
93 .na
94 .nh
95 .BR fgetgrent ()
96 T} Thread safety MT-Unsafe race:fgetgrent
97 .TE
98 .\" FIXME The marking is different from that in the glibc manual,
99 .\" which has:
100 .\"
101 .\" fgetgrent: MT-Unsafe race:fgrent
102 .\"
103 .\" We think race:fgrent in glibc may be hard for users to understand,
104 .\" and have sent a patch to the GNU libc community for changing it to
105 .\" race:fgetgrent, however, something about the copyright impeded the
106 .\" progress.
107 .SH STANDARDS
108 None.
109 .SH HISTORY
110 SVr4.
111 .SH SEE ALSO
112 .BR endgrent (3),
113 .BR fgetgrent_r (3),
114 .BR fopen (3),
115 .BR getgrent (3),
116 .BR getgrgid (3),
117 .BR getgrnam (3),
118 .BR putgrent (3),
119 .BR setgrent (3),
120 .BR group (5)