Wed May 22 17:22:14 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / pwd / pwd.h
blob58eb2e5851ee188ac46f2d42aa440843a952102c
1 /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * POSIX Standard: 9.2.2 User Database Access <pwd.h>
23 #ifndef _PWD_H
25 #define _PWD_H 1
26 #include <features.h>
28 __BEGIN_DECLS
30 #include <gnu/types.h>
33 /* The passwd structure. */
34 struct passwd
36 char *pw_name; /* Username. */
37 char *pw_passwd; /* Password. */
38 __uid_t pw_uid; /* User ID. */
39 __gid_t pw_gid; /* Group ID. */
40 char *pw_gecos; /* Real name. */
41 char *pw_dir; /* Home directory. */
42 char *pw_shell; /* Shell program. */
46 #if defined(__USE_SVID) || defined(__USE_GNU)
47 #define __need_FILE
48 #include <stdio.h>
49 #endif
51 #ifdef __USE_GNU
52 /* Return a new stream open on the password file. */
53 extern FILE *__pwdopen __P ((void));
55 /* Read a password entry from STREAM, filling in P.
56 Return the `struct passwd' of P if successful, NULL on failure. */
57 extern struct passwd *__pwdread __P ((FILE * __stream, __ptr_t __p));
59 /* Return a chunk of memory containing pre-initialized data for __pwdread. */
60 extern __ptr_t __pwdalloc __P ((void));
62 /* Scan the password file, filling in P, until SELECTOR returns nonzero for
63 an entry. Return the `struct passwd' of P if successful, NULL on
64 failure. */
65 extern struct passwd *__pwdscan __P ((__ptr_t *__p,
66 int (*__selector) (struct passwd *)));
67 #endif
70 #if defined(__USE_SVID) || defined(__USE_MISC)
71 /* Rewind the password-file stream. */
72 extern void setpwent __P ((void));
74 /* Close the password-file stream. */
75 extern void endpwent __P ((void));
77 /* Read an entry from the password-file stream, opening it if necessary. */
78 extern struct passwd *getpwent __P ((void));
79 #endif
81 #ifdef __USE_SVID
82 /* Read an entry from STREAM. */
83 extern struct passwd *fgetpwent __P ((FILE * __stream));
85 /* Write the given entry onto the given stream. */
86 extern int putpwent __P ((__const struct passwd * __p, FILE * __f));
87 #endif
89 /* Search for an entry with a matching user ID. */
90 extern struct passwd *getpwuid __P ((__uid_t __uid));
92 /* Search for an entry with a matching username. */
93 extern struct passwd *getpwnam __P ((__const char *__name));
96 __END_DECLS
98 #endif /* pwd.h */