blob: b15128d306a8857264f898e017e9b6bcd91ae07f [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{grp} ---
2 The group database.}
Fred Drakeb91e9341998-07-23 17:59:49 +00003\declaremodule{builtin}{grp}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00004
Fred Drakeb91e9341998-07-23 17:59:49 +00005
6\modulesynopsis{The group database (\function{getgrnam()} and friends).}
7
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00008This module provides access to the \UNIX{} group database.
9It is available on all \UNIX{} versions.
10
11Group database entries are reported as 4-tuples containing the
12following items from the group database (see \file{<grp.h>}), in order:
13\code{gr_name},
14\code{gr_passwd},
15\code{gr_gid},
16\code{gr_mem}.
17The gid is an integer, name and password are strings, and the member
18list is a list of strings.
19(Note that most users are not explicitly listed as members of the
Guido van Rossum470be141995-03-17 16:07:09 +000020group they are in according to the password database.)
Guido van Rossumeb0f0661997-12-30 20:38:16 +000021A \code{KeyError} exception is raised if the entry asked for cannot be found.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000022
23It defines the following items:
24
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000025\begin{funcdesc}{getgrgid}{gid}
26Return the group database entry for the given numeric group ID.
27\end{funcdesc}
28
29\begin{funcdesc}{getgrnam}{name}
30Return the group database entry for the given group name.
31\end{funcdesc}
32
33\begin{funcdesc}{getgrall}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000034Return a list of all available group entries, in arbitrary order.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000035\end{funcdesc}