GETGRGID
Section: C Library Functions (3)
Updated: August 1, 1992
Index
Return to Main Contents
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 ALSO
getlogin(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.
Index
- NAME
-
- SYNOPSIS
-
- (ALSO AVAILABLE IN BSD)
-
- DESCRIPTION
-
- RETURN VALUE
-
- FILES
-
- SEE ALSO
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 00:57:49 GMT, September 26, 2024