GETGRENT(3-BSD) RISC/os Reference Manual GETGRENT(3-BSD)
NAME
getgrent, getgrgid, getgrnam, setgrent, endgrent, setgrfile
- 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()
setgrfile(name)
char *name;
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.
/* --------------------------------------------------- */
/* | Copyright (c) 1986 MIPS Computer Systems, Inc. | */
/* | All Rights Reserved. | */
/* --------------------------------------------------- */
/* $Header: getgrent.3,v 1.5.4.1 92/06/24 12:56:31 marker Exp $ */
#ifndef _GRP_
#define _GRP_ 1
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
struct group { /* see getgrent(3) */
char *gr_name;
char *gr_passwd;
int gr_gid;
char **gr_mem;
};
#endif _GRP_
Printed 11/19/92 Page 1
GETGRENT(3-BSD) RISC/os Reference Manual GETGRENT(3-BSD)
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.
gr_mem Null-terminated vector of pointers to the
individual member names.
getgrent simply reads the next line while getgrgid and get-
grnam 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.
setgrfile changes the default group file to name thus allow-
ing alternate group files to be used. Note that it does not
close the previous file. If this is desired, endgrent
should be called prior to it.
FILES
/etc/group
SEE ALSO
getlogin(3), getpwent(3), group(4).
DIAGNOSTICS
A null pointer (0) is returned on EOF or error.
BUGS
All information is contained in a static area so it must be
copied if it is to be saved.
Page 2 Printed 11/19/92