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
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.
Printed 10/17/86 1
GETGRENT(3C) COMMAND REFERENCE GETGRENT(3C)
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
/etc/group
DIAGNOSTICS
A null pointer (0) is returned on EOF 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), group(5).
Printed 10/17/86 2
%%index%%
na:72,112;
sy:184,995;
de:1179,1057;2380,820;
fi:3200,69;
di:3269,132;
ca:3401,150;
se:3551,172;
%%index%%000000000130