Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/pwd.h
+++ new/usr/src/head/pwd.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /* Copyright (c) 1988 AT&T */
23 23 /* All Rights Reserved */
24 24
25 25
26 26 /*
27 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 + *
27 29 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 30 * Use is subject to license terms.
29 31 */
30 32
31 33 #ifndef _PWD_H
32 34 #define _PWD_H
33 35
34 -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3.1.9 */
35 -
36 36 #include <sys/feature_tests.h>
37 37
38 38 #include <sys/types.h>
39 39
40 40 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
41 41 #include <stdio.h>
42 42 #endif
43 43
44 44 #ifdef __cplusplus
45 45 extern "C" {
46 46 #endif
47 47
48 48 struct passwd {
49 49 char *pw_name;
50 50 char *pw_passwd;
51 51 uid_t pw_uid;
52 52 gid_t pw_gid;
53 53 char *pw_age;
54 54 char *pw_comment;
55 55 char *pw_gecos;
56 56 char *pw_dir;
57 57 char *pw_shell;
58 58 };
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
59 59
60 60 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
61 61 struct comment {
62 62 char *c_dept;
63 63 char *c_name;
64 64 char *c_acct;
65 65 char *c_bin;
66 66 };
67 67 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
68 68
69 -#if defined(__STDC__)
70 -
71 69 extern struct passwd *getpwuid(uid_t); /* MT-unsafe */
72 70 extern struct passwd *getpwnam(const char *); /* MT-unsafe */
73 71
74 72 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
75 73 extern struct passwd *getpwent_r(struct passwd *, char *, int);
76 74 extern struct passwd *fgetpwent_r(FILE *, struct passwd *, char *, int);
77 75 extern struct passwd *fgetpwent(FILE *); /* MT-unsafe */
78 76 extern int putpwent(const struct passwd *, FILE *);
79 77 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
80 78
81 79 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
82 80 defined(__EXTENSIONS__)
83 81 extern void endpwent(void);
84 82 extern struct passwd *getpwent(void); /* MT-unsafe */
85 83 extern void setpwent(void);
86 84 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
87 85
88 -#else /* (__STDC__) */
89 -
90 -extern struct passwd *getpwuid(); /* MT-unsafe */
91 -extern struct passwd *getpwnam(); /* MT-unsafe */
92 -
93 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
94 -extern struct passwd *getpwent_r();
95 -extern struct passwd *fgetpwent_r();
96 -
97 -extern struct passwd *fgetpwent(); /* MT-unsafe */
98 -extern int putpwent();
99 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
100 -
101 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
102 - defined(__EXTENSIONS__)
103 -extern void endpwent();
104 -extern struct passwd *getpwent(); /* MT-unsafe */
105 -extern void setpwent();
106 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
107 -
108 -#endif /* (__STDC__) */
109 -
110 86 /*
111 87 * getpwuid_r() & getpwnam_r() prototypes are defined here.
112 88 */
113 89
114 90 /*
115 91 * Previous releases of Solaris, starting at 2.3, provided definitions of
116 92 * various functions as specified in POSIX.1c, Draft 6. For some of these
117 93 * functions, the final POSIX 1003.1c standard had a different number of
118 94 * arguments and return values.
119 95 *
120 96 * The following segment of this header provides support for the standard
121 97 * interfaces while supporting applications written under earlier
122 98 * releases. The application defines appropriate values of the feature
123 99 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
124 100 * whether it was written to expect the Draft 6 or standard versions of
125 101 * these interfaces, before including this header. This header then
126 102 * provides a mapping from the source version of the interface to an
127 103 * appropriate binary interface. Such mappings permit an application
128 104 * to be built from libraries and objects which have mixed expectations
129 105 * of the definitions of these functions.
130 106 *
131 107 * For applications using the Draft 6 definitions, the binary symbol is the
132 108 * same as the source symbol, and no explicit mapping is needed. For the
133 109 * standard interface, the function func() is mapped to the binary symbol
134 110 * _posix_func(). The preferred mechanism for the remapping is a compiler
135 111 * #pragma. If the compiler does not provide such a #pragma, the header file
136 112 * defines a static function func() which calls the _posix_func() version;
137 113 * this has to be done instead of #define since POSIX specifies that an
138 114 * application can #undef the symbol and still be bound to the correct
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
139 115 * implementation. Unfortunately, the statics confuse lint so we fallback to
140 116 * #define in that case.
141 117 *
142 118 * NOTE: Support for the Draft 6 definitions is provided for compatibility
143 119 * only. New applications/libraries should use the standard definitions.
144 120 */
145 121
146 122 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
147 123 defined(_POSIX_PTHREAD_SEMANTICS) || defined(__EXTENSIONS__)
148 124
149 -#if defined(__STDC__)
150 -
151 125 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
152 126
153 127 #ifdef __PRAGMA_REDEFINE_EXTNAME
154 128 #pragma redefine_extname getpwuid_r __posix_getpwuid_r
155 129 #pragma redefine_extname getpwnam_r __posix_getpwnam_r
156 130 extern int getpwuid_r(uid_t, struct passwd *, char *, int, struct passwd **);
157 131 extern int getpwnam_r(const char *, struct passwd *, char *,
158 132 int, struct passwd **);
159 133 #else /* __PRAGMA_REDEFINE_EXTNAME */
160 134
161 135 extern int __posix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
162 136 struct passwd **);
163 137 extern int __posix_getpwnam_r(const char *, struct passwd *, char *,
164 138 size_t, struct passwd **);
165 139
166 140 #ifdef __lint
167 141
168 142 #define getpwuid_r __posix_getpwuid_r
169 143 #define getpwnam_r __posix_getpwnam_r
170 144
171 145 #else /* !__lint */
172 146
173 147 static int
174 148 getpwuid_r(uid_t __uid, struct passwd *__pwd, char *__buf, int __len,
175 149 struct passwd **__res)
176 150 {
177 151 return (__posix_getpwuid_r(__uid, __pwd, __buf, __len, __res));
178 152 }
179 153 static int
180 154 getpwnam_r(const char *__cb, struct passwd *__pwd, char *__buf, int __len,
181 155 struct passwd **__res)
182 156 {
183 157 return (__posix_getpwnam_r(__cb, __pwd, __buf, __len, __res));
184 158 }
185 159
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
186 160 #endif /* !__lint */
187 161 #endif /* __PRAGMA_REDEFINE_EXTNAME */
188 162
189 163 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
190 164
191 165 extern struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
192 166 extern struct passwd *getpwnam_r(const char *, struct passwd *, char *, int);
193 167
194 168 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
195 169
196 -#else /* __STDC__ */
197 -
198 -#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
199 -
200 -#ifdef __PRAGMA_REDEFINE_EXTNAME
201 -#pragma redefine_extname getpwuid_r __posix_getpwuid_r
202 -#pragma redefine_extname getpwnam_r __posix_getpwnam_r
203 -extern int getpwuid_r();
204 -extern int getpwnam_r();
205 -#else /* __PRAGMA_REDEFINE_EXTNAME */
206 -
207 -extern int __posix_getpwuid_r();
208 -extern int __posix_getpwnam_r();
209 -
210 -#ifdef __lint
211 -
212 -#define getpwuid_r __posix_getpwuid_r
213 -#define getpwnam_r __posix_getpwnam_r
214 -
215 -#else /* !__lint */
216 -
217 -static int
218 -getpwuid_r(__uid, __pwd, __buf, __len, __res)
219 - uid_t __uid;
220 - struct passwd *__pwd;
221 - char *__buf;
222 - int __len;
223 - struct passwd **__res;
224 -{
225 - return (__posix_getpwuid_r(__uid, __pwd, __buf, __len, __res));
226 -}
227 -static int
228 -getpwnam_r(__cb, __pwd, __buf, __len, __res)
229 - char *__cb;
230 - struct passwd *__pwd;
231 - char *__buf;
232 - int __len;
233 - struct passwd **__res;
234 -{
235 - return (__posix_getpwnam_r(__cb, __pwd, __buf, __len, __res));
236 -}
237 -
238 -#endif /* !__lint */
239 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
240 -
241 -#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
242 -
243 -extern struct passwd *getpwuid_r();
244 -extern struct passwd *getpwnam_r();
245 -
246 -#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
247 -
248 -#endif /* __STDC__ */
249 -
250 170 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L)... */
251 171
252 172 #ifdef __cplusplus
253 173 }
254 174 #endif
255 175
256 176 #endif /* _PWD_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX