Manual Page Result
0
Command: getgrent | Section: 3 | Source: UNIX v10 | File: getgrent.3
GETGRENT(3) Library Functions Manual GETGRENT(3)
NAME
getgrent, getgrgid, getgrnam, setgrent, endgrent - get group file entry
SYNOPSIS
#include <grp.h>
struct group *getgrent();
struct group *getgrgid(gid)
struct group *getgrnam(name)
char *name;
int setgrent();
int endgrent();
DESCRIPTION
Getgrent, getgrgid and getgrnam each return pointers to a structure
containing the broken-out fields of a line in
struct group {
char *gr_name; the group name
char *gr_passwd; the encrypted group passwd
int gr_gid; the numeric groupid
char **gr_mem; null-terminated vector of pointers to the individual member names
};
Getgrent simply reads the next line while getgrgid and getgrnam search
until a matching gid or name is found (or until EOF 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. Endgrent may be called to close the group file when
processing is complete.
FILES
SEE ALSO
getlogin(3), getpwent(3), passwd(5)
DIAGNOSTICS
Zero is returned on EOF or error.
BUGS
The return values point to static data whose content is overwritten by
each call.
GETGRENT(3)