|
|
1.1 ! root 1: .TH GETGRENT 3 ! 2: .CT 2 secur ! 3: .SH NAME ! 4: getgrent, getgrgid, getgrnam, setgrent, endgrent \(mi get group file entry ! 5: .SH SYNOPSIS ! 6: .nf ! 7: .B #include <grp.h> ! 8: .PP ! 9: .B struct group *getgrent(); ! 10: .PP ! 11: .B struct group *getgrgid(gid) ! 12: .PP ! 13: .B struct group *getgrnam(name) ! 14: .B char *name; ! 15: .PP ! 16: .B int setgrent(); ! 17: .PP ! 18: .B int endgrent(); ! 19: .fi ! 20: .SH DESCRIPTION ! 21: .I Getgrent, ! 22: .I getgrgid ! 23: and ! 24: .I getgrnam ! 25: each return pointers ! 26: to a structure ! 27: containing the broken-out ! 28: fields of a line in ! 29: .FR /etc/group . ! 30: .EX ! 31: .ta \w'struct 'u +\w'group 'u +\w'*gr_passwd; 'u ! 32: struct group { ! 33: \fLchar *gr_name;\fR the group name ! 34: \fLchar *gr_passwd;\fP the encrypted group passwd ! 35: \fLint gr_gid;\fP the numeric groupid ! 36: \fLchar **gr_mem;\fP null-terminated vector of pointers to the individual member names ! 37: \fL};\fP ! 38: .EE ! 39: .PP ! 40: .I Getgrent ! 41: simply reads the next ! 42: line while ! 43: .I getgrgid ! 44: and ! 45: .I getgrnam ! 46: search until a matching ! 47: .I gid ! 48: or ! 49: .I name ! 50: is found ! 51: (or until EOF is encountered). ! 52: Each routine picks up ! 53: where the others leave off ! 54: so successive calls may be used ! 55: to search the entire file. ! 56: .PP ! 57: A call to ! 58: .I setgrent ! 59: has the effect of rewinding ! 60: the group file ! 61: to allow ! 62: repeated searches. ! 63: .I Endgrent ! 64: may be called to ! 65: close the group file ! 66: when processing is complete. ! 67: .SH FILES ! 68: .TP ! 69: .F /etc/group ! 70: .SH "SEE ALSO" ! 71: .IR getlogin (3), ! 72: .IR getpwent (3), ! 73: .IR passwd (5) ! 74: .SH DIAGNOSTICS ! 75: Zero is returned on EOF ! 76: or error. ! 77: .SH BUGS ! 78: The return values point to static data ! 79: whose content is overwritten by each call.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.