Fred Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame] | 1 | \section{Built-in Module \module{grp}} |
Guido van Rossum | e47da0a | 1997-07-17 16:34:52 +0000 | [diff] [blame] | 2 | \label{module-grp} |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 3 | |
| 4 | \bimodindex{grp} |
| 5 | This module provides access to the \UNIX{} group database. |
| 6 | It is available on all \UNIX{} versions. |
| 7 | |
| 8 | Group database entries are reported as 4-tuples containing the |
| 9 | following items from the group database (see \file{<grp.h>}), in order: |
| 10 | \code{gr_name}, |
| 11 | \code{gr_passwd}, |
| 12 | \code{gr_gid}, |
| 13 | \code{gr_mem}. |
| 14 | The gid is an integer, name and password are strings, and the member |
| 15 | list is a list of strings. |
| 16 | (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] | 17 | group they are in according to the password database.) |
Guido van Rossum | eb0f066 | 1997-12-30 20:38:16 +0000 | [diff] [blame] | 18 | 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] | 19 | |
| 20 | It defines the following items: |
| 21 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 22 | \begin{funcdesc}{getgrgid}{gid} |
| 23 | Return the group database entry for the given numeric group ID. |
| 24 | \end{funcdesc} |
| 25 | |
| 26 | \begin{funcdesc}{getgrnam}{name} |
| 27 | Return the group database entry for the given group name. |
| 28 | \end{funcdesc} |
| 29 | |
| 30 | \begin{funcdesc}{getgrall}{} |
Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 31 | Return a list of all available group entries, in arbitrary order. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 32 | \end{funcdesc} |