Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getpwent(3)

getgrent(3)  —  Subroutines

OSF  —  Environment_Note_Added

NAME

getgrent, getgrgid, getgrnam, setgrent, endgrent  − Accesses the basic group information in the user database

SYNOPSIS

#include <grp.h>

struct group ∗getgrent ( void )

struct group ∗getgrgid (
gid_t gid );

struct group ∗getgrgid_r (
gid_t gid,
struct group ∗result,
char ∗buffer,
int len );

struct group ∗getgrnam(
const char ∗name );

struct group ∗getgrnam_r(
const char ∗name,
struct group ∗result,
char ∗buffer,
int len );

void setgrent ( void )

void endgrent ( void )

PARAMETERS

nameSpecifies the name of the group for which the basic attributes are to be read. 

gidSpecifies the group ID of the group for which the basic attributes are to be read. 

resultPoints to a buffer containing the result. 

bufferPoints to a character array to contain the strings associated with the entry returned by the getpwnam_r() or getpwuid_r() functions. 

lenSpecifies the length of buffer. 

DESCRIPTION

The getgrent(), getgrgid(), getgrnam(), setgrent(), and endgrent() functions may be used to access the basic group attributes.  These attributes can also be accessed with the getgroupattr() function, which can access all group attributes and offer better granularity of access. 

The setgrent() function opens the user database (if not already open) and rewinds the cursor to point to the first group entry in the database. 

The getgrent(), getgrnam(), and getgrgid() functions return information about the requested group.  The getgrent() function returns the next group in the sequential search.  The getgrnam() function returns the first group in the database with the gr_name field that matches the name parameter.  The getgrgid() function returns the first group in the database with a gr_gid field that matches the gid parameter.  The endgrent() function closes the user database. 

The group structure, which is returned by the getgrent(), getgrnam(), and getgrgid() functions, is defined in the grp.h header file, and contains the following members:

gr_nameThe name of the group. 

gr_passwdThe password of the group.  (Note that this field is no longer used by the system, so its value is meaningless.) 

gr_gidThe ID of the group. 

gr_memThe members of the group. 

The getgrgid_r() and getgrnam_r() functions are the reentrant versions of getgrgid() and getgrnam(), respectively.  Upon successful completion, the result is stored in the buffer pointed to by the result parameter. 

LIBRARY

Standard C Library (libc.a)

NOTES

The data that is returned by the gretgrent(), getgrnam(), and getgrgid() functions is stored in a static area and will be overwritten on subsequent calls to these routines.  If it is to be saved, it should be copied. 

AES Support Level:
Full use (getgrgid(), getgrnam())

RETURN VALUES

Upon successful completion, the getgrent(), getgrnam(), and getgrgid() functions return a pointer to a valid group structure containing a matching entry.  Otherwise, null is returned. 

ENVIRONMENT NOTES

This section describes system features that are not generic to OSF/1 but that are provided in this OSF/1 implementation. 

Digital Extensions

The system searches either the local /etc/group file or the NIS distributed networks file for the requested information.  To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. 

RELATED INFORMATION

Functions: getpwent(3)
 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026