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