Bell 32V release
[unix-history] / usr / man / man3 / getgrent.3
CommitLineData
c4665c80
TL
1.TH GETGRENT 3
2.SH NAME
3getgrent, getgrgid, getgrnam, setgrent, endgrent \- get group file entry
4.SH SYNOPSIS
5.B #include <grp.h>
6.PP
7.B struct group *getgrent();
8.PP
9.B struct group *getgrgid(gid) int gid;
10.PP
11.B struct group *getgrnam(name) char *name;
12.PP
13.B int setgrent();
14.PP
15.B int endgrent();
16.SH DESCRIPTION
17.I Getgrent,
18.I getgrgid
19and
20.I getgrnam
21each return pointers
22to an object
23with the following structure
24containing the broken-out
25fields of a line in the group file.
26.RS
27.PP
28.nf
29.so /usr/include/grp.h
30.fi
31.RE
32.PP
33The members of this structure are:
34.TP
35gr_name
36The name of the group.
37.br
38.ns
39.TP
40gr_passwd
41The encrypted password of the group.
42.br
43.ns
44.TP
45gr_gid
46The numerical group-ID.
47.br
48.ns
49.TP
50gr_mem
51Null-terminated vector
52of pointers to the individual
53member names.
54.PP
55.I Getgrent
56simply reads the next
57line while
58.I getgrgid
59and
60.I getgrnam
61search until a matching
62.I gid
63or
64.I name
65is found
66(or until EOF is encountered).
67Each routine picks up
68where the others leave off
69so successive calls may be used
70to search the entire file.
71.PP
72A call to
73.I setgrent
74has the effect of rewinding
75the group file
76to allow
77repeated searches.
78.I Endgrent
79may be called to
80close the group file
81when processing is complete.
82.SH FILES
83/etc/group
84.SH "SEE ALSO"
85getlogin(3), getpwent(3), group(5)
86.SH DIAGNOSTICS
87A null pointer
88(0) is returned on EOF or error.
89.SH BUGS
90All information
91is contained in a static area
92so it must be copied if it is
93to be saved.