1 /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * POSIX Standard: 9.2.1 Group Database Access <grp.h>
30 #include <gnu/types.h>
33 /* The group structure. */
36 char *gr_name
; /* Group name. */
37 char *gr_passwd
; /* Password. */
38 __gid_t gr_gid
; /* Group ID. */
39 char **gr_mem
; /* Member list. */
43 #if defined(__USE_SVID) || defined(__USE_GNU)
49 /* Return a new stream open on the group file. */
50 extern FILE *__grpopen
__P ((void));
52 /* Read a group entry from STREAM, filling in G.
53 Return the `struct group' of G if successful, NULL on failure. */
54 extern struct group
*__grpread
__P ((FILE * __stream
, __ptr_t __g
));
56 /* Return a chunk of memory containing pre-initialized data for __grpread. */
57 extern __ptr_t __grpalloc
__P ((void));
59 /* Scan the group file, filling in G, until SELECTOR returns nonzero for an
60 entry. Return the `struct group' of G if successful, NULL on failure. */
61 extern struct group
*__grpscan
__P ((__ptr_t
*__p
,
62 int (*__selector
) (struct group
*)));
66 #if defined(__USE_SVID) || defined(__USE_MISC) || defined (__USE_BSD)
67 /* Rewind the group-file stream. */
68 extern void setgrent
__P ((void));
70 /* Close the group-file stream. */
71 extern void endgrent
__P ((void));
73 /* Read an entry from the group-file stream, opening it if necessary. */
74 extern struct group
*getgrent
__P ((void));
78 /* Read a group entry from STREAM. */
79 extern struct group
*fgetgrent
__P ((FILE * __stream
));
82 /* Search for an entry with a matching group ID. */
83 extern struct group
*getgrgid
__P ((__gid_t __gid
));
85 /* Search for an entry with a matching group name. */
86 extern struct group
*getgrnam
__P ((__const
char *__name
));
94 /* Set the group set for the current user to GROUPS (N of them). */
95 extern int setgroups
__P ((size_t __n
, __const __gid_t
* groups
));
97 /* Initialize the group set for the current user
98 by reading the group database and using all groups
99 of which USER is a member. Also include GROUP. */
100 extern int initgroups
__P ((__const
char *user
, __gid_t group
));
102 #endif /* Use BSD. */