GETGRENT(3C) COMMAND REFERENCE GETGRENT(3C) NAME getgrent, getgrgid, getgrnam, setgrent, endgrent - get group file entry SYNOPSIS #include <grp.h> struct group *getgrent() struct group *getgrgid(gid) int gid; struct group *getgrnam(name) char *name; setgrent() endgrent() DESCRIPTION The programs getgrent, getgrgid, and getgrnam each return pointers to an object with the following structure containing the broken-out fields of a line in the group file: /* * grp.h * * Modifications from 4.2bsd * Copyright (c) 1984, Tektronix Inc. * All Rights Reserved */ struct group { /* see getgrent(3) */ char *gr_name; char *gr_passwd; int gr_gid; char **gr_mem; }; struct group *getgrent(), *getgrgid(), *getgrnam(); The members of this structure are: gr_name The name of the group. gr_passwd The encrypted password of the group. gr_gid The numerical group ID. gr_mem Null-terminated vector of pointers to the individual member names. Printed 3/13/89 1
GETGRENT(3C) COMMAND REFERENCE GETGRENT(3C) The getgrent program simply reads the next line while getgrgid and getgrnam search until a matching gid or name is found (or until end-of-file is encountered). Each routine picks up where the others leave off so successive calls may be used to search the entire file. A call to setgrent has the effect of rewinding the group file to allow repeated searches. The endgrent program may be called to close the group file when processing is complete. FILES /etc/group DIAGNOSTICS A null pointer (0) is returned on end-of-file or error. CAVEATS All information is contained in a static area so it must be copied if it is to be saved. SEE ALSO getlogin(3C), getpwent(3C), and group(5). Printed 3/13/89 2
%%index%% na:360,128; sy:488,1527; de:2015,1333;3780,909; fi:4689,89; di:4778,184; ca:4962,178; se:5140,207; %%index%%000000000132