OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man3 / fgetgrent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified Sat Jul 24 19:38:44 1993 by Rik Faith (faith@cs.unc.edu)
30 .TH FGETGRENT 3  2013-04-19 "GNU" "Linux Programmer's Manual"
31 .SH NAME
32 fgetgrent \- get group file entry
33 .SH SYNOPSIS
34 .nf
35 .B #include <stdio.h>
36 .B #include <sys/types.h>
37 .B #include <grp.h>
38 .sp
39 .BI "struct group *fgetgrent(FILE *" stream );
40 .fi
41 .sp
42 .in -4n
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
45 .in
46 .sp
47 .BR fgetgrent ():
48 _SVID_SOURCE
49 .SH DESCRIPTION
50 The
51 .BR fgetgrent ()
52 function returns a pointer to a structure containing
53 the group information from the file referred to by
54 .IR stream .
55 The first time it is called
56 it returns the first entry; thereafter, it returns successive entries.
57 The file referred to by
58 .I stream
59 must have the same format as
60 .I /etc/group
61 (see
62 .BR group (5)).
63 .PP
64 The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
65 .sp
66 .in +4n
67 .nf
68 struct group {
69     char   *gr_name;        /* group name */
70     char   *gr_passwd;      /* group password */
71     gid_t   gr_gid;         /* group ID */
72     char  **gr_mem;         /* group members */
73 };
74 .fi
75 .in
76 .SH RETURN VALUE
77 The
78 .BR fgetgrent ()
79 function returns a pointer to a
80 .I group
81 structure,
82 or NULL if there are no more entries or an error occurs.
83 In the event of an error,
84 .I errno
85 is set to indicate the cause.
86 .SH ERRORS
87 .TP
88 .B ENOMEM
89 Insufficient memory to allocate
90 .I group
91 structure.
92 .SH CONFORMING TO
93 SVr4.
94 .SH SEE ALSO
95 .BR endgrent (3),
96 .BR fgetgrent_r (3),
97 .BR fopen (3),
98 .BR getgrent (3),
99 .BR getgrgid (3),
100 .BR getgrnam (3),
101 .BR putgrent (3),
102 .BR setgrent (3),
103 .BR group (5)
104 .SH COLOPHON
105 This page is part of release 3.68 of the Linux
106 .I man-pages
107 project.
108 A description of the project,
109 information about reporting bugs,
110 and the latest version of this page,
111 can be found at
112 \%http://www.kernel.org/doc/man\-pages/.