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