]> git.ipfire.org Git - thirdparty/glibc.git/blame - pwd/pwd.h
(\deftypevarheader, \deftypevrheader): Remove
[thirdparty/glibc.git] / pwd / pwd.h
CommitLineData
b0d20a87 1/* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
2c6fe0bd 2 This file is part of the GNU C Library.
28f540f4 3
2c6fe0bd
UD
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.
28f540f4 8
2c6fe0bd
UD
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.
28f540f4 13
2c6fe0bd
UD
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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
28f540f4
RM
18
19/*
20 * POSIX Standard: 9.2.2 User Database Access <pwd.h>
21 */
22
23#ifndef _PWD_H
24
25#define _PWD_H 1
26#include <features.h>
27
28__BEGIN_DECLS
29
30#include <gnu/types.h>
31
0f110f41
TBB
32#define __need_size_t
33#include <stddef.h>
28f540f4
RM
34
35/* The passwd structure. */
36struct passwd
37{
38 char *pw_name; /* Username. */
39 char *pw_passwd; /* Password. */
40 __uid_t pw_uid; /* User ID. */
41 __gid_t pw_gid; /* Group ID. */
42 char *pw_gecos; /* Real name. */
43 char *pw_dir; /* Home directory. */
44 char *pw_shell; /* Shell program. */
45};
46
47
48#if defined(__USE_SVID) || defined(__USE_GNU)
49#define __need_FILE
50#include <stdio.h>
51#endif
52
53#ifdef __USE_GNU
54/* Return a new stream open on the password file. */
55extern FILE *__pwdopen __P ((void));
56
57/* Read a password entry from STREAM, filling in P.
58 Return the `struct passwd' of P if successful, NULL on failure. */
ba1ffaa1 59extern struct passwd *__pwdread __P ((FILE *__stream, __ptr_t __p));
28f540f4
RM
60
61/* Return a chunk of memory containing pre-initialized data for __pwdread. */
62extern __ptr_t __pwdalloc __P ((void));
7752137a
RM
63
64/* Scan the password file, filling in P, until SELECTOR returns nonzero for
65 an entry. Return the `struct passwd' of P if successful, NULL on
66 failure. */
67extern struct passwd *__pwdscan __P ((__ptr_t *__p,
68 int (*__selector) (struct passwd *)));
28f540f4
RM
69#endif
70
71
2c6fe0bd 72#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
28f540f4
RM
73/* Rewind the password-file stream. */
74extern void setpwent __P ((void));
75
76/* Close the password-file stream. */
77extern void endpwent __P ((void));
78
79/* Read an entry from the password-file stream, opening it if necessary. */
80extern struct passwd *getpwent __P ((void));
81#endif
82
83#ifdef __USE_SVID
84/* Read an entry from STREAM. */
ba1ffaa1 85extern struct passwd *fgetpwent __P ((FILE *__stream));
28f540f4
RM
86
87/* Write the given entry onto the given stream. */
ba1ffaa1 88extern int putpwent __P ((__const struct passwd *__p, FILE *__f));
28f540f4
RM
89#endif
90
91/* Search for an entry with a matching user ID. */
92extern struct passwd *getpwuid __P ((__uid_t __uid));
93
94/* Search for an entry with a matching username. */
95extern struct passwd *getpwnam __P ((__const char *__name));
96
23396375
UD
97#ifdef __USE_REENTRANT
98/* Reasonable value for the buffer sized used in the reentrant
99 functions below. But better use `sysconf'. */
100#define NSS_BUFLEN_PASSWD 1024
101
102/* Reentrant versions of some of the functions above.
103
104 PLEASE NOTE: these functions are not yet standardized. The interface
105 may change in later versions of this library. */
106
2c6fe0bd 107#if defined(__USE_SVID) || defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
ba1ffaa1
UD
108extern int __getpwent_r __P ((struct passwd *__resultbuf, char *__buffer,
109 size_t __buflen, struct passwd **__result));
110extern int getpwent_r __P ((struct passwd *__resultbuf, char *__buffer,
111 size_t __buflen, struct passwd **__result));
23396375
UD
112#endif
113
ba1ffaa1
UD
114extern int __getpwuid_r __P ((__uid_t __uid, struct passwd *__resultbuf,
115 char *__buffer, size_t __buflen,
116 struct passwd **__result));
117extern int getpwuid_r __P ((__uid_t __uid, struct passwd *__resultbuf,
118 char *__buffer, size_t __buflen,
119 struct passwd **__result));
23396375 120
ba1ffaa1
UD
121extern int __getpwnam_r __P ((__const char *__name, struct passwd *__resultbuf,
122 char *__buffer, size_t __buflen,
123 struct passwd **__result));
124extern int getpwnam_r __P ((__const char *__name, struct passwd *__resultbuf,
125 char *__buffer, size_t __buflen,
126 struct passwd **__result));
23396375 127
a8922de8
UD
128
129#ifdef __USE_SVID
130/* Read an entry from STREAM. */
ba1ffaa1
UD
131extern int __fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
132 char *__buffer, size_t __buflen,
133 struct passwd **__result));
134extern int fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
135 char *__buffer, size_t __buflen,
136 struct passwd **__result));
a8922de8
UD
137#endif
138
23396375
UD
139#endif /* reentrant */
140
28f540f4
RM
141
142__END_DECLS
143
144#endif /* pwd.h */