GETGRENT(3C) DOMAIN/IX SYS5 GETGRENT(3C)
NAME
getgrent, getgrgid, getgrnam, setgrent, endgrent, fgetgrent
- get group file entry
USAGE
#include <grp.h>
struct group *getgrent()
struct group *getgrgid(gid)
int gid;
struct group *getgrnam(name)
char *name;
void setgrent ()
void endgrent ()
struct group *fgetgrent(f)
FILE *f;
DESCRIPTION
Getgrent, getgrgid and getgrnam each return pointers to an
object with the following structure. This structure con-
tains the broken-out fields of a line in the /etc/group
file. Each line contains a "group" structure, which is
defined in the <grp.h> header file.
struct group {
char *gr_name;
char *gr_passwd;
int gr_gid;
char **gr_mem;
};
The members of this structure are:
gr_name The name of the group.
gr_passwd The encrypted password of the group (always null
on DOMAIN Systems).
gr_gid The numerical group-ID.
gr_mem Null-terminated vector of pointers to the indivi-
dual member names.
Printed 12/4/86 GETGRENT-1
GETGRENT(3C) DOMAIN/IX SYS5 GETGRENT(3C)
Getgrent simply reads the next line while getgrgid and get-
grnam 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.
Fgetgrent returns a pointer to the next group structure in
the stream f, which matches the format of /etc/group.
NOTES
All information is contained in a static area so it must be
copied if it is to be saved.
On DOMAIN/IX Systems, /etc/group is built from registry
information by the program crpasswd(8).
DIAGNOSTICS
A null pointer (0) is returned on EOF or error.
FILES
/etc/group the group file
RELATED INFORMATION
getlogin(3C), getpwent(3C), group(4)
GETGRENT-2 Printed 12/4/86