Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getgrent(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getlogin

getpwent, getpwuid, getpwnam, setpwent, endpwent

group

     getgrent, getgrgid, getgrnam, setgrent, endgrent

Purpose

     Accesses group file entries.

Library

     Standard C Library (libc.a)

Syntax

     #include <grp.h>

     struct group *getgrent ( )                struct group *getgrnam (name)
                                               char *name;
     struct group *getgrgid (gid)
     int gid;                                  void setgrent ( )

                                               void endgrent ( )
     Description

     The getgrent, getgrgid, and getgrnam subroutines return a
     pointer to  a structure containing the  broken-out fields
     of a line in the /etc/group file.  The group structure is
     defined in  the grp.h  header file,  and it  contains the
     following members:

          char  *gr_name;    /* The name of the group */
          char  *gr_passwd;  /* The encrypted group password */
          int   gr_gid;      /* The numerical group ID */
          char  **gr_mem;    /* Array of pointers to member names */

     The  getgrent subroutine,  when first  called, returns  a
     pointer to the first group structure in the file.  On the
     next call, it returns a  pointer to the next group struc-
     ture in  the file.  You  can call getgrent  repeatedly to
     search the entire file.

     The getgrgid  subroutine searches  from the  beginning of
     the file until it finds a numerical group ID matching the
     gid parameter.  The subroutine  then returns a pointer to
     the structure in which it was found.

     The getgrnam  subroutine searches  from the  beginning of
     the file until  it finds a group name  matching the ASCII
     equivalent of  the name  parameter.  The  subroutine then
     returns a pointer to the structure in which it was found.

     If an end-of-file condition or an error is encountered on
     reading, these functions return a NULL pointer.

     The setgrent  subroutine rewinds the group  file to allow
     repeated searches.

     The endgrent subroutine closes  the group file when proc-
     essing is complete.

     Warning:  All information is  contained in a static area,
     so it must be copied if it is to be saved.

     File

     /etc/group

     Related Information

     In   this   book:   "getlogin,"    "getpwent,   getpwuid,
     getpwnam, setpwent, endpwent," and "group."

     "Overview of International Character Support" in Managing
     the AIX Operating System.

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