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