]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
4 | .\" |
5 | .\" References consulted: | |
6 | .\" Linux libc source code | |
7 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
8 | .\" 386BSD man pages | |
9 | .\" Modified Sat Jul 24 19:38:44 1993 by Rik Faith (faith@cs.unc.edu) | |
45186a5d | 10 | .TH FGETGRENT 3 2021-03-22 "Linux man-pages (unreleased)" |
fea681da MK |
11 | .SH NAME |
12 | fgetgrent \- get group file entry | |
afa8db94 AC |
13 | .SH LIBRARY |
14 | Standard C library | |
15 | .RI ( libc ", " \-lc ) | |
fea681da MK |
16 | .SH SYNOPSIS |
17 | .nf | |
18 | .B #include <stdio.h> | |
19 | .B #include <sys/types.h> | |
20 | .B #include <grp.h> | |
68e4db0a | 21 | .PP |
fea681da MK |
22 | .BI "struct group *fgetgrent(FILE *" stream ); |
23 | .fi | |
68e4db0a | 24 | .PP |
d39ad78f | 25 | .RS -4 |
cc4615cc MK |
26 | Feature Test Macro Requirements for glibc (see |
27 | .BR feature_test_macros (7)): | |
d39ad78f | 28 | .RE |
68e4db0a | 29 | .PP |
cc4615cc | 30 | .BR fgetgrent (): |
9d281e06 | 31 | .nf |
51c612fb MK |
32 | Since glibc 2.19: |
33 | _DEFAULT_SOURCE | |
34 | Glibc 2.19 and earlier: | |
35 | _SVID_SOURCE | |
9d281e06 | 36 | .fi |
fea681da | 37 | .SH DESCRIPTION |
60a90ecd MK |
38 | The |
39 | .BR fgetgrent () | |
40 | function returns a pointer to a structure containing | |
fb3dcb4a MK |
41 | the group information from the file referred to by |
42 | .IR stream . | |
c13182ef MK |
43 | The first time it is called |
44 | it returns the first entry; thereafter, it returns successive entries. | |
fb3dcb4a MK |
45 | The file referred to by |
46 | .I stream | |
47 | must have the same format as | |
48 | .I /etc/group | |
49 | (see | |
50 | .BR group (5)). | |
fea681da MK |
51 | .PP |
52 | The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows: | |
51f5698d | 53 | .PP |
bd191423 | 54 | .in +4n |
b8302363 | 55 | .EX |
fea681da | 56 | struct group { |
cc4615cc MK |
57 | char *gr_name; /* group name */ |
58 | char *gr_passwd; /* group password */ | |
59 | gid_t gr_gid; /* group ID */ | |
d064d41a | 60 | char **gr_mem; /* NULL\-terminated array of pointers |
b7800b44 | 61 | to names of group members */ |
fea681da | 62 | }; |
b8302363 | 63 | .EE |
bd191423 | 64 | .in |
47297adb | 65 | .SH RETURN VALUE |
60a90ecd MK |
66 | The |
67 | .BR fgetgrent () | |
55a18b78 MK |
68 | function returns a pointer to a |
69 | .I group | |
70 | structure, | |
fea681da | 71 | or NULL if there are no more entries or an error occurs. |
3600608b MK |
72 | In the event of an error, |
73 | .I errno | |
cb6a894e | 74 | is set to indicate the error. |
fea681da MK |
75 | .SH ERRORS |
76 | .TP | |
77 | .B ENOMEM | |
55a18b78 MK |
78 | Insufficient memory to allocate |
79 | .I group | |
80 | structure. | |
098cd28b ZL |
81 | .SH ATTRIBUTES |
82 | For an explanation of the terms used in this section, see | |
83 | .BR attributes (7). | |
c466875e MK |
84 | .ad l |
85 | .nh | |
098cd28b ZL |
86 | .TS |
87 | allbox; | |
c466875e | 88 | lbx lb lb |
098cd28b ZL |
89 | l l l. |
90 | Interface Attribute Value | |
91 | T{ | |
92 | .BR fgetgrent () | |
098cd28b ZL |
93 | T} Thread safety MT-Unsafe race:fgetgrent |
94 | .TE | |
c466875e MK |
95 | .hy |
96 | .ad | |
97 | .sp 1 | |
13ce9c8d MK |
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 | |
d07f4209 MK |
105 | .\" race:fgetgrent, however, something about the copyright impeded the |
106 | .\" progress. | |
3113c7f3 | 107 | .SH STANDARDS |
44a2c328 | 108 | SVr4. |
47297adb | 109 | .SH SEE ALSO |
fea681da MK |
110 | .BR endgrent (3), |
111 | .BR fgetgrent_r (3), | |
fb3dcb4a | 112 | .BR fopen (3), |
fea681da MK |
113 | .BR getgrent (3), |
114 | .BR getgrgid (3), | |
115 | .BR getgrnam (3), | |
c9c3b6f3 | 116 | .BR putgrent (3), |
fb3dcb4a | 117 | .BR setgrent (3), |
60e91186 | 118 | .BR group (5) |