Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{grp} --- |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 2 | The group database} |
| 3 | |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 4 | \declaremodule{builtin}{grp} |
Fred Drake | a54a887 | 1999-03-02 17:03:42 +0000 | [diff] [blame] | 5 | \platform{Unix} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 6 | \modulesynopsis{The group database (\function{getgrnam()} and friends).} |
| 7 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 8 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 9 | This module provides access to the \UNIX{} group database. |
| 10 | It is available on all \UNIX{} versions. |
| 11 | |
| 12 | Group database entries are reported as 4-tuples containing the |
Fred Drake | a5aefba | 1998-08-14 17:05:17 +0000 | [diff] [blame] | 13 | following items from the group database (see \code{<grp.h>}), in order: |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 14 | \code{gr_name}, |
| 15 | \code{gr_passwd}, |
| 16 | \code{gr_gid}, |
| 17 | \code{gr_mem}. |
| 18 | The gid is an integer, name and password are strings, and the member |
| 19 | list is a list of strings. |
| 20 | (Note that most users are not explicitly listed as members of the |
Guido van Rossum | 470be14 | 1995-03-17 16:07:09 +0000 | [diff] [blame] | 21 | group they are in according to the password database.) |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 22 | \exception{KeyError} is raised if the entry asked for cannot be found. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 23 | |
| 24 | It defines the following items: |
| 25 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 26 | \begin{funcdesc}{getgrgid}{gid} |
| 27 | Return the group database entry for the given numeric group ID. |
| 28 | \end{funcdesc} |
| 29 | |
| 30 | \begin{funcdesc}{getgrnam}{name} |
| 31 | Return the group database entry for the given group name. |
| 32 | \end{funcdesc} |
| 33 | |
| 34 | \begin{funcdesc}{getgrall}{} |
Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 35 | Return a list of all available group entries, in arbitrary order. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 36 | \end{funcdesc} |