GETGRGID(3)GETGRGID(3)NAME
getgrgid, getgrnam, getgrent, setgrent, endgrent - group database
access
SYNOPSIS
#include <sys/types.h>
#include <grp.h>
struct group *getgrgid(gid_t gid);
struct group *getgrnam(const char *name);
(ALSO AVAILABLE IN BSD)
void setgrent(void);
struct group *getgrent(void);
void endgrent(void);
DESCRIPTION
The getgrgid and getgrnam functions both return a pointer to a group
structure containing an entry from the system's group database with a
matching numeric group ID (gid) or group name (name).
The group structure is defined in the header <grp.h> and includes the
following members:
Member Type Member Name Description
char * gr_name The name of the group.
gid_t gr_gid The numerical group ID.
char ** gr_mem A null-terminated vector of
pointers to the individual
member names.
The value returned points to a static area. So if the information is
to be saved, it must be copied.
The BSD routines setgrent, getgrent, and endgrent permit an application
to scan the groups sequentially. setgrent resets the group file to the
beginning, getgrent reads the next group entry, and endgrent closes the
group file when processing is complete. Calls to getgrgid or getgrnam
set the current location in the group file with respect to calls to
getgrent.
RETURN VALUE
A NULL pointer is returned on error or if the requested entry is not
found.
FILES
/etc/group - if NetInfo is not running.
SEE ALSOgetlogin(3), getpwent(3), group(5), netinfo(5)BUGS
All information is contained in a static area so it must be copied if
it is to be saved.
7th Edition August 1, 1992 GETGRGID(3)