Query: setgrent
OS: ultrix
Section: 3
Links: ultrix man pages all man pages
Forums: forum home forum categories
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
getgrent(3) Library Functions Manual getgrent(3) Name getgrent, getgrgid, getgrnam, setgrent, endgrent - get group entry Syntax #include <grp.h> struct group *getgrent() struct group *getgrgid(gid) gid_t gid; struct group *getgrnam(name) char *name; void setgrent() void endgrent() Description The and subroutines each return pointers to an object with the following structure containing the broken-out fields of a line in the group database: 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. A call to has the effect of rewinding the group file to allow repeated searches. The may be called to close the group database when pro- cessing is complete. The subroutine simply reads the next line while and search until a matching gid or name is found (or until EOF is encountered). The sub- routine keeps a pointer in the database, allowing successive calls to be used to search the entire file. A call to must be made before a loop using in order to perform initialization and an must be used after the loop. Both and make calls to and Restrictions All information is contained in a static area so it must be copied if it is to be saved. If YP is running, does not return the entries in any particular order. See the Guide to the Yellow Pages Service for setup information. The group database may also be distributed via the BIND/Hesiod naming service. See the Guide to the BIND/Hesiod Service for more informa- tion. Return Values A null pointer (0) is returned on EOF or error. Files See Also group(5), svc.conf(5) Guide to the BIND/Hesiod Service Guide to the Yellow Pages Service getgrent(3)