This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Monster _r patch: try to scan for all known _r variants,
[perl5.git] / reentr.h
CommitLineData
10bc17b6
JH
1/*
2 * reentr.h
3 *
4 * Copyright (c) 1997-2002, Larry Wall
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 *
9 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
10 * This file is built by reentrl.pl from data in reentr.pl.
11 */
12
13#ifndef REENTR_H
14#define REENTR_H
15
16#ifdef USE_REENTRANT_API
17
18/* Deprecations: some platforms have the said reentrant interfaces
19 * but they are declared obsolete and are not to be used. Often this
20 * means that the platform has threadsafed the interfaces (hopefully).
21 * All this is OS version dependent, so we are of course fooling ourselves.
22 * If you know of more deprecations on some platforms, please add your own. */
23
24#ifdef __hpux
25# undef HAS_CRYPT_R
26# undef HAS_DRAND48_R
27# undef HAS_GETGRENT_R
28# undef HAS_GETPWENT_R
29# undef HAS_SETLOCALE_R
30# undef HAS_SRAND48_R
31# undef HAS_STRERROR_R
32# define NETDB_R_OBSOLETE
33#endif
34
35#if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
36# undef HAS_CRYPT_R
37# undef HAS_STRERROR_R
38# define NETDB_R_OBSOLETE
39#endif
40
41#ifdef NETDB_R_OBSOLETE
42# undef HAS_ENDHOSTENT_R
43# undef HAS_ENDNETENT_R
44# undef HAS_ENDPROTOENT_R
45# undef HAS_ENDSERVENT_R
46# undef HAS_GETHOSTBYADDR_R
47# undef HAS_GETHOSTBYNAME_R
48# undef HAS_GETHOSTENT_R
49# undef HAS_GETNETBYADDR_R
50# undef HAS_GETNETBYNAME_R
51# undef HAS_GETNETENT_R
52# undef HAS_GETPROTOBYNAME_R
53# undef HAS_GETPROTOBYNUMBER_R
54# undef HAS_GETPROTOENT_R
55# undef HAS_GETSERVBYNAME_R
56# undef HAS_GETSERVBYPORT_R
57# undef HAS_GETSERVENT_R
58# undef HAS_SETHOSTENT_R
59# undef HAS_SETNETENT_R
60# undef HAS_SETPROTOENT_R
61# undef HAS_SETSERVENT_R
62#endif
63
64#ifdef I_PWD
65# include <pwd.h>
66#endif
67#ifdef I_GRP
68# include <grp.h>
69#endif
70#ifdef I_NETDB
71# include <netdb.h>
72#endif
73#ifdef I_STDLIB
74# include <stdlib.h> /* drand48_data */
75#endif
76#ifdef I_CRYPT
77# ifdef I_CRYPT
78# include <crypt.h>
79# endif
80#endif
81#ifdef HAS_GETSPNAM_R
82# ifdef I_SHADOW
83# include <shadow.h>
84# endif
85#endif
86
87#define REENTRANT_PROTO_B_B 1
88#define REENTRANT_PROTO_B_BI 2
89#define REENTRANT_PROTO_B_BW 3
90#define REENTRANT_PROTO_B_CCS 4
91#define REENTRANT_PROTO_B_IBI 5
92#define REENTRANT_PROTO_B_IBW 6
93#define REENTRANT_PROTO_B_SB 7
94#define REENTRANT_PROTO_B_SBI 8
95#define REENTRANT_PROTO_I_BI 9
96#define REENTRANT_PROTO_I_BW 10
97#define REENTRANT_PROTO_I_CCSBWR 11
98#define REENTRANT_PROTO_I_CCSD 12
99#define REENTRANT_PROTO_I_CII 13
100#define REENTRANT_PROTO_I_CIISD 14
101#define REENTRANT_PROTO_I_CSBI 15
102#define REENTRANT_PROTO_I_CSBIR 16
103#define REENTRANT_PROTO_I_CSBWR 17
104#define REENTRANT_PROTO_I_CSBWRE 18
105#define REENTRANT_PROTO_I_CSD 19
106#define REENTRANT_PROTO_I_CWISBWRE 20
107#define REENTRANT_PROTO_I_CWISD 21
108#define REENTRANT_PROTO_I_H 22
109#define REENTRANT_PROTO_I_IBI 23
110#define REENTRANT_PROTO_I_IBW 24
111#define REENTRANT_PROTO_I_ICBI 25
112#define REENTRANT_PROTO_I_ICSBWR 26
113#define REENTRANT_PROTO_I_ICSD 27
114#define REENTRANT_PROTO_I_ID 28
115#define REENTRANT_PROTO_I_IISD 29
116#define REENTRANT_PROTO_I_ISBWR 30
117#define REENTRANT_PROTO_I_ISD 31
118#define REENTRANT_PROTO_I_LISBI 32
119#define REENTRANT_PROTO_I_LISD 33
120#define REENTRANT_PROTO_I_LS 34
121#define REENTRANT_PROTO_I_S 35
122#define REENTRANT_PROTO_I_SB 36
123#define REENTRANT_PROTO_I_SBI 37
124#define REENTRANT_PROTO_I_SBIE 38
125#define REENTRANT_PROTO_I_SBIH 39
126#define REENTRANT_PROTO_I_SBIR 40
127#define REENTRANT_PROTO_I_SBWR 41
128#define REENTRANT_PROTO_I_SBWRE 42
129#define REENTRANT_PROTO_I_SD 43
130#define REENTRANT_PROTO_I_ST 44
131#define REENTRANT_PROTO_I_TISD 45
132#define REENTRANT_PROTO_I_TS 46
133#define REENTRANT_PROTO_I_TSBI 47
134#define REENTRANT_PROTO_I_TSBIR 48
135#define REENTRANT_PROTO_I_TSBWR 49
136#define REENTRANT_PROTO_I_TSR 50
137#define REENTRANT_PROTO_I_UISBWRE 51
138#define REENTRANT_PROTO_S_CBI 52
139#define REENTRANT_PROTO_S_CCSBI 53
140#define REENTRANT_PROTO_S_CIISBIE 54
141#define REENTRANT_PROTO_S_CSBI 55
142#define REENTRANT_PROTO_S_CSBIE 56
143#define REENTRANT_PROTO_S_CWISBIE 57
144#define REENTRANT_PROTO_S_CWISBWIE 58
145#define REENTRANT_PROTO_S_ICSBI 59
146#define REENTRANT_PROTO_S_ISBI 60
147#define REENTRANT_PROTO_S_LISBI 61
148#define REENTRANT_PROTO_S_SBI 62
149#define REENTRANT_PROTO_S_SBIE 63
150#define REENTRANT_PROTO_S_SBW 64
151#define REENTRANT_PROTO_S_TISBI 65
152#define REENTRANT_PROTO_S_TS 66
153#define REENTRANT_PROTO_S_TSBI 67
154#define REENTRANT_PROTO_S_TSBIE 68
155#define REENTRANT_PROTO_S_TWISBIE 69
156#define REENTRANT_PROTO_V_H 70
157#define REENTRANT_PROTO_V_ID 71
158#define REENTRANT_PROTO_V_S 72
159
160/* Defines for indicating which special features are supported. */
161
162/* The getgrent getgrgid getgrnam using ptr? */
163
164#if (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR)
165# define GETGRENT_R_HAS_PTR
166#else
167# undef GETGRENT_R_HAS_PTR
168#endif
169#if (GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR)
170# define GETGRGID_R_HAS_PTR
171#else
172# undef GETGRGID_R_HAS_PTR
173#endif
174#if (GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR)
175# define GETGRNAM_R_HAS_PTR
176#else
177# undef GETGRNAM_R_HAS_PTR
178#endif
179
180/* Any of the getgrent getgrgid getgrnam using ptr? */
181
182#if (defined(GETGRENT_R_HAS_PTR) || defined(GETGRGID_R_HAS_PTR) || defined(GETGRNAM_R_HAS_PTR))
183# define USE_GETGRENT_PTR
184#else
185# undef USE_GETGRENT_PTR
186#endif
187
188/* The getpwent getpwnam getpwuid using ptr? */
189
190#if (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR)
191# define GETPWENT_R_HAS_PTR
192#else
193# undef GETPWENT_R_HAS_PTR
194#endif
195#if (GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR)
196# define GETPWNAM_R_HAS_PTR
197#else
198# undef GETPWNAM_R_HAS_PTR
199#endif
200#if (GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBIR)
201# define GETPWUID_R_HAS_PTR
202#else
203# undef GETPWUID_R_HAS_PTR
204#endif
205
206/* Any of the getpwent getpwnam getpwuid using ptr? */
207
208#if (defined(GETPWENT_R_HAS_PTR) || defined(GETPWNAM_R_HAS_PTR) || defined(GETPWUID_R_HAS_PTR))
209# define USE_GETPWENT_PTR
210#else
211# undef USE_GETPWENT_PTR
212#endif
213
214/* The getspent getspnam using ptr? */
215
216#if (GETSPNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR)
217# define GETSPNAM_R_HAS_PTR
218#else
219# undef GETSPNAM_R_HAS_PTR
220#endif
221
222/* Any of the getspent getspnam using ptr? */
223
224#if (defined(GETSPENT_R_HAS_PTR) || defined(GETSPNAM_R_HAS_PTR))
225# define USE_GETSPENT_PTR
226#else
227# undef USE_GETSPENT_PTR
228#endif
229
230/* The getgrent getgrgid getgrnam using fptr? */
231
232#if (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH)
233# define GETGRENT_R_HAS_FPTR
234#else
235# undef GETGRENT_R_HAS_FPTR
236#endif
237
238/* Any of the getgrent getgrgid getgrnam using fptr? */
239
240#if (defined(GETGRENT_R_HAS_FPTR) || defined(GETGRGID_R_HAS_FPTR) || defined(GETGRNAM_R_HAS_FPTR))
241# define USE_GETGRENT_FPTR
242#else
243# undef USE_GETGRENT_FPTR
244#endif
245
246/* The getpwent getpwnam getpwuid using fptr? */
247
248#if (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH)
249# define GETPWENT_R_HAS_FPTR
250#else
251# undef GETPWENT_R_HAS_FPTR
252#endif
253
254/* Any of the getpwent getpwnam getpwuid using fptr? */
255
256#if (defined(GETPWENT_R_HAS_FPTR) || defined(GETPWNAM_R_HAS_FPTR) || defined(GETPWUID_R_HAS_FPTR))
257# define USE_GETPWENT_FPTR
258#else
259# undef USE_GETPWENT_FPTR
260#endif
261
262/* The gethostent gethostbyaddr gethostbyname using ptr? */
263
264#if (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE)
265# define GETHOSTENT_R_HAS_PTR
266#else
267# undef GETHOSTENT_R_HAS_PTR
268#endif
269#if (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE)
270# define GETHOSTBYADDR_R_HAS_PTR
271#else
272# undef GETHOSTBYADDR_R_HAS_PTR
273#endif
274#if (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE)
275# define GETHOSTBYNAME_R_HAS_PTR
276#else
277# undef GETHOSTBYNAME_R_HAS_PTR
278#endif
279
280/* Any of the gethostent gethostbyaddr gethostbyname using ptr? */
281
282#if (defined(GETHOSTENT_R_HAS_PTR) || defined(GETHOSTBYADDR_R_HAS_PTR) || defined(GETHOSTBYNAME_R_HAS_PTR))
283# define USE_GETHOSTENT_PTR
284#else
285# undef USE_GETHOSTENT_PTR
286#endif
287
288/* The getnetent getnetbyaddr getnetbyname using ptr? */
289
290#if (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE)
291# define GETNETENT_R_HAS_PTR
292#else
293# undef GETNETENT_R_HAS_PTR
294#endif
295#if (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE)
296# define GETNETBYADDR_R_HAS_PTR
297#else
298# undef GETNETBYADDR_R_HAS_PTR
299#endif
300#if (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE)
301# define GETNETBYNAME_R_HAS_PTR
302#else
303# undef GETNETBYNAME_R_HAS_PTR
304#endif
305
306/* Any of the getnetent getnetbyaddr getnetbyname using ptr? */
307
308#if (defined(GETNETENT_R_HAS_PTR) || defined(GETNETBYADDR_R_HAS_PTR) || defined(GETNETBYNAME_R_HAS_PTR))
309# define USE_GETNETENT_PTR
310#else
311# undef USE_GETNETENT_PTR
312#endif
313
314/* The getprotoent getprotobyname getprotobynumber using ptr? */
315
316#if (GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR)
317# define GETPROTOENT_R_HAS_PTR
318#else
319# undef GETPROTOENT_R_HAS_PTR
320#endif
321#if (GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR)
322# define GETPROTOBYNAME_R_HAS_PTR
323#else
324# undef GETPROTOBYNAME_R_HAS_PTR
325#endif
326#if (GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR)
327# define GETPROTOBYNUMBER_R_HAS_PTR
328#else
329# undef GETPROTOBYNUMBER_R_HAS_PTR
330#endif
331
332/* Any of the getprotoent getprotobyname getprotobynumber using ptr? */
333
334#if (defined(GETPROTOENT_R_HAS_PTR) || defined(GETPROTOBYNAME_R_HAS_PTR) || defined(GETPROTOBYNUMBER_R_HAS_PTR))
335# define USE_GETPROTOENT_PTR
336#else
337# undef USE_GETPROTOENT_PTR
338#endif
339
340/* The getservent getservbyname getservbyport using ptr? */
341
342#if (GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR)
343# define GETSERVENT_R_HAS_PTR
344#else
345# undef GETSERVENT_R_HAS_PTR
346#endif
347#if (GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR)
348# define GETSERVBYNAME_R_HAS_PTR
349#else
350# undef GETSERVBYNAME_R_HAS_PTR
351#endif
352#if (GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR)
353# define GETSERVBYPORT_R_HAS_PTR
354#else
355# undef GETSERVBYPORT_R_HAS_PTR
356#endif
357
358/* Any of the getservent getservbyname getservbyport using ptr? */
359
360#if (defined(GETSERVENT_R_HAS_PTR) || defined(GETSERVBYNAME_R_HAS_PTR) || defined(GETSERVBYPORT_R_HAS_PTR))
361# define USE_GETSERVENT_PTR
362#else
363# undef USE_GETSERVENT_PTR
364#endif
365
366/* The gethostent gethostbyaddr gethostbyname using errno? */
367
368#if (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE)
369# define GETHOSTENT_R_HAS_ERRNO
370#else
371# undef GETHOSTENT_R_HAS_ERRNO
372#endif
373#if (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE)
374# define GETHOSTBYADDR_R_HAS_ERRNO
375#else
376# undef GETHOSTBYADDR_R_HAS_ERRNO
377#endif
378#if (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE)
379# define GETHOSTBYNAME_R_HAS_ERRNO
380#else
381# undef GETHOSTBYNAME_R_HAS_ERRNO
382#endif
383
384/* Any of the gethostent gethostbyaddr gethostbyname using errno? */
385
386#if (defined(GETHOSTENT_R_HAS_ERRNO) || defined(GETHOSTBYADDR_R_HAS_ERRNO) || defined(GETHOSTBYNAME_R_HAS_ERRNO))
387# define USE_GETHOSTENT_ERRNO
388#else
389# undef USE_GETHOSTENT_ERRNO
390#endif
391
392/* The getnetent getnetbyaddr getnetbyname using errno? */
393
394#if (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE)
395# define GETNETENT_R_HAS_ERRNO
396#else
397# undef GETNETENT_R_HAS_ERRNO
398#endif
399#if (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE)
400# define GETNETBYADDR_R_HAS_ERRNO
401#else
402# undef GETNETBYADDR_R_HAS_ERRNO
403#endif
404#if (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE)
405# define GETNETBYNAME_R_HAS_ERRNO
406#else
407# undef GETNETBYNAME_R_HAS_ERRNO
408#endif
409
410/* Any of the getnetent getnetbyaddr getnetbyname using errno? */
411
412#if (defined(GETNETENT_R_HAS_ERRNO) || defined(GETNETBYADDR_R_HAS_ERRNO) || defined(GETNETBYNAME_R_HAS_ERRNO))
413# define USE_GETNETENT_ERRNO
414#else
415# undef USE_GETNETENT_ERRNO
416#endif
417
418
419typedef struct {
420#ifdef HAS_ASCTIME_R
421 char* _asctime_buffer;
422 size_t _asctime_size;
423#endif /* HAS_ASCTIME_R */
424#ifdef HAS_CRYPT_R
425 struct crypt_data _crypt_struct;
426#endif /* HAS_CRYPT_R */
427#ifdef HAS_CTIME_R
428 char* _ctime_buffer;
429 size_t _ctime_size;
430#endif /* HAS_CTIME_R */
431#ifdef HAS_DRAND48_R
432 struct drand48_data _drand48_struct;
433 double _drand48_double;
434#endif /* HAS_DRAND48_R */
435#ifdef HAS_GETGRNAM_R
436 struct group _getgrent_struct;
437 char* _getgrent_buffer;
438 size_t _getgrent_size;
439# ifdef USE_GETGRENT_PTR
440 struct group* _getgrent_ptr;
441# endif
442# ifdef USE_GETGRENT_FPTR
443 FILE* _getgrent_fptr;
444# endif
445#endif /* HAS_GETGRNAM_R */
446#ifdef HAS_GETHOSTBYNAME_R
447 struct hostent _gethostent_struct;
448# if GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
449 struct hostent_data* _gethostent_data;
450# else
451 char* _gethostent_buffer;
452 size_t _gethostent_size;
453# endif
454# ifdef USE_GETHOSTENT_PTR
455 struct hostent* _gethostent_ptr;
456# endif
457# ifdef USE_GETHOSTENT_ERRNO
458 int _gethostent_errno;
459# endif
460#endif /* HAS_GETHOSTBYNAME_R */
461#ifdef HAS_GETLOGIN_R
462 char* _getlogin_buffer;
463 size_t _getlogin_size;
464#endif /* HAS_GETLOGIN_R */
465#ifdef HAS_GETNETBYNAME_R
466 struct netent _getnetent_struct;
467# if GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
468 struct netent_data* _getnetent_data;
469# else
470 char* _getnetent_buffer;
471 size_t _getnetent_size;
472# endif
473# ifdef USE_GETNETENT_PTR
474 struct netent* _getnetent_ptr;
475# endif
476# ifdef USE_GETNETENT_ERRNO
477 int _getnetent_errno;
478# endif
479#endif /* HAS_GETNETBYNAME_R */
480#ifdef HAS_GETPROTOBYNAME_R
481 struct protoent _getprotoent_struct;
482# if GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
483 struct protoent_data* _getprotoent_data;
484# else
485 char* _getprotoent_buffer;
486 size_t _getprotoent_size;
487# endif
488# ifdef USE_GETPROTOENT_PTR
489 struct protoent* _getprotoent_ptr;
490# endif
491# ifdef USE_GETPROTOENT_ERRNO
492 int _getprotoent_errno;
493# endif
494#endif /* HAS_GETPROTOBYNAME_R */
495#ifdef HAS_GETPWNAM_R
496 struct passwd _getpwent_struct;
497 char* _getpwent_buffer;
498 size_t _getpwent_size;
499# ifdef USE_GETPWENT_PTR
500 struct passwd* _getpwent_ptr;
501# endif
502# ifdef USE_GETPWENT_FPTR
503 FILE* _getpwent_fptr;
504# endif
505#endif /* HAS_GETPWNAM_R */
506#ifdef HAS_GETSERVBYNAME_R
507 struct servent _getservent_struct;
508# if GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSD
509 struct servent_data* _getservent_data;
510# else
511 char* _getservent_buffer;
512 size_t _getservent_size;
513# endif
514# ifdef USE_GETSERVENT_PTR
515 struct servent* _getservent_ptr;
516# endif
517# ifdef USE_GETSERVENT_ERRNO
518 int _getservent_errno;
519# endif
520#endif /* HAS_GETSERVBYNAME_R */
521#ifdef HAS_GETSPNAM_R
522 struct spwd _getspent_struct;
523 char* _getspent_buffer;
524 size_t _getspent_size;
525# ifdef USE_GETSPENT_PTR
526 struct spwd* _getspent_ptr;
527# endif
528#endif /* HAS_GETSPNAM_R */
529#ifdef HAS_GMTIME_R
530 struct tm _gmtime_struct;
531#endif /* HAS_GMTIME_R */
532#ifdef HAS_LOCALTIME_R
533 struct tm _localtime_struct;
534#endif /* HAS_LOCALTIME_R */
535#ifdef HAS_RANDOM_R
536 struct random_data _random_struct;
537#endif /* HAS_RANDOM_R */
538#ifdef HAS_READDIR_R
539 struct dirent* _readdir_struct;
540 size_t _readdir_size;
541# if READDIR_R_PROTO == REENTRANT_PROTO_I_TSR
542 struct dirent* _readdir_ptr;
543# endif
544#endif /* HAS_READDIR_R */
545#ifdef HAS_READDIR64_R
546 struct dirent64* _readdir64_struct;
547 size_t _readdir64_size;
548# if READDIR64_R_PROTO == REENTRANT_PROTO_I_TSR
549 struct dirent64* _readdir64_ptr;
550# endif
551#endif /* HAS_READDIR64_R */
552#ifdef HAS_SETLOCALE_R
553 char* _setlocale_buffer;
554 size_t _setlocale_size;
555#endif /* HAS_SETLOCALE_R */
556#ifdef HAS_STRERROR_R
557 char* _strerror_buffer;
558 size_t _strerror_size;
559#endif /* HAS_STRERROR_R */
560#ifdef HAS_TTYNAME_R
561 char* _ttyname_buffer;
562 size_t _ttyname_size;
563#endif /* HAS_TTYNAME_R */
564
565} REENTR;
566
567/* The wrappers. */
568
569#ifdef HAS_ASCTIME_R
570# undef asctime
571# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_B_SB
572# define asctime(a) asctime_r(a, PL_reentrant_buffer->_asctime_buffer)
573# endif
574# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_B_SBI
575# define asctime(a) asctime_r(a, PL_reentrant_buffer->_asctime_buffer, PL_reentrant_buffer->_asctime_size)
576# endif
577# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_I_SB
578# define asctime(a) (((errno = asctime_r(a, PL_reentrant_buffer->_asctime_buffer))) == 0 ? PL_reentrant_buffer->_asctime_buffer : 0)
579# endif
580# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_I_SBI
581# define asctime(a) (((errno = asctime_r(a, PL_reentrant_buffer->_asctime_buffer, PL_reentrant_buffer->_asctime_size))) == 0 ? PL_reentrant_buffer->_asctime_buffer : 0)
582# endif
583#endif /* HAS_ASCTIME_R */
584
585#ifdef HAS_CRYPT_R
586# undef crypt
587# if !defined(crypt) && CRYPT_R_PROTO == REENTRANT_PROTO_B_CCS
588# define crypt(a, b) crypt_r(a, b, &PL_reentrant_buffer->_crypt_struct)
589# endif
590#endif /* HAS_CRYPT_R */
591
592#ifdef HAS_CTERMID_R
593# undef ctermid
594# if !defined(ctermid) && CTERMID_R_PROTO == REENTRANT_PROTO_B_B
595# define ctermid(a) ctermid_r(a)
596# endif
597#endif /* HAS_CTERMID_R */
598
599#ifdef HAS_CTIME_R
600# undef ctime
601# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_B_SB
602# define ctime(a) ctime_r(a, PL_reentrant_buffer->_ctime_buffer)
603# endif
604# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_B_SBI
605# define ctime(a) ctime_r(a, PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size)
606# endif
607# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_I_SB
608# define ctime(a) (((errno = ctime_r(a, PL_reentrant_buffer->_ctime_buffer))) == 0 ? PL_reentrant_buffer->_ctime_buffer : 0)
609# endif
610# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_I_SBI
611# define ctime(a) (((errno = ctime_r(a, PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size))) == 0 ? PL_reentrant_buffer->_ctime_buffer : 0)
612# endif
613#endif /* HAS_CTIME_R */
614
615#ifdef HAS_DRAND48_R
616# undef drand48
617# if !defined(drand48) && DRAND48_R_PROTO == REENTRANT_PROTO_I_ST
618# define drand48() (((errno = drand48_r(&PL_reentrant_buffer->_drand48_struct, &PL_reentrant_buffer->_drand48_double))) == 0 ? PL_reentrant_buffer->_drand48_double : 0)
619# endif
620#endif /* HAS_DRAND48_R */
621
622#ifdef HAS_ENDGRENT_R
623# undef endgrent
624# if !defined(endgrent) && ENDGRENT_R_PROTO == REENTRANT_PROTO_I_H
625# define endgrent() (((errno = endgrent_r(&PL_reentrant_buffer->_getgrent_fptr))) == 0 ? 1 : 0)
626# endif
627# if !defined(endgrent) && ENDGRENT_R_PROTO == REENTRANT_PROTO_V_H
628# define endgrent() endgrent_r(&PL_reentrant_buffer->_getgrent_fptr)
629# endif
630#endif /* HAS_ENDGRENT_R */
631
632#ifdef HAS_ENDHOSTENT_R
633# undef endhostent
634# if !defined(endhostent) && ENDHOSTENT_R_PROTO == REENTRANT_PROTO_I_S
635# define endhostent() (((errno = endhostent_r(&PL_reentrant_buffer->_gethostent_struct))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
636# endif
637# if !defined(endhostent) && ENDHOSTENT_R_PROTO == REENTRANT_PROTO_V_S
638# define endhostent() endhostent_r(&PL_reentrant_buffer->_gethostent_struct)
639# endif
640#endif /* HAS_ENDHOSTENT_R */
641
642#ifdef HAS_ENDNETENT_R
643# undef endnetent
644# if !defined(endnetent) && ENDNETENT_R_PROTO == REENTRANT_PROTO_I_S
645# define endnetent() (((errno = endnetent_r(&PL_reentrant_buffer->_getnetent_struct))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
646# endif
647# if !defined(endnetent) && ENDNETENT_R_PROTO == REENTRANT_PROTO_V_S
648# define endnetent() endnetent_r(&PL_reentrant_buffer->_getnetent_struct)
649# endif
650#endif /* HAS_ENDNETENT_R */
651
652#ifdef HAS_ENDPROTOENT_R
653# undef endprotoent
654# if !defined(endprotoent) && ENDPROTOENT_R_PROTO == REENTRANT_PROTO_I_S
655# define endprotoent() (((errno = endprotoent_r(&PL_reentrant_buffer->_getprotoent_struct))) == 0 ? &PL_reentrant_buffer->_getprotoent_struct : 0)
656# endif
657# if !defined(endprotoent) && ENDPROTOENT_R_PROTO == REENTRANT_PROTO_V_S
658# define endprotoent() endprotoent_r(&PL_reentrant_buffer->_getprotoent_struct)
659# endif
660#endif /* HAS_ENDPROTOENT_R */
661
662#ifdef HAS_ENDPWENT_R
663# undef endpwent
664# if !defined(endpwent) && ENDPWENT_R_PROTO == REENTRANT_PROTO_I_H
665# define endpwent() (((errno = endpwent_r(&PL_reentrant_buffer->_getpwent_fptr))) == 0 ? 1 : 0)
666# endif
667# if !defined(endpwent) && ENDPWENT_R_PROTO == REENTRANT_PROTO_V_H
668# define endpwent() endpwent_r(&PL_reentrant_buffer->_getpwent_fptr)
669# endif
670#endif /* HAS_ENDPWENT_R */
671
672#ifdef HAS_ENDSERVENT_R
673# undef endservent
674# if !defined(endservent) && ENDSERVENT_R_PROTO == REENTRANT_PROTO_I_S
675# define endservent() (((errno = endservent_r(&PL_reentrant_buffer->_getservent_struct))) == 0 ? &PL_reentrant_buffer->_getservent_struct : 0)
676# endif
677# if !defined(endservent) && ENDSERVENT_R_PROTO == REENTRANT_PROTO_V_S
678# define endservent() endservent_r(&PL_reentrant_buffer->_getservent_struct)
679# endif
680#endif /* HAS_ENDSERVENT_R */
681
682#ifdef HAS_GETGRENT_R
683# undef getgrent
684# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR
685# define getgrent() (((errno = getgrent_r(&PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_ptr))) == 0 ? PL_reentrant_buffer->_getgrent_ptr : 0)
686# endif
687# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR
688# define getgrent() (((errno = getgrent_r(&PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_ptr))) == 0 ? PL_reentrant_buffer->_getgrent_ptr : 0)
689# endif
690# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBW
691# define getgrent() (getgrent_r(&PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size) ? &PL_reentrant_buffer->_getgrent_struct : 0)
692# endif
693# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBI
694# define getgrent() (getgrent_r(&PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size) ? &PL_reentrant_buffer->_getgrent_struct : 0)
695# endif
696# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBI
697# define getgrent() (((errno = getgrent_r(&PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size))) == 0 ? &PL_reentrant_buffer->_getgrent_struct : 0)
698# endif
699# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH
700# define getgrent() (((errno = getgrent_r(&PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_fptr))) == 0 ? &PL_reentrant_buffer->_getgrent_struct : 0)
701# endif
702#endif /* HAS_GETGRENT_R */
703
704#ifdef HAS_GETGRGID_R
705# undef getgrgid
706# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR
707# define getgrgid(a) (((errno = getgrgid_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_ptr))) == 0 ? PL_reentrant_buffer->_getgrent_ptr : 0)
708# endif
709# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR
710# define getgrgid(a) (((errno = getgrgid_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_ptr))) == 0 ? PL_reentrant_buffer->_getgrent_ptr : 0)
711# endif
712# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBI
713# define getgrgid(a) (((errno = getgrgid_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size))) == 0 ? &PL_reentrant_buffer->_getgrent_struct : 0)
714# endif
715# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_S_TSBI
716# define getgrgid(a) (getgrgid_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size) ? &PL_reentrant_buffer->_getgrent_struct : 0)
717# endif
718#endif /* HAS_GETGRGID_R */
719
720#ifdef HAS_GETGRNAM_R
721# undef getgrnam
722# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR
723# define getgrnam(a) (((errno = getgrnam_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_ptr))) == 0 ? PL_reentrant_buffer->_getgrent_ptr : 0)
724# endif
725# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR
726# define getgrnam(a) (((errno = getgrnam_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size, &PL_reentrant_buffer->_getgrent_ptr))) == 0 ? PL_reentrant_buffer->_getgrent_ptr : 0)
727# endif
728# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CBI
729# define getgrnam(a) (getgrnam_r(a, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size) ? PL_reentrant_buffer->_getgrent_buffer : 0)
730# endif
731# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBI
732# define getgrnam(a) (((errno = getgrnam_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size))) == 0 ? &PL_reentrant_buffer->_getgrent_struct : 0)
733# endif
734# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CSBI
735# define getgrnam(a) (getgrnam_r(a, &PL_reentrant_buffer->_getgrent_struct, PL_reentrant_buffer->_getgrent_buffer, PL_reentrant_buffer->_getgrent_size) ? &PL_reentrant_buffer->_getgrent_struct : 0)
736# endif
737#endif /* HAS_GETGRNAM_R */
738
739#ifdef HAS_GETHOSTBYADDR_R
740# undef gethostbyaddr
741# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE
742# define gethostbyaddr(a, b, c) (((errno = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_ptr, &PL_reentrant_buffer->_gethostent_errno))) == 0 ? PL_reentrant_buffer->_gethostent_ptr : 0)
743# endif
744# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE
745# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? &PL_reentrant_buffer->_gethostent_struct : 0)
746# endif
747# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE
748# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? &PL_reentrant_buffer->_gethostent_struct : 0)
749# endif
750# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE
751# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? &PL_reentrant_buffer->_gethostent_struct : 0)
752# endif
753# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE
754# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? &PL_reentrant_buffer->_gethostent_struct : 0)
755# endif
756# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE
757# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? 1 : 0)
758# endif
759# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE
760# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? 1 : 0)
761# endif
762# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISD
763# define gethostbyaddr(a, b, c) (((errno = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, &PL_reentrant_buffer->_gethostent_data))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
764# endif
765# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CIISD
766# define gethostbyaddr(a, b, c) (((errno = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_gethostent_struct, &PL_reentrant_buffer->_gethostent_data))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
767# endif
768# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CII
769# define gethostbyaddr(a, b, c) (((errno = gethostbyaddr_r(a, b, c))) == 0 ? 1 : 0)
770# endif
771#endif /* HAS_GETHOSTBYADDR_R */
772
773#ifdef HAS_GETHOSTBYNAME_R
774# undef gethostbyname
775# if !defined(gethostbyname) && GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE
776# define gethostbyname(a) (((errno = gethostbyname_r(a, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_ptr, &PL_reentrant_buffer->_gethostent_errno))) == 0 ? PL_reentrant_buffer->_gethostent_ptr : 0)
777# endif
778# if !defined(gethostbyname) && GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE
779# define gethostbyname(a) (gethostbyname_r(a, &PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? &PL_reentrant_buffer->_gethostent_struct : 0)
780# endif
781# if !defined(gethostbyname) && GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
782# define gethostbyname(a) (((errno = gethostbyname_r(a, &PL_reentrant_buffer->_gethostent_struct, &PL_reentrant_buffer->_gethostent_data))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
783# endif
784#endif /* HAS_GETHOSTBYNAME_R */
785
786#ifdef HAS_GETHOSTENT_R
787# undef gethostent
788# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE
789# define gethostent() (((errno = gethostent_r(&PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_ptr, &PL_reentrant_buffer->_gethostent_errno))) == 0 ? PL_reentrant_buffer->_gethostent_ptr : 0)
790# endif
791# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE
792# define gethostent() (((errno = gethostent_r(&PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
793# endif
794# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE
795# define gethostent() (gethostent_r(&PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size, &PL_reentrant_buffer->_gethostent_errno) ? &PL_reentrant_buffer->_gethostent_struct : 0)
796# endif
797# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBI
798# define gethostent() (gethostent_r(&PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size) ? &PL_reentrant_buffer->_gethostent_struct : 0)
799# endif
800# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBI
801# define gethostent() (((errno = gethostent_r(&PL_reentrant_buffer->_gethostent_struct, PL_reentrant_buffer->_gethostent_buffer, PL_reentrant_buffer->_gethostent_size))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
802# endif
803# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SD
804# define gethostent() (((errno = gethostent_r(&PL_reentrant_buffer->_gethostent_struct, &PL_reentrant_buffer->_gethostent_data))) == 0 ? &PL_reentrant_buffer->_gethostent_struct : 0)
805# endif
806#endif /* HAS_GETHOSTENT_R */
807
808#ifdef HAS_GETLOGIN_R
809# undef getlogin
810# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_I_BW
811# define getlogin() (((errno = getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size))) == 0 ? PL_reentrant_buffer->_getlogin_buffer : 0)
812# endif
813# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_I_BI
814# define getlogin() (((errno = getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size))) == 0 ? PL_reentrant_buffer->_getlogin_buffer : 0)
815# endif
816# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_B_BW
817# define getlogin() getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size)
818# endif
819# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_B_BI
820# define getlogin() getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size)
821# endif
822#endif /* HAS_GETLOGIN_R */
823
824#ifdef HAS_GETNETBYADDR_R
825# undef getnetbyaddr
826# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE
827# define getnetbyaddr(a, b) (((errno = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size, &PL_reentrant_buffer->_getnetent_ptr, &PL_reentrant_buffer->_getnetent_errno))) == 0 ? PL_reentrant_buffer->_getnetent_ptr : 0)
828# endif
829# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_LISBI
830# define getnetbyaddr(a, b) (((errno = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
831# endif
832# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_TISBI
833# define getnetbyaddr(a, b) (getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size) ? &PL_reentrant_buffer->_getnetent_struct : 0)
834# endif
835# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_LISBI
836# define getnetbyaddr(a, b) (getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size) ? &PL_reentrant_buffer->_getnetent_struct : 0)
837# endif
838# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_TISD
839# define getnetbyaddr(a, b) (((errno = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, &PL_reentrant_buffer->_getnetent_data))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
840# endif
841# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_LISD
842# define getnetbyaddr(a, b) (((errno = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, &PL_reentrant_buffer->_getnetent_data))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
843# endif
844# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_IISD
845# define getnetbyaddr(a, b) (((errno = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_getnetent_struct, &PL_reentrant_buffer->_getnetent_data))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
846# endif
847#endif /* HAS_GETNETBYADDR_R */
848
849#ifdef HAS_GETNETBYNAME_R
850# undef getnetbyname
851# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE
852# define getnetbyname(a) (((errno = getnetbyname_r(a, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size, &PL_reentrant_buffer->_getnetent_ptr, &PL_reentrant_buffer->_getnetent_errno))) == 0 ? PL_reentrant_buffer->_getnetent_ptr : 0)
853# endif
854# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBI
855# define getnetbyname(a) (((errno = getnetbyname_r(a, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
856# endif
857# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI
858# define getnetbyname(a) (getnetbyname_r(a, &PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size) ? &PL_reentrant_buffer->_getnetent_struct : 0)
859# endif
860# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
861# define getnetbyname(a) (((errno = getnetbyname_r(a, &PL_reentrant_buffer->_getnetent_struct, &PL_reentrant_buffer->_getnetent_data))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
862# endif
863#endif /* HAS_GETNETBYNAME_R */
864
865#ifdef HAS_GETNETENT_R
866# undef getnetent
867# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE
868# define getnetent() (((errno = getnetent_r(&PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size, &PL_reentrant_buffer->_getnetent_ptr, &PL_reentrant_buffer->_getnetent_errno))) == 0 ? PL_reentrant_buffer->_getnetent_ptr : 0)
869# endif
870# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE
871# define getnetent() (((errno = getnetent_r(&PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size, &PL_reentrant_buffer->_getnetent_errno))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
872# endif
873# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE
874# define getnetent() (getnetent_r(&PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size, &PL_reentrant_buffer->_getnetent_errno) ? &PL_reentrant_buffer->_getnetent_struct : 0)
875# endif
876# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBI
877# define getnetent() (getnetent_r(&PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size) ? &PL_reentrant_buffer->_getnetent_struct : 0)
878# endif
879# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBI
880# define getnetent() (((errno = getnetent_r(&PL_reentrant_buffer->_getnetent_struct, PL_reentrant_buffer->_getnetent_buffer, PL_reentrant_buffer->_getnetent_size))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
881# endif
882# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SD
883# define getnetent() (((errno = getnetent_r(&PL_reentrant_buffer->_getnetent_struct, &PL_reentrant_buffer->_getnetent_data))) == 0 ? &PL_reentrant_buffer->_getnetent_struct : 0)
884# endif
885#endif /* HAS_GETNETENT_R */
886
887#ifdef HAS_GETPROTOBYNAME_R
888# undef getprotobyname
889# if !defined(getprotobyname) && GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR
890# define getprotobyname(a) (((errno = getprotobyname_r(a, &PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size, &PL_reentrant_buffer->_getprotoent_ptr))) == 0 ? PL_reentrant_buffer->_getprotoent_ptr : 0)
891# endif
892# if !defined(getprotobyname) && GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI
893# define getprotobyname(a) (getprotobyname_r(a, &PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size) ? &PL_reentrant_buffer->_getprotoent_struct : 0)
894# endif
895# if !defined(getprotobyname) && GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
896# define getprotobyname(a) (((errno = getprotobyname_r(a, &PL_reentrant_buffer->_getprotoent_struct, &PL_reentrant_buffer->_getprotoent_data))) == 0 ? &PL_reentrant_buffer->_getprotoent_struct : 0)
897# endif
898#endif /* HAS_GETPROTOBYNAME_R */
899
900#ifdef HAS_GETPROTOBYNUMBER_R
901# undef getprotobynumber
902# if !defined(getprotobynumber) && GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR
903# define getprotobynumber(a) (((errno = getprotobynumber_r(a, &PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size, &PL_reentrant_buffer->_getprotoent_ptr))) == 0 ? PL_reentrant_buffer->_getprotoent_ptr : 0)
904# endif
905# if !defined(getprotobynumber) && GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_S_ISBI
906# define getprotobynumber(a) (getprotobynumber_r(a, &PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size) ? &PL_reentrant_buffer->_getprotoent_struct : 0)
907# endif
908# if !defined(getprotobynumber) && GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISD
909# define getprotobynumber(a) (((errno = getprotobynumber_r(a, &PL_reentrant_buffer->_getprotoent_struct, &PL_reentrant_buffer->_getprotoent_data))) == 0 ? &PL_reentrant_buffer->_getprotoent_struct : 0)
910# endif
911#endif /* HAS_GETPROTOBYNUMBER_R */
912
913#ifdef HAS_GETPROTOENT_R
914# undef getprotoent
915# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR
916# define getprotoent() (((errno = getprotoent_r(&PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size, &PL_reentrant_buffer->_getprotoent_ptr))) == 0 ? PL_reentrant_buffer->_getprotoent_ptr : 0)
917# endif
918# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBI
919# define getprotoent() (((errno = getprotoent_r(&PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size))) == 0 ? &PL_reentrant_buffer->_getprotoent_struct : 0)
920# endif
921# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_S_SBI
922# define getprotoent() (getprotoent_r(&PL_reentrant_buffer->_getprotoent_struct, PL_reentrant_buffer->_getprotoent_buffer, PL_reentrant_buffer->_getprotoent_size) ? &PL_reentrant_buffer->_getprotoent_struct : 0)
923# endif
924# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SD
925# define getprotoent() (((errno = getprotoent_r(&PL_reentrant_buffer->_getprotoent_struct, &PL_reentrant_buffer->_getprotoent_data))) == 0 ? &PL_reentrant_buffer->_getprotoent_struct : 0)
926# endif
927#endif /* HAS_GETPROTOENT_R */
928
929#ifdef HAS_GETPWENT_R
930# undef getpwent
931# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR
932# define getpwent() (((errno = getpwent_r(&PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_ptr))) == 0 ? PL_reentrant_buffer->_getpwent_ptr : 0)
933# endif
934# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR
935# define getpwent() (((errno = getpwent_r(&PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_ptr))) == 0 ? PL_reentrant_buffer->_getpwent_ptr : 0)
936# endif
937# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBW
938# define getpwent() (getpwent_r(&PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size) ? &PL_reentrant_buffer->_getpwent_struct : 0)
939# endif
940# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBI
941# define getpwent() (getpwent_r(&PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size) ? &PL_reentrant_buffer->_getpwent_struct : 0)
942# endif
943# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBI
944# define getpwent() (((errno = getpwent_r(&PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size))) == 0 ? &PL_reentrant_buffer->_getpwent_struct : 0)
945# endif
946# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH
947# define getpwent() (((errno = getpwent_r(&PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_fptr))) == 0 ? &PL_reentrant_buffer->_getpwent_struct : 0)
948# endif
949#endif /* HAS_GETPWENT_R */
950
951#ifdef HAS_GETPWNAM_R
952# undef getpwnam
953# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR
954# define getpwnam(a) (((errno = getpwnam_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_ptr))) == 0 ? PL_reentrant_buffer->_getpwent_ptr : 0)
955# endif
956# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR
957# define getpwnam(a) (((errno = getpwnam_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_ptr))) == 0 ? PL_reentrant_buffer->_getpwent_ptr : 0)
958# endif
959# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_S_CSBI
960# define getpwnam(a) (getpwnam_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size) ? &PL_reentrant_buffer->_getpwent_struct : 0)
961# endif
962# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBI
963# define getpwnam(a) (((errno = getpwnam_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size))) == 0 ? &PL_reentrant_buffer->_getpwent_struct : 0)
964# endif
965#endif /* HAS_GETPWNAM_R */
966
967#ifdef HAS_GETPWUID_R
968# undef getpwuid
969# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBWR
970# define getpwuid(a) (((errno = getpwuid_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_ptr))) == 0 ? PL_reentrant_buffer->_getpwent_ptr : 0)
971# endif
972# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBIR
973# define getpwuid(a) (((errno = getpwuid_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size, &PL_reentrant_buffer->_getpwent_ptr))) == 0 ? PL_reentrant_buffer->_getpwent_ptr : 0)
974# endif
975# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBI
976# define getpwuid(a) (((errno = getpwuid_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size))) == 0 ? &PL_reentrant_buffer->_getpwent_struct : 0)
977# endif
978# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_S_TSBI
979# define getpwuid(a) (getpwuid_r(a, &PL_reentrant_buffer->_getpwent_struct, PL_reentrant_buffer->_getpwent_buffer, PL_reentrant_buffer->_getpwent_size) ? &PL_reentrant_buffer->_getpwent_struct : 0)
980# endif
981#endif /* HAS_GETPWUID_R */
982
983#ifdef HAS_GETSERVBYNAME_R
984# undef getservbyname
985# if !defined(getservbyname) && GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR
986# define getservbyname(a, b) (((errno = getservbyname_r(a, b, &PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size, &PL_reentrant_buffer->_getservent_ptr))) == 0 ? PL_reentrant_buffer->_getservent_ptr : 0)
987# endif
988# if !defined(getservbyname) && GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_S_CCSBI
989# define getservbyname(a, b) (getservbyname_r(a, b, &PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size) ? &PL_reentrant_buffer->_getservent_struct : 0)
990# endif
991# if !defined(getservbyname) && GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSD
992# define getservbyname(a, b) (((errno = getservbyname_r(a, b, &PL_reentrant_buffer->_getservent_struct, &PL_reentrant_buffer->_getservent_data))) == 0 ? &PL_reentrant_buffer->_getservent_struct : 0)
993# endif
994#endif /* HAS_GETSERVBYNAME_R */
995
996#ifdef HAS_GETSERVBYPORT_R
997# undef getservbyport
998# if !defined(getservbyport) && GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR
999# define getservbyport(a, b) (((errno = getservbyport_r(a, b, &PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size, &PL_reentrant_buffer->_getservent_ptr))) == 0 ? PL_reentrant_buffer->_getservent_ptr : 0)
1000# endif
1001# if !defined(getservbyport) && GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_S_ICSBI
1002# define getservbyport(a, b) (getservbyport_r(a, b, &PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size) ? &PL_reentrant_buffer->_getservent_struct : 0)
1003# endif
1004# if !defined(getservbyport) && GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSD
1005# define getservbyport(a, b) (((errno = getservbyport_r(a, b, &PL_reentrant_buffer->_getservent_struct, &PL_reentrant_buffer->_getservent_data))) == 0 ? &PL_reentrant_buffer->_getservent_struct : 0)
1006# endif
1007#endif /* HAS_GETSERVBYPORT_R */
1008
1009#ifdef HAS_GETSERVENT_R
1010# undef getservent
1011# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR
1012# define getservent() (((errno = getservent_r(&PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size, &PL_reentrant_buffer->_getservent_ptr))) == 0 ? PL_reentrant_buffer->_getservent_ptr : 0)
1013# endif
1014# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBI
1015# define getservent() (((errno = getservent_r(&PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size))) == 0 ? &PL_reentrant_buffer->_getservent_struct : 0)
1016# endif
1017# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_S_SBI
1018# define getservent() (getservent_r(&PL_reentrant_buffer->_getservent_struct, PL_reentrant_buffer->_getservent_buffer, PL_reentrant_buffer->_getservent_size) ? &PL_reentrant_buffer->_getservent_struct : 0)
1019# endif
1020# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SD
1021# define getservent() (((errno = getservent_r(&PL_reentrant_buffer->_getservent_struct, &PL_reentrant_buffer->_getservent_data))) == 0 ? &PL_reentrant_buffer->_getservent_struct : 0)
1022# endif
1023#endif /* HAS_GETSERVENT_R */
1024
1025#ifdef HAS_GETSPNAM_R
1026# undef getspnam
1027# if !defined(getspnam) && GETSPNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR
1028# define getspnam(a) (((errno = getspnam_r(a, &PL_reentrant_buffer->_getspent_struct, PL_reentrant_buffer->_getspent_buffer, PL_reentrant_buffer->_getspent_size, &PL_reentrant_buffer->_getspent_ptr))) == 0 ? PL_reentrant_buffer->_getspent_ptr : 0)
1029# endif
1030# if !defined(getspnam) && GETSPNAM_R_PROTO == REENTRANT_PROTO_S_CSBI
1031# define getspnam(a) (getspnam_r(a, &PL_reentrant_buffer->_getspent_struct, PL_reentrant_buffer->_getspent_buffer, PL_reentrant_buffer->_getspent_size) ? &PL_reentrant_buffer->_getspent_struct : 0)
1032# endif
1033#endif /* HAS_GETSPNAM_R */
1034
1035#ifdef HAS_GMTIME_R
1036# undef gmtime
1037# if !defined(gmtime) && GMTIME_R_PROTO == REENTRANT_PROTO_S_TS
1038# define gmtime(a) (gmtime_r(a, &PL_reentrant_buffer->_gmtime_struct) ? &PL_reentrant_buffer->_gmtime_struct : 0)
1039# endif
1040# if !defined(gmtime) && GMTIME_R_PROTO == REENTRANT_PROTO_I_TS
1041# define gmtime(a) (((errno = gmtime_r(a, &PL_reentrant_buffer->_gmtime_struct))) == 0 ? &PL_reentrant_buffer->_gmtime_struct : 0)
1042# endif
1043#endif /* HAS_GMTIME_R */
1044
1045#ifdef HAS_LOCALTIME_R
1046# undef localtime
1047# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS
1048# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0)
1049# endif
1050# if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_I_TS
1051# define localtime(a) (((errno = localtime_r(a, &PL_reentrant_buffer->_localtime_struct))) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0)
1052# endif
1053#endif /* HAS_LOCALTIME_R */
1054
1055#ifdef HAS_RANDOM_R
1056# undef random
1057# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_TS
1058# define random() (((errno = random_r(T, &PL_reentrant_buffer->_random_struct))) == 0 ? &PL_reentrant_buffer->_random_struct : 0)
1059# endif
1060#endif /* HAS_RANDOM_R */
1061
1062#ifdef HAS_READDIR_R
1063# undef readdir
1064# if !defined(readdir) && READDIR_R_PROTO == REENTRANT_PROTO_I_TSR
1065# define readdir(a) (((errno = readdir_r(a, PL_reentrant_buffer->_readdir_struct, &PL_reentrant_buffer->_readdir_ptr))) == 0 ? PL_reentrant_buffer->_readdir_ptr : 0)
1066# endif
1067# if !defined(readdir) && READDIR_R_PROTO == REENTRANT_PROTO_I_TS
1068# define readdir(a) (((errno = readdir_r(a, PL_reentrant_buffer->_readdir_struct))) == 0 ? PL_reentrant_buffer->_readdir_struct : 0)
1069# endif
1070#endif /* HAS_READDIR_R */
1071
1072#ifdef HAS_READDIR64_R
1073# undef readdir64
1074# if !defined(readdir64) && READDIR64_R_PROTO == REENTRANT_PROTO_I_TSR
1075# define readdir64(a) (((errno = readdir64_r(a, PL_reentrant_buffer->_readdir64_struct, &PL_reentrant_buffer->_readdir64_ptr))) == 0 ? PL_reentrant_buffer->_readdir64_ptr : 0)
1076# endif
1077# if !defined(readdir64) && READDIR64_R_PROTO == REENTRANT_PROTO_I_TS
1078# define readdir64(a) (((errno = readdir64_r(a, PL_reentrant_buffer->_readdir64_struct))) == 0 ? PL_reentrant_buffer->_readdir64_struct : 0)
1079# endif
1080#endif /* HAS_READDIR64_R */
1081
1082#ifdef HAS_SETGRENT_R
1083# undef setgrent
1084# if !defined(setgrent) && SETGRENT_R_PROTO == REENTRANT_PROTO_I_H
1085# define setgrent() (((errno = setgrent_r(&PL_reentrant_buffer->_getgrent_fptr))) == 0 ? 1 : 0)
1086# endif
1087# if !defined(setgrent) && SETGRENT_R_PROTO == REENTRANT_PROTO_V_H
1088# define setgrent() setgrent_r(&PL_reentrant_buffer->_getgrent_fptr)
1089# endif
1090#endif /* HAS_SETGRENT_R */
1091
1092#ifdef HAS_SETHOSTENT_R
1093# undef sethostent
1094# if !defined(sethostent) && SETHOSTENT_R_PROTO == REENTRANT_PROTO_I_ID
1095# define sethostent(a) (((errno = sethostent_r(a, &PL_reentrant_buffer->_gethostent_data))) == 0 ? 1 : 0)
1096# endif
1097# if !defined(sethostent) && SETHOSTENT_R_PROTO == REENTRANT_PROTO_V_ID
1098# define sethostent(a) sethostent_r(a, &PL_reentrant_buffer->_gethostent_data)
1099# endif
1100#endif /* HAS_SETHOSTENT_R */
1101
1102#ifdef HAS_SETLOCALE_R
1103# undef setlocale
1104# if !defined(setlocale) && SETLOCALE_R_PROTO == REENTRANT_PROTO_I_ICBI
1105# define setlocale(a, b) (((errno = setlocale_r(a, b, PL_reentrant_buffer->_setlocale_buffer, PL_reentrant_buffer->_setlocale_size))) == 0 ? PL_reentrant_buffer->_setlocale_buffer : 0)
1106# endif
1107#endif /* HAS_SETLOCALE_R */
1108
1109#ifdef HAS_SETNETENT_R
1110# undef setnetent
1111# if !defined(setnetent) && SETNETENT_R_PROTO == REENTRANT_PROTO_I_ID
1112# define setnetent(a) (((errno = setnetent_r(a, &PL_reentrant_buffer->_getnetent_data))) == 0 ? 1 : 0)
1113# endif
1114# if !defined(setnetent) && SETNETENT_R_PROTO == REENTRANT_PROTO_V_ID
1115# define setnetent(a) setnetent_r(a, &PL_reentrant_buffer->_getnetent_data)
1116# endif
1117#endif /* HAS_SETNETENT_R */
1118
1119#ifdef HAS_SETPROTOENT_R
1120# undef setprotoent
1121# if !defined(setprotoent) && SETPROTOENT_R_PROTO == REENTRANT_PROTO_I_ID
1122# define setprotoent(a) (((errno = setprotoent_r(a, &PL_reentrant_buffer->_getprotoent_data))) == 0 ? 1 : 0)
1123# endif
1124# if !defined(setprotoent) && SETPROTOENT_R_PROTO == REENTRANT_PROTO_V_ID
1125# define setprotoent(a) setprotoent_r(a, &PL_reentrant_buffer->_getprotoent_data)
1126# endif
1127#endif /* HAS_SETPROTOENT_R */
1128
1129#ifdef HAS_SETPWENT_R
1130# undef setpwent
1131# if !defined(setpwent) && SETPWENT_R_PROTO == REENTRANT_PROTO_I_H
1132# define setpwent() (((errno = setpwent_r(&PL_reentrant_buffer->_getpwent_fptr))) == 0 ? 1 : 0)
1133# endif
1134# if !defined(setpwent) && SETPWENT_R_PROTO == REENTRANT_PROTO_V_H
1135# define setpwent() setpwent_r(&PL_reentrant_buffer->_getpwent_fptr)
1136# endif
1137#endif /* HAS_SETPWENT_R */
1138
1139#ifdef HAS_SETSERVENT_R
1140# undef setservent
1141# if !defined(setservent) && SETSERVENT_R_PROTO == REENTRANT_PROTO_I_ID
1142# define setservent(a) (((errno = setservent_r(a, &PL_reentrant_buffer->_getservent_data))) == 0 ? 1 : 0)
1143# endif
1144# if !defined(setservent) && SETSERVENT_R_PROTO == REENTRANT_PROTO_V_ID
1145# define setservent(a) setservent_r(a, &PL_reentrant_buffer->_getservent_data)
1146# endif
1147#endif /* HAS_SETSERVENT_R */
1148
1149#ifdef HAS_SRAND48_R
1150# undef srand48
1151# if !defined(srand48) && SRAND48_R_PROTO == REENTRANT_PROTO_I_LS
1152# define srand48(a) (((errno = srand48_r(a, &PL_reentrant_buffer->_drand48_struct))) == 0 ? &PL_reentrant_buffer->_drand48_struct : 0)
1153# endif
1154#endif /* HAS_SRAND48_R */
1155
1156#ifdef HAS_SRANDOM_R
1157# undef srandom
1158# if !defined(srandom) && SRANDOM_R_PROTO == REENTRANT_PROTO_I_TS
1159# define srandom(a) (((errno = srandom_r(a, &PL_reentrant_buffer->_srandom_struct))) == 0 ? &PL_reentrant_buffer->_srandom_struct : 0)
1160# endif
1161#endif /* HAS_SRANDOM_R */
1162
1163#ifdef HAS_STRERROR_R
1164# undef strerror
1165# if !defined(strerror) && STRERROR_R_PROTO == REENTRANT_PROTO_I_IBW
1166# define strerror(a) (((errno = strerror_r(a, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size))) == 0 ? PL_reentrant_buffer->_strerror_buffer : 0)
1167# endif
1168# if !defined(strerror) && STRERROR_R_PROTO == REENTRANT_PROTO_I_IBI
1169# define strerror(a) (((errno = strerror_r(a, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size))) == 0 ? PL_reentrant_buffer->_strerror_buffer : 0)
1170# endif
1171# if !defined(strerror) && STRERROR_R_PROTO == REENTRANT_PROTO_B_IBW
1172# define strerror(a) strerror_r(a, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size)
1173# endif
1174#endif /* HAS_STRERROR_R */
1175
1176#ifdef HAS_TMPNAM_R
1177# undef tmpnam
1178# if !defined(tmpnam) && TMPNAM_R_PROTO == REENTRANT_PROTO_B_B
1179# define tmpnam(a) tmpnam_r(a)
1180# endif
1181#endif /* HAS_TMPNAM_R */
1182
1183#ifdef HAS_TTYNAME_R
1184# undef ttyname
1185# if !defined(ttyname) && TTYNAME_R_PROTO == REENTRANT_PROTO_I_IBW
1186# define ttyname(a) (((errno = ttyname_r(a, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size))) == 0 ? PL_reentrant_buffer->_ttyname_buffer : 0)
1187# endif
1188# if !defined(ttyname) && TTYNAME_R_PROTO == REENTRANT_PROTO_I_IBI
1189# define ttyname(a) (((errno = ttyname_r(a, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size))) == 0 ? PL_reentrant_buffer->_ttyname_buffer : 0)
1190# endif
1191# if !defined(ttyname) && TTYNAME_R_PROTO == REENTRANT_PROTO_B_IBI
1192# define ttyname(a) ttyname_r(a, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size)
1193# endif
1194#endif /* HAS_TTYNAME_R */
1195
1196
1197#endif /* USE_REENTRANT_API */
1198
1199#endif
1200