Manual Pages for UNIX Darwin command on man setgroupent
MyWebUniversity

Manual Pages for UNIX Darwin command on man setgroupent

GETGRENT(3) BSD Library Functions Manual GETGRENT(3)

NAME

ggeettggrreenntt, ggeettggrrnnaamm, ggeettggrrggiidd, sseettggrroouuppeenntt, sseettggrreenntt, eennddggrreenntt - group

database operations LLIIBBRRAARRYY

Standard C Library (libc, -lc)

SYNOPSIS

##iinncclluuddee <>

struct group * ggeettggrreenntt(void); struct group * ggeettggrrnnaamm(const char *name); struct group * ggeettggrrggiidd(gidt gid); int sseettggrroouuppeenntt(int stayopen); int sseettggrreenntt(void); void eennddggrreenntt(void);

DESCRIPTION

These functions operate on the group database file /etc/group which is described in group(5). Each line of the database is defined by the structure group found in the include file : struct group { char *grname; /* group name */ char *grpasswd; /* group password */ int grgid; /* group id */ char **grmem; /* group members */ }; The functions ggeettggrrnnaamm() and ggeettggrrggiidd() search the group database for the given group name pointed to by name or the group id pointed to by gid, respectively, returning the first one encountered. Identical group names or group gids may result in undefined behavior. The ggeettggrreenntt() function sequentially reads the group database and is intended for programs that wish to step through the complete list of groups. All three routines will open the group file for reading, if necessary. The sseettggrroouuppeenntt() function opens the file, or rewinds it if it is already

open. If stayopen is non-zero, file descriptors are left open, signifi-

cantly speeding functions subsequent calls. This functionality is unnec-

essary for ggeettggrreenntt() as it doesn't close its file descriptors by

default. It should also be noted that it is dangerous for long-running

programs to use this functionality as the group file may be updated. The sseettggrreenntt() function is identical to sseettggrroouuppeenntt() with an argument of zero. The eennddggrreenntt() function closes any open files.

RETURN VALUES

The functions ggeettggrreenntt(), ggeettggrrnnaamm(), and ggeettggrrggiidd(), return a pointer to

the group entry if successful; if end-of-file is reached or an error

occurs a null pointer is returned. The functions sseettggrroouuppeenntt() and sseettggrreenntt() return the value 1 if successful, otherwise the value 0 is returned. The functions eennddggrreenntt() and sseettggrrffiillee() have no return value. FILES /etc/group group database file

SEE ALSO

getpwent(3), yp(4), group(5) HISTORY The functions eennddggrreenntt(), ggeettggrreenntt(), ggeettggrrnnaamm(), ggeettggrrggiidd(), and sseettggrreenntt() appeared in Version 7 AT&T UNIX. The functions sseettggrrffiillee()

and sseettggrroouuppeenntt() appeared in 4.3BSD-Reno.

CCOOMMPPAATTIIBBIILLIITTYY The historic function sseettggrrffiillee(), which allowed the specification of

alternate password databases, has been deprecated and is no longer avail-

able.

BUGS

The functions ggeettggrreenntt(), ggeettggrrnnaamm(), ggeettggrrggiidd(), sseettggrroouuppeenntt() and sseettggrreenntt() leave their results in an internal static object and return a

pointer to that object. Subsequent calls to the same function will mod-

ify the same object. The functions ggeettggrreenntt(), eennddggrreenntt(), sseettggrroouuppeenntt(), and sseettggrreenntt() are

fairly useless in a networked environment and should be avoided, if pos-

sible. BSD September 29, 1994 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™