Sun Jul 30 01:09:08 1995 Jim Meyering (meyering@comco.com)
[glibc/pb-stable.git] / pwd / pwd.h
blobc72c37df40f5b21bc5ab35e6282bb567b4b82865
1 /* Copyright (C) 1991, 1992 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, 1992 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));
61 #endif
64 #if defined(__USE_SVID) || defined(__USE_MISC)
65 /* Rewind the password-file stream. */
66 extern void setpwent __P ((void));
68 /* Close the password-file stream. */
69 extern void endpwent __P ((void));
71 /* Read an entry from the password-file stream, opening it if necessary. */
72 extern struct passwd *getpwent __P ((void));
73 #endif
75 #ifdef __USE_SVID
76 /* Read an entry from STREAM. */
77 extern struct passwd *fgetpwent __P ((FILE * __stream));
79 /* Write the given entry onto the given stream. */
80 extern int putpwent __P ((__const struct passwd * __p, FILE * __f));
81 #endif
83 /* Search for an entry with a matching user ID. */
84 extern struct passwd *getpwuid __P ((__uid_t __uid));
86 /* Search for an entry with a matching username. */
87 extern struct passwd *getpwnam __P ((__const char *__name));
90 __END_DECLS
92 #endif /* pwd.h */