Commit | Line | Data |
6dead956 |
1 | #ifdef WIN32 |
2 | #define _POSIX_ |
3 | #endif |
463ee0b2 |
4 | #include "EXTERN.h" |
760ac839 |
5 | #define PERLIO_NOT_STDIO 1 |
463ee0b2 |
6 | #include "perl.h" |
7 | #include "XSUB.h" |
2304df62 |
8 | #include <ctype.h> |
a0d0e21e |
9 | #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */ |
2304df62 |
10 | #include <dirent.h> |
a0d0e21e |
11 | #endif |
2304df62 |
12 | #include <errno.h> |
2304df62 |
13 | #ifdef I_FLOAT |
14 | #include <float.h> |
15 | #endif |
a0d0e21e |
16 | #ifdef I_LIMITS |
2304df62 |
17 | #include <limits.h> |
a0d0e21e |
18 | #endif |
2304df62 |
19 | #include <locale.h> |
20 | #include <math.h> |
85e6fe83 |
21 | #ifdef I_PWD |
2304df62 |
22 | #include <pwd.h> |
85e6fe83 |
23 | #endif |
2304df62 |
24 | #include <setjmp.h> |
25 | #include <signal.h> |
26 | #ifdef I_STDARG |
27 | #include <stdarg.h> |
28 | #endif |
29 | #ifdef I_STDDEF |
30 | #include <stddef.h> |
31 | #endif |
a0d0e21e |
32 | /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to |
33 | metaconfig for future extension writers. We don't use them in POSIX. |
34 | (This is really sneaky :-) --AD |
35 | */ |
36 | #if defined(I_TERMIOS) |
37 | #include <termios.h> |
38 | #endif |
a0d0e21e |
39 | #ifdef I_STDLIB |
2304df62 |
40 | #include <stdlib.h> |
a0d0e21e |
41 | #endif |
2304df62 |
42 | #include <string.h> |
43 | #include <sys/stat.h> |
2304df62 |
44 | #include <sys/types.h> |
2304df62 |
45 | #include <time.h> |
6dead956 |
46 | #ifdef I_UNISTD |
5f6761f9 |
47 | #include <unistd.h> /* see hints/sunos_4_1.sh */ |
6dead956 |
48 | #endif |
71be2cbc |
49 | #include <fcntl.h> |
50 | |
6c418a22 |
51 | #if defined(__VMS) && !defined(__POSIX_SOURCE) |
6c418a22 |
52 | # include <libdef.h> /* LIB$_INVARG constant */ |
53 | # include <lib$routines.h> /* prototype for lib$ediv() */ |
54 | # include <starlet.h> /* prototype for sys$gettim() */ |
774d564b |
55 | # if DECC_VERSION < 50000000 |
56 | # define pid_t int /* old versions of DECC miss this in types.h */ |
57 | # endif |
6c418a22 |
58 | |
59 | # undef mkfifo /* #defined in perl.h */ |
60 | # define mkfifo(a,b) (not_here("mkfifo"),-1) |
61 | # define tzset() not_here("tzset") |
62 | |
5f6761f9 |
63 | #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000) |
64 | # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */ |
65 | # include <utsname.h> |
5f6761f9 |
66 | # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */ |
6c418a22 |
67 | |
68 | /* The POSIX notion of ttyname() is better served by getname() under VMS */ |
69 | static char ttnambuf[64]; |
70 | # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL) |
71 | |
72 | /* The non-POSIX CRTL times() has void return type, so we just get the |
73 | current time directly */ |
74 | clock_t vms_times(struct tms *bufptr) { |
75 | clock_t retval; |
76 | /* Get wall time and convert to 10 ms intervals to |
77 | * produce the return value that the POSIX standard expects */ |
78 | # if defined(__DECC) && defined (__ALPHA) |
79 | # include <ints.h> |
80 | uint64 vmstime; |
81 | _ckvmssts(sys$gettim(&vmstime)); |
82 | vmstime /= 100000; |
83 | retval = vmstime & 0x7fffffff; |
84 | # else |
85 | /* (Older hw or ccs don't have an atomic 64-bit type, so we |
86 | * juggle 32-bit ints (and a float) to produce a time_t result |
87 | * with minimal loss of information.) */ |
88 | long int vmstime[2],remainder,divisor = 100000; |
89 | _ckvmssts(sys$gettim((unsigned long int *)vmstime)); |
90 | vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */ |
91 | _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder)); |
92 | # endif |
93 | /* Fill in the struct tms using the CRTL routine . . .*/ |
94 | times((tbuffer_t *)bufptr); |
95 | return (clock_t) retval; |
96 | } |
97 | # define times(t) vms_times(t) |
98 | #else |
6dead956 |
99 | #if defined (WIN32) |
100 | # undef mkfifo /* #defined in perl.h */ |
101 | # define mkfifo(a,b) not_here("mkfifo") |
102 | # define ttyname(a) not_here("ttyname") |
103 | # define sigset_t long |
104 | # define pid_t long |
105 | # ifdef __BORLANDC__ |
106 | # define tzname _tzname |
107 | # endif |
108 | # ifdef _MSC_VER |
109 | # define mode_t short |
110 | # endif |
111 | # define sigaction(a,b,c) not_here("sigaction") |
112 | # define sigpending(a) not_here("sigpending") |
113 | # define sigprocmask(a,b,c) not_here("sigprocmask") |
114 | # define sigsuspend(a) not_here("sigsuspend") |
115 | # define sigemptyset(a) not_here("sigemptyset") |
116 | # define sigaddset(a,b) not_here("sigaddset") |
117 | # define sigdelset(a,b) not_here("sigdelset") |
118 | # define sigfillset(a) not_here("sigfillset") |
119 | # define sigismember(a,b) not_here("sigismember") |
120 | #else |
6c418a22 |
121 | # include <grp.h> |
122 | # include <sys/times.h> |
123 | # ifdef HAS_UNAME |
124 | # include <sys/utsname.h> |
125 | # endif |
126 | # include <sys/wait.h> |
127 | # ifdef I_UTIME |
128 | # include <utime.h> |
129 | # endif |
6dead956 |
130 | #endif /* WIN32 */ |
131 | #endif /* __VMS */ |
2304df62 |
132 | |
133 | typedef int SysRet; |
a0d0e21e |
134 | typedef long SysRetLong; |
2304df62 |
135 | typedef sigset_t* POSIX__SigSet; |
136 | typedef HV* POSIX__SigAction; |
a0d0e21e |
137 | #ifdef I_TERMIOS |
138 | typedef struct termios* POSIX__Termios; |
139 | #else /* Define termios types to int, and call not_here for the functions.*/ |
140 | #define POSIX__Termios int |
141 | #define speed_t int |
142 | #define tcflag_t int |
143 | #define cc_t int |
144 | #define cfgetispeed(x) not_here("cfgetispeed") |
145 | #define cfgetospeed(x) not_here("cfgetospeed") |
146 | #define tcdrain(x) not_here("tcdrain") |
147 | #define tcflush(x,y) not_here("tcflush") |
148 | #define tcsendbreak(x,y) not_here("tcsendbreak") |
149 | #define cfsetispeed(x,y) not_here("cfsetispeed") |
150 | #define cfsetospeed(x,y) not_here("cfsetospeed") |
151 | #define ctermid(x) (char *) not_here("ctermid") |
152 | #define tcflow(x,y) not_here("tcflow") |
153 | #define tcgetattr(x,y) not_here("tcgetattr") |
154 | #define tcsetattr(x,y,z) not_here("tcsetattr") |
155 | #endif |
156 | |
157 | /* Possibly needed prototypes */ |
158 | char *cuserid _((char *)); |
a89d8a78 |
159 | double strtod _((const char *, char **)); |
160 | long strtol _((const char *, char **, int)); |
161 | unsigned long strtoul _((const char *, char **, int)); |
a0d0e21e |
162 | |
163 | #ifndef HAS_CUSERID |
164 | #define cuserid(a) (char *) not_here("cuserid") |
165 | #endif |
166 | #ifndef HAS_DIFFTIME |
167 | #ifndef difftime |
168 | #define difftime(a,b) not_here("difftime") |
169 | #endif |
170 | #endif |
171 | #ifndef HAS_FPATHCONF |
172 | #define fpathconf(f,n) (SysRetLong) not_here("fpathconf") |
173 | #endif |
174 | #ifndef HAS_MKTIME |
175 | #define mktime(a) not_here("mktime") |
8990e307 |
176 | #endif |
177 | #ifndef HAS_NICE |
178 | #define nice(a) not_here("nice") |
179 | #endif |
a0d0e21e |
180 | #ifndef HAS_PATHCONF |
181 | #define pathconf(f,n) (SysRetLong) not_here("pathconf") |
182 | #endif |
183 | #ifndef HAS_SYSCONF |
184 | #define sysconf(n) (SysRetLong) not_here("sysconf") |
185 | #endif |
8990e307 |
186 | #ifndef HAS_READLINK |
187 | #define readlink(a,b,c) not_here("readlink") |
188 | #endif |
189 | #ifndef HAS_SETPGID |
190 | #define setpgid(a,b) not_here("setpgid") |
191 | #endif |
8990e307 |
192 | #ifndef HAS_SETSID |
193 | #define setsid() not_here("setsid") |
194 | #endif |
a0d0e21e |
195 | #ifndef HAS_STRCOLL |
196 | #define strcoll(s1,s2) not_here("strcoll") |
197 | #endif |
a89d8a78 |
198 | #ifndef HAS_STRTOD |
199 | #define strtod(s1,s2) not_here("strtod") |
200 | #endif |
201 | #ifndef HAS_STRTOL |
202 | #define strtol(s1,s2,b) not_here("strtol") |
203 | #endif |
204 | #ifndef HAS_STRTOUL |
205 | #define strtoul(s1,s2,b) not_here("strtoul") |
206 | #endif |
a0d0e21e |
207 | #ifndef HAS_STRXFRM |
208 | #define strxfrm(s1,s2,n) not_here("strxfrm") |
8990e307 |
209 | #endif |
210 | #ifndef HAS_TCGETPGRP |
211 | #define tcgetpgrp(a) not_here("tcgetpgrp") |
212 | #endif |
213 | #ifndef HAS_TCSETPGRP |
214 | #define tcsetpgrp(a,b) not_here("tcsetpgrp") |
215 | #endif |
216 | #ifndef HAS_TIMES |
217 | #define times(a) not_here("times") |
218 | #endif |
219 | #ifndef HAS_UNAME |
220 | #define uname(a) not_here("uname") |
221 | #endif |
222 | #ifndef HAS_WAITPID |
223 | #define waitpid(a,b,c) not_here("waitpid") |
224 | #endif |
225 | |
a0d0e21e |
226 | #ifndef HAS_MBLEN |
227 | #ifndef mblen |
228 | #define mblen(a,b) not_here("mblen") |
229 | #endif |
230 | #endif |
231 | #ifndef HAS_MBSTOWCS |
232 | #define mbstowcs(s, pwcs, n) not_here("mbstowcs") |
233 | #endif |
234 | #ifndef HAS_MBTOWC |
235 | #define mbtowc(pwc, s, n) not_here("mbtowc") |
236 | #endif |
237 | #ifndef HAS_WCSTOMBS |
238 | #define wcstombs(s, pwcs, n) not_here("wcstombs") |
239 | #endif |
240 | #ifndef HAS_WCTOMB |
241 | #define wctomb(s, wchar) not_here("wcstombs") |
242 | #endif |
243 | #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB) |
244 | /* If we don't have these functions, then we wouldn't have gotten a typedef |
245 | for wchar_t, the wide character type. Defining wchar_t allows the |
246 | functions referencing it to compile. Its actual type is then meaningless, |
247 | since without the above functions, all sections using it end up calling |
248 | not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */ |
249 | #ifndef wchar_t |
250 | #define wchar_t char |
251 | #endif |
252 | #endif |
253 | |
254 | #ifndef HAS_LOCALECONV |
255 | #define localeconv() not_here("localeconv") |
256 | #endif |
257 | |
6dead956 |
258 | #ifndef WIN32 |
a0d0e21e |
259 | #ifdef HAS_TZNAME |
260 | extern char *tzname[]; |
261 | #else |
262 | char *tzname[] = { "" , "" }; |
263 | #endif |
6dead956 |
264 | #endif |
a0d0e21e |
265 | |
7747499c |
266 | /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX) |
267 | * fields for which we don't have Configure support yet: |
268 | * char *tm_zone; -- abbreviation of timezone name |
269 | * long tm_gmtoff; -- offset from GMT in seconds |
270 | * To workaround core dumps from the uninitialised tm_zone we get the |
271 | * system to give us a reasonable struct to copy. This fix means that |
272 | * strftime uses the tm_zone and tm_gmtoff values returned by |
273 | * localtime(time()). That should give the desired result most of the |
274 | * time. But probably not always! |
275 | * |
276 | * This is a temporary workaround to be removed once Configure |
277 | * support is added and NETaa14816 is considered in full. |
278 | * It does not address tzname aspects of NETaa14816. |
279 | */ |
dfe9444c |
280 | #ifdef HAS_GNULIBC |
281 | # ifndef STRUCT_TM_HASZONE |
282 | # define STRUCT_TM_HAS_ZONE |
283 | # endif |
284 | #endif |
285 | |
7747499c |
286 | #ifdef STRUCT_TM_HASZONE |
287 | static void |
288 | init_tm(ptm) /* see mktime, strftime and asctime */ |
289 | struct tm *ptm; |
290 | { |
291 | Time_t now; |
292 | (void)time(&now); |
293 | Copy(localtime(&now), ptm, 1, struct tm); |
294 | } |
295 | |
296 | #else |
297 | # define init_tm(ptm) |
298 | #endif |
299 | |
300 | |
dc45a647 |
301 | #ifdef HAS_LONG_DOUBLE |
302 | # if LONG_DOUBLESIZE > DOUBLESIZE |
303 | # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */ |
304 | # endif |
305 | #endif |
306 | |
307 | #ifndef HAS_LONG_DOUBLE |
a0d0e21e |
308 | #ifdef LDBL_MAX |
309 | #undef LDBL_MAX |
310 | #endif |
311 | #ifdef LDBL_MIN |
312 | #undef LDBL_MIN |
313 | #endif |
314 | #ifdef LDBL_EPSILON |
315 | #undef LDBL_EPSILON |
316 | #endif |
317 | #endif |
318 | |
8990e307 |
319 | static int |
f0f333f4 |
320 | not_here(char *s) |
8990e307 |
321 | { |
322 | croak("POSIX::%s not implemented on this architecture", s); |
323 | return -1; |
324 | } |
463ee0b2 |
325 | |
640cc986 |
326 | static |
327 | #ifdef HAS_LONG_DOUBLE |
328 | long double |
329 | #else |
330 | double |
331 | #endif |
f0f333f4 |
332 | constant(char *name, int arg) |
2304df62 |
333 | { |
334 | errno = 0; |
335 | switch (*name) { |
336 | case 'A': |
337 | if (strEQ(name, "ARG_MAX")) |
338 | #ifdef ARG_MAX |
339 | return ARG_MAX; |
340 | #else |
341 | goto not_there; |
342 | #endif |
343 | break; |
344 | case 'B': |
345 | if (strEQ(name, "BUFSIZ")) |
346 | #ifdef BUFSIZ |
347 | return BUFSIZ; |
348 | #else |
349 | goto not_there; |
350 | #endif |
351 | if (strEQ(name, "BRKINT")) |
352 | #ifdef BRKINT |
353 | return BRKINT; |
354 | #else |
355 | goto not_there; |
356 | #endif |
357 | if (strEQ(name, "B9600")) |
358 | #ifdef B9600 |
359 | return B9600; |
360 | #else |
361 | goto not_there; |
362 | #endif |
363 | if (strEQ(name, "B19200")) |
364 | #ifdef B19200 |
365 | return B19200; |
366 | #else |
367 | goto not_there; |
368 | #endif |
369 | if (strEQ(name, "B38400")) |
370 | #ifdef B38400 |
371 | return B38400; |
372 | #else |
373 | goto not_there; |
374 | #endif |
375 | if (strEQ(name, "B0")) |
376 | #ifdef B0 |
377 | return B0; |
378 | #else |
379 | goto not_there; |
380 | #endif |
381 | if (strEQ(name, "B110")) |
382 | #ifdef B110 |
383 | return B110; |
384 | #else |
385 | goto not_there; |
386 | #endif |
387 | if (strEQ(name, "B1200")) |
388 | #ifdef B1200 |
389 | return B1200; |
390 | #else |
391 | goto not_there; |
392 | #endif |
393 | if (strEQ(name, "B134")) |
394 | #ifdef B134 |
395 | return B134; |
396 | #else |
397 | goto not_there; |
398 | #endif |
399 | if (strEQ(name, "B150")) |
400 | #ifdef B150 |
401 | return B150; |
402 | #else |
403 | goto not_there; |
404 | #endif |
405 | if (strEQ(name, "B1800")) |
406 | #ifdef B1800 |
407 | return B1800; |
408 | #else |
409 | goto not_there; |
410 | #endif |
411 | if (strEQ(name, "B200")) |
412 | #ifdef B200 |
413 | return B200; |
414 | #else |
415 | goto not_there; |
416 | #endif |
417 | if (strEQ(name, "B2400")) |
418 | #ifdef B2400 |
419 | return B2400; |
420 | #else |
421 | goto not_there; |
422 | #endif |
423 | if (strEQ(name, "B300")) |
424 | #ifdef B300 |
425 | return B300; |
426 | #else |
427 | goto not_there; |
428 | #endif |
429 | if (strEQ(name, "B4800")) |
430 | #ifdef B4800 |
431 | return B4800; |
432 | #else |
433 | goto not_there; |
434 | #endif |
435 | if (strEQ(name, "B50")) |
436 | #ifdef B50 |
437 | return B50; |
438 | #else |
439 | goto not_there; |
440 | #endif |
441 | if (strEQ(name, "B600")) |
442 | #ifdef B600 |
443 | return B600; |
444 | #else |
445 | goto not_there; |
446 | #endif |
447 | if (strEQ(name, "B75")) |
448 | #ifdef B75 |
449 | return B75; |
450 | #else |
451 | goto not_there; |
452 | #endif |
453 | break; |
454 | case 'C': |
455 | if (strEQ(name, "CHAR_BIT")) |
456 | #ifdef CHAR_BIT |
457 | return CHAR_BIT; |
458 | #else |
459 | goto not_there; |
460 | #endif |
461 | if (strEQ(name, "CHAR_MAX")) |
462 | #ifdef CHAR_MAX |
463 | return CHAR_MAX; |
464 | #else |
465 | goto not_there; |
466 | #endif |
467 | if (strEQ(name, "CHAR_MIN")) |
468 | #ifdef CHAR_MIN |
469 | return CHAR_MIN; |
470 | #else |
471 | goto not_there; |
472 | #endif |
473 | if (strEQ(name, "CHILD_MAX")) |
474 | #ifdef CHILD_MAX |
475 | return CHILD_MAX; |
476 | #else |
477 | goto not_there; |
478 | #endif |
479 | if (strEQ(name, "CLK_TCK")) |
480 | #ifdef CLK_TCK |
481 | return CLK_TCK; |
482 | #else |
483 | goto not_there; |
484 | #endif |
485 | if (strEQ(name, "CLOCAL")) |
486 | #ifdef CLOCAL |
487 | return CLOCAL; |
488 | #else |
489 | goto not_there; |
490 | #endif |
491 | if (strEQ(name, "CLOCKS_PER_SEC")) |
492 | #ifdef CLOCKS_PER_SEC |
493 | return CLOCKS_PER_SEC; |
494 | #else |
495 | goto not_there; |
496 | #endif |
497 | if (strEQ(name, "CREAD")) |
498 | #ifdef CREAD |
499 | return CREAD; |
500 | #else |
501 | goto not_there; |
502 | #endif |
503 | if (strEQ(name, "CS5")) |
504 | #ifdef CS5 |
505 | return CS5; |
506 | #else |
507 | goto not_there; |
508 | #endif |
509 | if (strEQ(name, "CS6")) |
510 | #ifdef CS6 |
511 | return CS6; |
512 | #else |
513 | goto not_there; |
514 | #endif |
515 | if (strEQ(name, "CS7")) |
516 | #ifdef CS7 |
517 | return CS7; |
518 | #else |
519 | goto not_there; |
520 | #endif |
521 | if (strEQ(name, "CS8")) |
522 | #ifdef CS8 |
523 | return CS8; |
524 | #else |
525 | goto not_there; |
526 | #endif |
527 | if (strEQ(name, "CSIZE")) |
528 | #ifdef CSIZE |
529 | return CSIZE; |
530 | #else |
531 | goto not_there; |
532 | #endif |
533 | if (strEQ(name, "CSTOPB")) |
534 | #ifdef CSTOPB |
535 | return CSTOPB; |
536 | #else |
537 | goto not_there; |
538 | #endif |
539 | break; |
540 | case 'D': |
541 | if (strEQ(name, "DBL_MAX")) |
542 | #ifdef DBL_MAX |
543 | return DBL_MAX; |
544 | #else |
545 | goto not_there; |
546 | #endif |
547 | if (strEQ(name, "DBL_MIN")) |
548 | #ifdef DBL_MIN |
549 | return DBL_MIN; |
550 | #else |
551 | goto not_there; |
552 | #endif |
553 | if (strEQ(name, "DBL_DIG")) |
554 | #ifdef DBL_DIG |
555 | return DBL_DIG; |
556 | #else |
557 | goto not_there; |
558 | #endif |
559 | if (strEQ(name, "DBL_EPSILON")) |
560 | #ifdef DBL_EPSILON |
561 | return DBL_EPSILON; |
562 | #else |
563 | goto not_there; |
564 | #endif |
565 | if (strEQ(name, "DBL_MANT_DIG")) |
566 | #ifdef DBL_MANT_DIG |
567 | return DBL_MANT_DIG; |
568 | #else |
569 | goto not_there; |
570 | #endif |
571 | if (strEQ(name, "DBL_MAX_10_EXP")) |
572 | #ifdef DBL_MAX_10_EXP |
573 | return DBL_MAX_10_EXP; |
574 | #else |
575 | goto not_there; |
576 | #endif |
577 | if (strEQ(name, "DBL_MAX_EXP")) |
578 | #ifdef DBL_MAX_EXP |
579 | return DBL_MAX_EXP; |
580 | #else |
581 | goto not_there; |
582 | #endif |
583 | if (strEQ(name, "DBL_MIN_10_EXP")) |
584 | #ifdef DBL_MIN_10_EXP |
585 | return DBL_MIN_10_EXP; |
586 | #else |
587 | goto not_there; |
588 | #endif |
589 | if (strEQ(name, "DBL_MIN_EXP")) |
590 | #ifdef DBL_MIN_EXP |
591 | return DBL_MIN_EXP; |
592 | #else |
593 | goto not_there; |
594 | #endif |
595 | break; |
596 | case 'E': |
597 | switch (name[1]) { |
598 | case 'A': |
599 | if (strEQ(name, "EACCES")) |
600 | #ifdef EACCES |
601 | return EACCES; |
602 | #else |
603 | goto not_there; |
604 | #endif |
774d564b |
605 | if (strEQ(name, "EADDRINUSE")) |
606 | #ifdef EADDRINUSE |
607 | return EADDRINUSE; |
608 | #else |
609 | goto not_there; |
610 | #endif |
611 | if (strEQ(name, "EADDRNOTAVAIL")) |
612 | #ifdef EADDRNOTAVAIL |
613 | return EADDRNOTAVAIL; |
614 | #else |
615 | goto not_there; |
616 | #endif |
617 | if (strEQ(name, "EAFNOSUPPORT")) |
618 | #ifdef EAFNOSUPPORT |
619 | return EAFNOSUPPORT; |
620 | #else |
621 | goto not_there; |
622 | #endif |
2304df62 |
623 | if (strEQ(name, "EAGAIN")) |
624 | #ifdef EAGAIN |
625 | return EAGAIN; |
626 | #else |
627 | goto not_there; |
628 | #endif |
774d564b |
629 | if (strEQ(name, "EALREADY")) |
630 | #ifdef EALREADY |
631 | return EALREADY; |
632 | #else |
633 | goto not_there; |
634 | #endif |
2304df62 |
635 | break; |
636 | case 'B': |
637 | if (strEQ(name, "EBADF")) |
638 | #ifdef EBADF |
639 | return EBADF; |
640 | #else |
641 | goto not_there; |
642 | #endif |
643 | if (strEQ(name, "EBUSY")) |
644 | #ifdef EBUSY |
645 | return EBUSY; |
646 | #else |
647 | goto not_there; |
648 | #endif |
649 | break; |
650 | case 'C': |
651 | if (strEQ(name, "ECHILD")) |
652 | #ifdef ECHILD |
653 | return ECHILD; |
654 | #else |
655 | goto not_there; |
656 | #endif |
657 | if (strEQ(name, "ECHO")) |
658 | #ifdef ECHO |
659 | return ECHO; |
660 | #else |
661 | goto not_there; |
662 | #endif |
663 | if (strEQ(name, "ECHOE")) |
664 | #ifdef ECHOE |
665 | return ECHOE; |
666 | #else |
667 | goto not_there; |
668 | #endif |
669 | if (strEQ(name, "ECHOK")) |
670 | #ifdef ECHOK |
671 | return ECHOK; |
672 | #else |
673 | goto not_there; |
674 | #endif |
675 | if (strEQ(name, "ECHONL")) |
676 | #ifdef ECHONL |
677 | return ECHONL; |
678 | #else |
679 | goto not_there; |
680 | #endif |
774d564b |
681 | if (strEQ(name, "ECONNABORTED")) |
682 | #ifdef ECONNABORTED |
683 | return ECONNABORTED; |
684 | #else |
685 | goto not_there; |
686 | #endif |
687 | if (strEQ(name, "ECONNREFUSED")) |
688 | #ifdef ECONNREFUSED |
689 | return ECONNREFUSED; |
690 | #else |
691 | goto not_there; |
692 | #endif |
693 | if (strEQ(name, "ECONNRESET")) |
694 | #ifdef ECONNRESET |
695 | return ECONNRESET; |
696 | #else |
697 | goto not_there; |
698 | #endif |
2304df62 |
699 | break; |
700 | case 'D': |
701 | if (strEQ(name, "EDEADLK")) |
702 | #ifdef EDEADLK |
703 | return EDEADLK; |
704 | #else |
705 | goto not_there; |
706 | #endif |
774d564b |
707 | if (strEQ(name, "EDESTADDRREQ")) |
708 | #ifdef EDESTADDRREQ |
709 | return EDESTADDRREQ; |
710 | #else |
711 | goto not_there; |
712 | #endif |
2304df62 |
713 | if (strEQ(name, "EDOM")) |
714 | #ifdef EDOM |
715 | return EDOM; |
716 | #else |
717 | goto not_there; |
718 | #endif |
774d564b |
719 | if (strEQ(name, "EDQUOT")) |
720 | #ifdef EDQUOT |
721 | return EDQUOT; |
722 | #else |
723 | goto not_there; |
724 | #endif |
2304df62 |
725 | break; |
726 | case 'E': |
727 | if (strEQ(name, "EEXIST")) |
728 | #ifdef EEXIST |
729 | return EEXIST; |
730 | #else |
731 | goto not_there; |
732 | #endif |
733 | break; |
734 | case 'F': |
735 | if (strEQ(name, "EFAULT")) |
736 | #ifdef EFAULT |
737 | return EFAULT; |
738 | #else |
739 | goto not_there; |
740 | #endif |
741 | if (strEQ(name, "EFBIG")) |
742 | #ifdef EFBIG |
743 | return EFBIG; |
744 | #else |
745 | goto not_there; |
746 | #endif |
747 | break; |
774d564b |
748 | case 'H': |
749 | if (strEQ(name, "EHOSTDOWN")) |
750 | #ifdef EHOSTDOWN |
751 | return EHOSTDOWN; |
752 | #else |
753 | goto not_there; |
754 | #endif |
755 | if (strEQ(name, "EHOSTUNREACH")) |
756 | #ifdef EHOSTUNREACH |
757 | return EHOSTUNREACH; |
758 | #else |
759 | goto not_there; |
760 | #endif |
761 | break; |
2304df62 |
762 | case 'I': |
774d564b |
763 | if (strEQ(name, "EINPROGRESS")) |
764 | #ifdef EINPROGRESS |
765 | return EINPROGRESS; |
766 | #else |
767 | goto not_there; |
768 | #endif |
2304df62 |
769 | if (strEQ(name, "EINTR")) |
770 | #ifdef EINTR |
771 | return EINTR; |
772 | #else |
773 | goto not_there; |
774 | #endif |
775 | if (strEQ(name, "EINVAL")) |
776 | #ifdef EINVAL |
777 | return EINVAL; |
778 | #else |
779 | goto not_there; |
780 | #endif |
781 | if (strEQ(name, "EIO")) |
782 | #ifdef EIO |
783 | return EIO; |
784 | #else |
785 | goto not_there; |
786 | #endif |
774d564b |
787 | if (strEQ(name, "EISCONN")) |
788 | #ifdef EISCONN |
789 | return EISCONN; |
790 | #else |
791 | goto not_there; |
792 | #endif |
2304df62 |
793 | if (strEQ(name, "EISDIR")) |
794 | #ifdef EISDIR |
795 | return EISDIR; |
796 | #else |
797 | goto not_there; |
798 | #endif |
774d564b |
799 | if (strEQ(name, "ELOOP")) |
800 | #ifdef ELOOP |
801 | return ELOOP; |
802 | #else |
803 | goto not_there; |
804 | #endif |
2304df62 |
805 | break; |
806 | case 'M': |
807 | if (strEQ(name, "EMFILE")) |
808 | #ifdef EMFILE |
809 | return EMFILE; |
810 | #else |
811 | goto not_there; |
812 | #endif |
813 | if (strEQ(name, "EMLINK")) |
814 | #ifdef EMLINK |
815 | return EMLINK; |
816 | #else |
817 | goto not_there; |
818 | #endif |
774d564b |
819 | if (strEQ(name, "EMSGSIZE")) |
820 | #ifdef EMSGSIZE |
821 | return EMSGSIZE; |
822 | #else |
823 | goto not_there; |
824 | #endif |
2304df62 |
825 | break; |
826 | case 'N': |
774d564b |
827 | if (strEQ(name, "ENETDOWN")) |
828 | #ifdef ENETDOWN |
829 | return ENETDOWN; |
830 | #else |
831 | goto not_there; |
832 | #endif |
833 | if (strEQ(name, "ENETRESET")) |
834 | #ifdef ENETRESET |
835 | return ENETRESET; |
836 | #else |
837 | goto not_there; |
838 | #endif |
839 | if (strEQ(name, "ENETUNREACH")) |
840 | #ifdef ENETUNREACH |
841 | return ENETUNREACH; |
842 | #else |
843 | goto not_there; |
844 | #endif |
845 | if (strEQ(name, "ENOBUFS")) |
846 | #ifdef ENOBUFS |
847 | return ENOBUFS; |
848 | #else |
849 | goto not_there; |
850 | #endif |
851 | if (strEQ(name, "ENOEXEC")) |
852 | #ifdef ENOEXEC |
853 | return ENOEXEC; |
854 | #else |
855 | goto not_there; |
856 | #endif |
2304df62 |
857 | if (strEQ(name, "ENOMEM")) |
858 | #ifdef ENOMEM |
859 | return ENOMEM; |
860 | #else |
861 | goto not_there; |
862 | #endif |
774d564b |
863 | if (strEQ(name, "ENOPROTOOPT")) |
864 | #ifdef ENOPROTOOPT |
865 | return ENOPROTOOPT; |
866 | #else |
867 | goto not_there; |
868 | #endif |
2304df62 |
869 | if (strEQ(name, "ENOSPC")) |
870 | #ifdef ENOSPC |
871 | return ENOSPC; |
872 | #else |
873 | goto not_there; |
874 | #endif |
774d564b |
875 | if (strEQ(name, "ENOTBLK")) |
876 | #ifdef ENOTBLK |
877 | return ENOTBLK; |
2304df62 |
878 | #else |
879 | goto not_there; |
880 | #endif |
774d564b |
881 | if (strEQ(name, "ENOTCONN")) |
882 | #ifdef ENOTCONN |
883 | return ENOTCONN; |
2304df62 |
884 | #else |
885 | goto not_there; |
886 | #endif |
887 | if (strEQ(name, "ENOTDIR")) |
888 | #ifdef ENOTDIR |
889 | return ENOTDIR; |
890 | #else |
891 | goto not_there; |
892 | #endif |
893 | if (strEQ(name, "ENOTEMPTY")) |
894 | #ifdef ENOTEMPTY |
895 | return ENOTEMPTY; |
896 | #else |
897 | goto not_there; |
898 | #endif |
774d564b |
899 | if (strEQ(name, "ENOTSOCK")) |
900 | #ifdef ENOTSOCK |
901 | return ENOTSOCK; |
902 | #else |
903 | goto not_there; |
904 | #endif |
905 | if (strEQ(name, "ENOTTY")) |
906 | #ifdef ENOTTY |
907 | return ENOTTY; |
908 | #else |
909 | goto not_there; |
910 | #endif |
2304df62 |
911 | if (strEQ(name, "ENFILE")) |
912 | #ifdef ENFILE |
913 | return ENFILE; |
914 | #else |
915 | goto not_there; |
916 | #endif |
917 | if (strEQ(name, "ENODEV")) |
918 | #ifdef ENODEV |
919 | return ENODEV; |
920 | #else |
921 | goto not_there; |
922 | #endif |
923 | if (strEQ(name, "ENOENT")) |
924 | #ifdef ENOENT |
925 | return ENOENT; |
926 | #else |
927 | goto not_there; |
928 | #endif |
929 | if (strEQ(name, "ENOLCK")) |
930 | #ifdef ENOLCK |
931 | return ENOLCK; |
932 | #else |
933 | goto not_there; |
934 | #endif |
935 | if (strEQ(name, "ENOSYS")) |
936 | #ifdef ENOSYS |
937 | return ENOSYS; |
938 | #else |
939 | goto not_there; |
940 | #endif |
941 | if (strEQ(name, "ENXIO")) |
942 | #ifdef ENXIO |
943 | return ENXIO; |
944 | #else |
945 | goto not_there; |
946 | #endif |
947 | if (strEQ(name, "ENAMETOOLONG")) |
948 | #ifdef ENAMETOOLONG |
949 | return ENAMETOOLONG; |
950 | #else |
951 | goto not_there; |
952 | #endif |
953 | break; |
954 | case 'O': |
955 | if (strEQ(name, "EOF")) |
956 | #ifdef EOF |
957 | return EOF; |
958 | #else |
959 | goto not_there; |
960 | #endif |
774d564b |
961 | if (strEQ(name, "EOPNOTSUPP")) |
962 | #ifdef EOPNOTSUPP |
963 | return EOPNOTSUPP; |
964 | #else |
965 | goto not_there; |
966 | #endif |
2304df62 |
967 | break; |
968 | case 'P': |
969 | if (strEQ(name, "EPERM")) |
970 | #ifdef EPERM |
971 | return EPERM; |
972 | #else |
973 | goto not_there; |
974 | #endif |
774d564b |
975 | if (strEQ(name, "EPFNOSUPPORT")) |
976 | #ifdef EPFNOSUPPORT |
977 | return EPFNOSUPPORT; |
978 | #else |
979 | goto not_there; |
980 | #endif |
2304df62 |
981 | if (strEQ(name, "EPIPE")) |
982 | #ifdef EPIPE |
983 | return EPIPE; |
984 | #else |
985 | goto not_there; |
986 | #endif |
774d564b |
987 | if (strEQ(name, "EPROCLIM")) |
988 | #ifdef EPROCLIM |
989 | return EPROCLIM; |
990 | #else |
991 | goto not_there; |
992 | #endif |
993 | if (strEQ(name, "EPROTONOSUPPORT")) |
994 | #ifdef EPROTONOSUPPORT |
995 | return EPROTONOSUPPORT; |
996 | #else |
997 | goto not_there; |
998 | #endif |
999 | if (strEQ(name, "EPROTOTYPE")) |
1000 | #ifdef EPROTOTYPE |
1001 | return EPROTOTYPE; |
1002 | #else |
1003 | goto not_there; |
1004 | #endif |
2304df62 |
1005 | break; |
1006 | case 'R': |
1007 | if (strEQ(name, "ERANGE")) |
1008 | #ifdef ERANGE |
1009 | return ERANGE; |
1010 | #else |
1011 | goto not_there; |
1012 | #endif |
774d564b |
1013 | if (strEQ(name, "EREMOTE")) |
1014 | #ifdef EREMOTE |
1015 | return EREMOTE; |
1016 | #else |
1017 | goto not_there; |
1018 | #endif |
1019 | if (strEQ(name, "ERESTART")) |
1020 | #ifdef ERESTART |
1021 | return ERESTART; |
1022 | #else |
1023 | goto not_there; |
1024 | #endif |
2304df62 |
1025 | if (strEQ(name, "EROFS")) |
1026 | #ifdef EROFS |
1027 | return EROFS; |
1028 | #else |
1029 | goto not_there; |
1030 | #endif |
1031 | break; |
1032 | case 'S': |
774d564b |
1033 | if (strEQ(name, "ESHUTDOWN")) |
1034 | #ifdef ESHUTDOWN |
1035 | return ESHUTDOWN; |
1036 | #else |
1037 | goto not_there; |
1038 | #endif |
1039 | if (strEQ(name, "ESOCKTNOSUPPORT")) |
1040 | #ifdef ESOCKTNOSUPPORT |
1041 | return ESOCKTNOSUPPORT; |
1042 | #else |
1043 | goto not_there; |
1044 | #endif |
2304df62 |
1045 | if (strEQ(name, "ESPIPE")) |
1046 | #ifdef ESPIPE |
1047 | return ESPIPE; |
1048 | #else |
1049 | goto not_there; |
1050 | #endif |
1051 | if (strEQ(name, "ESRCH")) |
1052 | #ifdef ESRCH |
1053 | return ESRCH; |
1054 | #else |
1055 | goto not_there; |
1056 | #endif |
774d564b |
1057 | if (strEQ(name, "ESTALE")) |
1058 | #ifdef ESTALE |
1059 | return ESTALE; |
1060 | #else |
1061 | goto not_there; |
1062 | #endif |
2304df62 |
1063 | break; |
774d564b |
1064 | case 'T': |
1065 | if (strEQ(name, "ETIMEDOUT")) |
1066 | #ifdef ETIMEDOUT |
1067 | return ETIMEDOUT; |
1068 | #else |
1069 | goto not_there; |
1070 | #endif |
1071 | if (strEQ(name, "ETOOMANYREFS")) |
1072 | #ifdef ETOOMANYREFS |
1073 | return ETOOMANYREFS; |
1074 | #else |
1075 | goto not_there; |
1076 | #endif |
1077 | if (strEQ(name, "ETXTBSY")) |
1078 | #ifdef ETXTBSY |
1079 | return ETXTBSY; |
1080 | #else |
1081 | goto not_there; |
1082 | #endif |
1083 | break; |
1084 | case 'U': |
1085 | if (strEQ(name, "EUSERS")) |
1086 | #ifdef EUSERS |
1087 | return EUSERS; |
1088 | #else |
1089 | goto not_there; |
1090 | #endif |
1091 | break; |
1092 | case 'W': |
1093 | if (strEQ(name, "EWOULDBLOCK")) |
1094 | #ifdef EWOULDBLOCK |
1095 | return EWOULDBLOCK; |
1096 | #else |
1097 | goto not_there; |
1098 | #endif |
1099 | break; |
2304df62 |
1100 | case 'X': |
1101 | if (strEQ(name, "EXIT_FAILURE")) |
1102 | #ifdef EXIT_FAILURE |
1103 | return EXIT_FAILURE; |
1104 | #else |
1105 | return 1; |
1106 | #endif |
1107 | if (strEQ(name, "EXIT_SUCCESS")) |
1108 | #ifdef EXIT_SUCCESS |
1109 | return EXIT_SUCCESS; |
1110 | #else |
1111 | return 0; |
1112 | #endif |
1113 | if (strEQ(name, "EXDEV")) |
1114 | #ifdef EXDEV |
1115 | return EXDEV; |
1116 | #else |
1117 | goto not_there; |
1118 | #endif |
1119 | break; |
1120 | } |
1121 | if (strEQ(name, "E2BIG")) |
1122 | #ifdef E2BIG |
1123 | return E2BIG; |
1124 | #else |
1125 | goto not_there; |
1126 | #endif |
1127 | break; |
1128 | case 'F': |
1129 | if (strnEQ(name, "FLT_", 4)) { |
1130 | if (strEQ(name, "FLT_MAX")) |
1131 | #ifdef FLT_MAX |
1132 | return FLT_MAX; |
1133 | #else |
1134 | goto not_there; |
1135 | #endif |
1136 | if (strEQ(name, "FLT_MIN")) |
1137 | #ifdef FLT_MIN |
1138 | return FLT_MIN; |
1139 | #else |
1140 | goto not_there; |
1141 | #endif |
1142 | if (strEQ(name, "FLT_ROUNDS")) |
1143 | #ifdef FLT_ROUNDS |
1144 | return FLT_ROUNDS; |
1145 | #else |
1146 | goto not_there; |
1147 | #endif |
1148 | if (strEQ(name, "FLT_DIG")) |
1149 | #ifdef FLT_DIG |
1150 | return FLT_DIG; |
1151 | #else |
1152 | goto not_there; |
1153 | #endif |
1154 | if (strEQ(name, "FLT_EPSILON")) |
1155 | #ifdef FLT_EPSILON |
1156 | return FLT_EPSILON; |
1157 | #else |
1158 | goto not_there; |
1159 | #endif |
1160 | if (strEQ(name, "FLT_MANT_DIG")) |
1161 | #ifdef FLT_MANT_DIG |
1162 | return FLT_MANT_DIG; |
1163 | #else |
1164 | goto not_there; |
1165 | #endif |
1166 | if (strEQ(name, "FLT_MAX_10_EXP")) |
1167 | #ifdef FLT_MAX_10_EXP |
1168 | return FLT_MAX_10_EXP; |
1169 | #else |
1170 | goto not_there; |
1171 | #endif |
1172 | if (strEQ(name, "FLT_MAX_EXP")) |
1173 | #ifdef FLT_MAX_EXP |
1174 | return FLT_MAX_EXP; |
1175 | #else |
1176 | goto not_there; |
1177 | #endif |
1178 | if (strEQ(name, "FLT_MIN_10_EXP")) |
1179 | #ifdef FLT_MIN_10_EXP |
1180 | return FLT_MIN_10_EXP; |
1181 | #else |
1182 | goto not_there; |
1183 | #endif |
1184 | if (strEQ(name, "FLT_MIN_EXP")) |
1185 | #ifdef FLT_MIN_EXP |
1186 | return FLT_MIN_EXP; |
1187 | #else |
1188 | goto not_there; |
1189 | #endif |
1190 | if (strEQ(name, "FLT_RADIX")) |
1191 | #ifdef FLT_RADIX |
1192 | return FLT_RADIX; |
1193 | #else |
1194 | goto not_there; |
1195 | #endif |
1196 | break; |
1197 | } |
1198 | if (strnEQ(name, "F_", 2)) { |
1199 | if (strEQ(name, "F_DUPFD")) |
1200 | #ifdef F_DUPFD |
1201 | return F_DUPFD; |
1202 | #else |
1203 | goto not_there; |
1204 | #endif |
1205 | if (strEQ(name, "F_GETFD")) |
1206 | #ifdef F_GETFD |
1207 | return F_GETFD; |
1208 | #else |
1209 | goto not_there; |
1210 | #endif |
1211 | if (strEQ(name, "F_GETFL")) |
1212 | #ifdef F_GETFL |
1213 | return F_GETFL; |
1214 | #else |
1215 | goto not_there; |
1216 | #endif |
1217 | if (strEQ(name, "F_GETLK")) |
1218 | #ifdef F_GETLK |
1219 | return F_GETLK; |
1220 | #else |
1221 | goto not_there; |
1222 | #endif |
1223 | if (strEQ(name, "F_OK")) |
1224 | #ifdef F_OK |
1225 | return F_OK; |
1226 | #else |
1227 | goto not_there; |
1228 | #endif |
1229 | if (strEQ(name, "F_RDLCK")) |
1230 | #ifdef F_RDLCK |
1231 | return F_RDLCK; |
1232 | #else |
1233 | goto not_there; |
1234 | #endif |
1235 | if (strEQ(name, "F_SETFD")) |
1236 | #ifdef F_SETFD |
1237 | return F_SETFD; |
1238 | #else |
1239 | goto not_there; |
1240 | #endif |
1241 | if (strEQ(name, "F_SETFL")) |
1242 | #ifdef F_SETFL |
1243 | return F_SETFL; |
1244 | #else |
1245 | goto not_there; |
1246 | #endif |
1247 | if (strEQ(name, "F_SETLK")) |
1248 | #ifdef F_SETLK |
1249 | return F_SETLK; |
1250 | #else |
1251 | goto not_there; |
1252 | #endif |
1253 | if (strEQ(name, "F_SETLKW")) |
1254 | #ifdef F_SETLKW |
1255 | return F_SETLKW; |
1256 | #else |
1257 | goto not_there; |
1258 | #endif |
1259 | if (strEQ(name, "F_UNLCK")) |
1260 | #ifdef F_UNLCK |
1261 | return F_UNLCK; |
1262 | #else |
1263 | goto not_there; |
1264 | #endif |
1265 | if (strEQ(name, "F_WRLCK")) |
1266 | #ifdef F_WRLCK |
1267 | return F_WRLCK; |
1268 | #else |
1269 | goto not_there; |
1270 | #endif |
1271 | break; |
1272 | } |
40000a8c |
1273 | if (strEQ(name, "FD_CLOEXEC")) |
1274 | #ifdef FD_CLOEXEC |
1275 | return FD_CLOEXEC; |
1276 | #else |
1277 | goto not_there; |
1278 | #endif |
2304df62 |
1279 | if (strEQ(name, "FILENAME_MAX")) |
1280 | #ifdef FILENAME_MAX |
1281 | return FILENAME_MAX; |
1282 | #else |
1283 | goto not_there; |
1284 | #endif |
1285 | break; |
1286 | case 'H': |
1287 | if (strEQ(name, "HUGE_VAL")) |
1288 | #ifdef HUGE_VAL |
1289 | return HUGE_VAL; |
1290 | #else |
1291 | goto not_there; |
1292 | #endif |
1293 | if (strEQ(name, "HUPCL")) |
1294 | #ifdef HUPCL |
1295 | return HUPCL; |
1296 | #else |
1297 | goto not_there; |
1298 | #endif |
1299 | break; |
1300 | case 'I': |
1301 | if (strEQ(name, "INT_MAX")) |
1302 | #ifdef INT_MAX |
1303 | return INT_MAX; |
1304 | #else |
1305 | goto not_there; |
1306 | #endif |
1307 | if (strEQ(name, "INT_MIN")) |
1308 | #ifdef INT_MIN |
1309 | return INT_MIN; |
1310 | #else |
1311 | goto not_there; |
1312 | #endif |
1313 | if (strEQ(name, "ICANON")) |
1314 | #ifdef ICANON |
1315 | return ICANON; |
1316 | #else |
1317 | goto not_there; |
1318 | #endif |
1319 | if (strEQ(name, "ICRNL")) |
1320 | #ifdef ICRNL |
1321 | return ICRNL; |
1322 | #else |
1323 | goto not_there; |
1324 | #endif |
1325 | if (strEQ(name, "IEXTEN")) |
1326 | #ifdef IEXTEN |
1327 | return IEXTEN; |
1328 | #else |
1329 | goto not_there; |
1330 | #endif |
1331 | if (strEQ(name, "IGNBRK")) |
1332 | #ifdef IGNBRK |
1333 | return IGNBRK; |
1334 | #else |
1335 | goto not_there; |
1336 | #endif |
1337 | if (strEQ(name, "IGNCR")) |
1338 | #ifdef IGNCR |
1339 | return IGNCR; |
1340 | #else |
1341 | goto not_there; |
1342 | #endif |
1343 | if (strEQ(name, "IGNPAR")) |
1344 | #ifdef IGNPAR |
1345 | return IGNPAR; |
1346 | #else |
1347 | goto not_there; |
1348 | #endif |
1349 | if (strEQ(name, "INLCR")) |
1350 | #ifdef INLCR |
1351 | return INLCR; |
1352 | #else |
1353 | goto not_there; |
1354 | #endif |
1355 | if (strEQ(name, "INPCK")) |
1356 | #ifdef INPCK |
1357 | return INPCK; |
1358 | #else |
1359 | goto not_there; |
1360 | #endif |
1361 | if (strEQ(name, "ISIG")) |
1362 | #ifdef ISIG |
1363 | return ISIG; |
1364 | #else |
1365 | goto not_there; |
1366 | #endif |
1367 | if (strEQ(name, "ISTRIP")) |
1368 | #ifdef ISTRIP |
1369 | return ISTRIP; |
1370 | #else |
1371 | goto not_there; |
1372 | #endif |
1373 | if (strEQ(name, "IXOFF")) |
1374 | #ifdef IXOFF |
1375 | return IXOFF; |
1376 | #else |
1377 | goto not_there; |
1378 | #endif |
1379 | if (strEQ(name, "IXON")) |
1380 | #ifdef IXON |
1381 | return IXON; |
1382 | #else |
1383 | goto not_there; |
1384 | #endif |
1385 | break; |
1386 | case 'L': |
1387 | if (strnEQ(name, "LC_", 3)) { |
1388 | if (strEQ(name, "LC_ALL")) |
1389 | #ifdef LC_ALL |
1390 | return LC_ALL; |
1391 | #else |
1392 | goto not_there; |
1393 | #endif |
1394 | if (strEQ(name, "LC_COLLATE")) |
1395 | #ifdef LC_COLLATE |
1396 | return LC_COLLATE; |
1397 | #else |
1398 | goto not_there; |
1399 | #endif |
1400 | if (strEQ(name, "LC_CTYPE")) |
1401 | #ifdef LC_CTYPE |
1402 | return LC_CTYPE; |
1403 | #else |
1404 | goto not_there; |
1405 | #endif |
1406 | if (strEQ(name, "LC_MONETARY")) |
1407 | #ifdef LC_MONETARY |
1408 | return LC_MONETARY; |
1409 | #else |
1410 | goto not_there; |
1411 | #endif |
1412 | if (strEQ(name, "LC_NUMERIC")) |
1413 | #ifdef LC_NUMERIC |
1414 | return LC_NUMERIC; |
1415 | #else |
1416 | goto not_there; |
1417 | #endif |
1418 | if (strEQ(name, "LC_TIME")) |
1419 | #ifdef LC_TIME |
1420 | return LC_TIME; |
1421 | #else |
1422 | goto not_there; |
1423 | #endif |
1424 | break; |
1425 | } |
1426 | if (strnEQ(name, "LDBL_", 5)) { |
1427 | if (strEQ(name, "LDBL_MAX")) |
1428 | #ifdef LDBL_MAX |
1429 | return LDBL_MAX; |
1430 | #else |
1431 | goto not_there; |
1432 | #endif |
1433 | if (strEQ(name, "LDBL_MIN")) |
1434 | #ifdef LDBL_MIN |
1435 | return LDBL_MIN; |
1436 | #else |
1437 | goto not_there; |
1438 | #endif |
1439 | if (strEQ(name, "LDBL_DIG")) |
1440 | #ifdef LDBL_DIG |
1441 | return LDBL_DIG; |
1442 | #else |
1443 | goto not_there; |
1444 | #endif |
1445 | if (strEQ(name, "LDBL_EPSILON")) |
1446 | #ifdef LDBL_EPSILON |
1447 | return LDBL_EPSILON; |
1448 | #else |
1449 | goto not_there; |
1450 | #endif |
1451 | if (strEQ(name, "LDBL_MANT_DIG")) |
1452 | #ifdef LDBL_MANT_DIG |
1453 | return LDBL_MANT_DIG; |
1454 | #else |
1455 | goto not_there; |
1456 | #endif |
1457 | if (strEQ(name, "LDBL_MAX_10_EXP")) |
1458 | #ifdef LDBL_MAX_10_EXP |
1459 | return LDBL_MAX_10_EXP; |
1460 | #else |
1461 | goto not_there; |
1462 | #endif |
1463 | if (strEQ(name, "LDBL_MAX_EXP")) |
1464 | #ifdef LDBL_MAX_EXP |
1465 | return LDBL_MAX_EXP; |
1466 | #else |
1467 | goto not_there; |
1468 | #endif |
1469 | if (strEQ(name, "LDBL_MIN_10_EXP")) |
1470 | #ifdef LDBL_MIN_10_EXP |
1471 | return LDBL_MIN_10_EXP; |
1472 | #else |
1473 | goto not_there; |
1474 | #endif |
1475 | if (strEQ(name, "LDBL_MIN_EXP")) |
1476 | #ifdef LDBL_MIN_EXP |
1477 | return LDBL_MIN_EXP; |
1478 | #else |
1479 | goto not_there; |
1480 | #endif |
1481 | break; |
1482 | } |
1483 | if (strnEQ(name, "L_", 2)) { |
1484 | if (strEQ(name, "L_ctermid")) |
1485 | #ifdef L_ctermid |
1486 | return L_ctermid; |
1487 | #else |
1488 | goto not_there; |
1489 | #endif |
1490 | if (strEQ(name, "L_cuserid")) |
1491 | #ifdef L_cuserid |
1492 | return L_cuserid; |
1493 | #else |
1494 | goto not_there; |
1495 | #endif |
1496 | if (strEQ(name, "L_tmpname")) |
1497 | #ifdef L_tmpname |
1498 | return L_tmpname; |
1499 | #else |
1500 | goto not_there; |
1501 | #endif |
1502 | break; |
1503 | } |
1504 | if (strEQ(name, "LONG_MAX")) |
1505 | #ifdef LONG_MAX |
1506 | return LONG_MAX; |
1507 | #else |
1508 | goto not_there; |
1509 | #endif |
1510 | if (strEQ(name, "LONG_MIN")) |
1511 | #ifdef LONG_MIN |
1512 | return LONG_MIN; |
1513 | #else |
1514 | goto not_there; |
1515 | #endif |
1516 | if (strEQ(name, "LINK_MAX")) |
1517 | #ifdef LINK_MAX |
1518 | return LINK_MAX; |
1519 | #else |
1520 | goto not_there; |
1521 | #endif |
1522 | break; |
1523 | case 'M': |
1524 | if (strEQ(name, "MAX_CANON")) |
1525 | #ifdef MAX_CANON |
1526 | return MAX_CANON; |
1527 | #else |
1528 | goto not_there; |
1529 | #endif |
1530 | if (strEQ(name, "MAX_INPUT")) |
1531 | #ifdef MAX_INPUT |
1532 | return MAX_INPUT; |
1533 | #else |
1534 | goto not_there; |
1535 | #endif |
1536 | if (strEQ(name, "MB_CUR_MAX")) |
1537 | #ifdef MB_CUR_MAX |
1538 | return MB_CUR_MAX; |
1539 | #else |
1540 | goto not_there; |
1541 | #endif |
1542 | if (strEQ(name, "MB_LEN_MAX")) |
1543 | #ifdef MB_LEN_MAX |
1544 | return MB_LEN_MAX; |
1545 | #else |
1546 | goto not_there; |
1547 | #endif |
1548 | break; |
1549 | case 'N': |
a0d0e21e |
1550 | if (strEQ(name, "NULL")) return 0; |
2304df62 |
1551 | if (strEQ(name, "NAME_MAX")) |
1552 | #ifdef NAME_MAX |
1553 | return NAME_MAX; |
1554 | #else |
1555 | goto not_there; |
1556 | #endif |
1557 | if (strEQ(name, "NCCS")) |
1558 | #ifdef NCCS |
1559 | return NCCS; |
1560 | #else |
1561 | goto not_there; |
1562 | #endif |
1563 | if (strEQ(name, "NGROUPS_MAX")) |
1564 | #ifdef NGROUPS_MAX |
1565 | return NGROUPS_MAX; |
1566 | #else |
1567 | goto not_there; |
1568 | #endif |
1569 | if (strEQ(name, "NOFLSH")) |
1570 | #ifdef NOFLSH |
1571 | return NOFLSH; |
1572 | #else |
1573 | goto not_there; |
1574 | #endif |
1575 | break; |
1576 | case 'O': |
1577 | if (strnEQ(name, "O_", 2)) { |
1578 | if (strEQ(name, "O_APPEND")) |
1579 | #ifdef O_APPEND |
1580 | return O_APPEND; |
1581 | #else |
1582 | goto not_there; |
1583 | #endif |
1584 | if (strEQ(name, "O_CREAT")) |
1585 | #ifdef O_CREAT |
1586 | return O_CREAT; |
1587 | #else |
1588 | goto not_there; |
1589 | #endif |
1590 | if (strEQ(name, "O_TRUNC")) |
1591 | #ifdef O_TRUNC |
1592 | return O_TRUNC; |
1593 | #else |
1594 | goto not_there; |
1595 | #endif |
1596 | if (strEQ(name, "O_RDONLY")) |
1597 | #ifdef O_RDONLY |
1598 | return O_RDONLY; |
1599 | #else |
1600 | goto not_there; |
1601 | #endif |
1602 | if (strEQ(name, "O_RDWR")) |
1603 | #ifdef O_RDWR |
1604 | return O_RDWR; |
1605 | #else |
1606 | goto not_there; |
1607 | #endif |
1608 | if (strEQ(name, "O_WRONLY")) |
1609 | #ifdef O_WRONLY |
1610 | return O_WRONLY; |
1611 | #else |
1612 | goto not_there; |
1613 | #endif |
1614 | if (strEQ(name, "O_EXCL")) |
1615 | #ifdef O_EXCL |
1616 | return O_EXCL; |
1617 | #else |
1618 | goto not_there; |
1619 | #endif |
1620 | if (strEQ(name, "O_NOCTTY")) |
1621 | #ifdef O_NOCTTY |
1622 | return O_NOCTTY; |
1623 | #else |
1624 | goto not_there; |
1625 | #endif |
1626 | if (strEQ(name, "O_NONBLOCK")) |
1627 | #ifdef O_NONBLOCK |
1628 | return O_NONBLOCK; |
1629 | #else |
1630 | goto not_there; |
1631 | #endif |
1632 | if (strEQ(name, "O_ACCMODE")) |
1633 | #ifdef O_ACCMODE |
1634 | return O_ACCMODE; |
1635 | #else |
1636 | goto not_there; |
1637 | #endif |
1638 | break; |
1639 | } |
1640 | if (strEQ(name, "OPEN_MAX")) |
1641 | #ifdef OPEN_MAX |
1642 | return OPEN_MAX; |
1643 | #else |
1644 | goto not_there; |
1645 | #endif |
1646 | if (strEQ(name, "OPOST")) |
1647 | #ifdef OPOST |
1648 | return OPOST; |
1649 | #else |
1650 | goto not_there; |
1651 | #endif |
1652 | break; |
1653 | case 'P': |
1654 | if (strEQ(name, "PATH_MAX")) |
1655 | #ifdef PATH_MAX |
1656 | return PATH_MAX; |
1657 | #else |
1658 | goto not_there; |
1659 | #endif |
1660 | if (strEQ(name, "PARENB")) |
1661 | #ifdef PARENB |
1662 | return PARENB; |
1663 | #else |
1664 | goto not_there; |
1665 | #endif |
1666 | if (strEQ(name, "PARMRK")) |
1667 | #ifdef PARMRK |
1668 | return PARMRK; |
1669 | #else |
1670 | goto not_there; |
1671 | #endif |
1672 | if (strEQ(name, "PARODD")) |
1673 | #ifdef PARODD |
1674 | return PARODD; |
1675 | #else |
1676 | goto not_there; |
1677 | #endif |
1678 | if (strEQ(name, "PIPE_BUF")) |
1679 | #ifdef PIPE_BUF |
1680 | return PIPE_BUF; |
1681 | #else |
1682 | goto not_there; |
1683 | #endif |
1684 | break; |
1685 | case 'R': |
1686 | if (strEQ(name, "RAND_MAX")) |
1687 | #ifdef RAND_MAX |
1688 | return RAND_MAX; |
1689 | #else |
1690 | goto not_there; |
1691 | #endif |
1692 | if (strEQ(name, "R_OK")) |
1693 | #ifdef R_OK |
1694 | return R_OK; |
1695 | #else |
1696 | goto not_there; |
1697 | #endif |
1698 | break; |
1699 | case 'S': |
1700 | if (strnEQ(name, "SIG", 3)) { |
1701 | if (name[3] == '_') { |
1702 | if (strEQ(name, "SIG_BLOCK")) |
1703 | #ifdef SIG_BLOCK |
1704 | return SIG_BLOCK; |
1705 | #else |
1706 | goto not_there; |
1707 | #endif |
1708 | #ifdef SIG_DFL |
68dc0745 |
1709 | if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL; |
2304df62 |
1710 | #endif |
1711 | #ifdef SIG_ERR |
68dc0745 |
1712 | if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR; |
2304df62 |
1713 | #endif |
1714 | #ifdef SIG_IGN |
68dc0745 |
1715 | if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN; |
2304df62 |
1716 | #endif |
1717 | if (strEQ(name, "SIG_SETMASK")) |
1718 | #ifdef SIG_SETMASK |
1719 | return SIG_SETMASK; |
1720 | #else |
1721 | goto not_there; |
1722 | #endif |
1723 | if (strEQ(name, "SIG_UNBLOCK")) |
1724 | #ifdef SIG_UNBLOCK |
1725 | return SIG_UNBLOCK; |
1726 | #else |
1727 | goto not_there; |
1728 | #endif |
1729 | break; |
1730 | } |
1731 | if (strEQ(name, "SIGABRT")) |
1732 | #ifdef SIGABRT |
1733 | return SIGABRT; |
1734 | #else |
1735 | goto not_there; |
1736 | #endif |
1737 | if (strEQ(name, "SIGALRM")) |
1738 | #ifdef SIGALRM |
1739 | return SIGALRM; |
1740 | #else |
1741 | goto not_there; |
1742 | #endif |
1743 | if (strEQ(name, "SIGCHLD")) |
1744 | #ifdef SIGCHLD |
1745 | return SIGCHLD; |
1746 | #else |
1747 | goto not_there; |
1748 | #endif |
1749 | if (strEQ(name, "SIGCONT")) |
1750 | #ifdef SIGCONT |
1751 | return SIGCONT; |
1752 | #else |
1753 | goto not_there; |
1754 | #endif |
1755 | if (strEQ(name, "SIGFPE")) |
1756 | #ifdef SIGFPE |
1757 | return SIGFPE; |
1758 | #else |
1759 | goto not_there; |
1760 | #endif |
1761 | if (strEQ(name, "SIGHUP")) |
1762 | #ifdef SIGHUP |
1763 | return SIGHUP; |
1764 | #else |
1765 | goto not_there; |
1766 | #endif |
1767 | if (strEQ(name, "SIGILL")) |
1768 | #ifdef SIGILL |
1769 | return SIGILL; |
1770 | #else |
1771 | goto not_there; |
1772 | #endif |
1773 | if (strEQ(name, "SIGINT")) |
1774 | #ifdef SIGINT |
1775 | return SIGINT; |
1776 | #else |
1777 | goto not_there; |
1778 | #endif |
1779 | if (strEQ(name, "SIGKILL")) |
1780 | #ifdef SIGKILL |
1781 | return SIGKILL; |
1782 | #else |
1783 | goto not_there; |
1784 | #endif |
1785 | if (strEQ(name, "SIGPIPE")) |
1786 | #ifdef SIGPIPE |
1787 | return SIGPIPE; |
1788 | #else |
1789 | goto not_there; |
1790 | #endif |
1791 | if (strEQ(name, "SIGQUIT")) |
1792 | #ifdef SIGQUIT |
1793 | return SIGQUIT; |
1794 | #else |
1795 | goto not_there; |
1796 | #endif |
1797 | if (strEQ(name, "SIGSEGV")) |
1798 | #ifdef SIGSEGV |
1799 | return SIGSEGV; |
1800 | #else |
1801 | goto not_there; |
1802 | #endif |
1803 | if (strEQ(name, "SIGSTOP")) |
1804 | #ifdef SIGSTOP |
1805 | return SIGSTOP; |
1806 | #else |
1807 | goto not_there; |
1808 | #endif |
1809 | if (strEQ(name, "SIGTERM")) |
1810 | #ifdef SIGTERM |
1811 | return SIGTERM; |
1812 | #else |
1813 | goto not_there; |
1814 | #endif |
1815 | if (strEQ(name, "SIGTSTP")) |
1816 | #ifdef SIGTSTP |
1817 | return SIGTSTP; |
1818 | #else |
1819 | goto not_there; |
1820 | #endif |
1821 | if (strEQ(name, "SIGTTIN")) |
1822 | #ifdef SIGTTIN |
1823 | return SIGTTIN; |
1824 | #else |
1825 | goto not_there; |
1826 | #endif |
1827 | if (strEQ(name, "SIGTTOU")) |
1828 | #ifdef SIGTTOU |
1829 | return SIGTTOU; |
1830 | #else |
1831 | goto not_there; |
1832 | #endif |
1833 | if (strEQ(name, "SIGUSR1")) |
1834 | #ifdef SIGUSR1 |
1835 | return SIGUSR1; |
1836 | #else |
1837 | goto not_there; |
1838 | #endif |
1839 | if (strEQ(name, "SIGUSR2")) |
1840 | #ifdef SIGUSR2 |
1841 | return SIGUSR2; |
1842 | #else |
1843 | goto not_there; |
1844 | #endif |
1845 | break; |
1846 | } |
1847 | if (name[1] == '_') { |
2304df62 |
1848 | if (strEQ(name, "S_ISGID")) |
1849 | #ifdef S_ISGID |
1850 | return S_ISGID; |
1851 | #else |
1852 | goto not_there; |
1853 | #endif |
1854 | if (strEQ(name, "S_ISUID")) |
1855 | #ifdef S_ISUID |
1856 | return S_ISUID; |
1857 | #else |
1858 | goto not_there; |
1859 | #endif |
1860 | if (strEQ(name, "S_IRGRP")) |
1861 | #ifdef S_IRGRP |
1862 | return S_IRGRP; |
1863 | #else |
1864 | goto not_there; |
1865 | #endif |
1866 | if (strEQ(name, "S_IROTH")) |
1867 | #ifdef S_IROTH |
1868 | return S_IROTH; |
1869 | #else |
1870 | goto not_there; |
1871 | #endif |
1872 | if (strEQ(name, "S_IRUSR")) |
1873 | #ifdef S_IRUSR |
1874 | return S_IRUSR; |
1875 | #else |
1876 | goto not_there; |
1877 | #endif |
1878 | if (strEQ(name, "S_IRWXG")) |
1879 | #ifdef S_IRWXG |
1880 | return S_IRWXG; |
1881 | #else |
1882 | goto not_there; |
1883 | #endif |
1884 | if (strEQ(name, "S_IRWXO")) |
1885 | #ifdef S_IRWXO |
1886 | return S_IRWXO; |
1887 | #else |
1888 | goto not_there; |
1889 | #endif |
1890 | if (strEQ(name, "S_IRWXU")) |
1891 | #ifdef S_IRWXU |
1892 | return S_IRWXU; |
1893 | #else |
1894 | goto not_there; |
1895 | #endif |
1896 | if (strEQ(name, "S_IWGRP")) |
1897 | #ifdef S_IWGRP |
1898 | return S_IWGRP; |
1899 | #else |
1900 | goto not_there; |
1901 | #endif |
1902 | if (strEQ(name, "S_IWOTH")) |
1903 | #ifdef S_IWOTH |
1904 | return S_IWOTH; |
1905 | #else |
1906 | goto not_there; |
1907 | #endif |
1908 | if (strEQ(name, "S_IWUSR")) |
1909 | #ifdef S_IWUSR |
1910 | return S_IWUSR; |
1911 | #else |
1912 | goto not_there; |
1913 | #endif |
1914 | if (strEQ(name, "S_IXGRP")) |
1915 | #ifdef S_IXGRP |
1916 | return S_IXGRP; |
1917 | #else |
1918 | goto not_there; |
1919 | #endif |
1920 | if (strEQ(name, "S_IXOTH")) |
1921 | #ifdef S_IXOTH |
1922 | return S_IXOTH; |
1923 | #else |
1924 | goto not_there; |
1925 | #endif |
1926 | if (strEQ(name, "S_IXUSR")) |
1927 | #ifdef S_IXUSR |
1928 | return S_IXUSR; |
1929 | #else |
1930 | goto not_there; |
1931 | #endif |
4633a7c4 |
1932 | errno = EAGAIN; /* the following aren't constants */ |
1933 | #ifdef S_ISBLK |
1934 | if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg); |
1935 | #endif |
1936 | #ifdef S_ISCHR |
1937 | if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg); |
1938 | #endif |
1939 | #ifdef S_ISDIR |
1940 | if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg); |
1941 | #endif |
1942 | #ifdef S_ISFIFO |
1943 | if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg); |
1944 | #endif |
1945 | #ifdef S_ISREG |
1946 | if (strEQ(name, "S_ISREG")) return S_ISREG(arg); |
1947 | #endif |
2304df62 |
1948 | break; |
1949 | } |
1950 | if (strEQ(name, "SEEK_CUR")) |
1951 | #ifdef SEEK_CUR |
1952 | return SEEK_CUR; |
1953 | #else |
1954 | goto not_there; |
1955 | #endif |
1956 | if (strEQ(name, "SEEK_END")) |
1957 | #ifdef SEEK_END |
1958 | return SEEK_END; |
1959 | #else |
1960 | goto not_there; |
1961 | #endif |
1962 | if (strEQ(name, "SEEK_SET")) |
1963 | #ifdef SEEK_SET |
1964 | return SEEK_SET; |
1965 | #else |
1966 | goto not_there; |
1967 | #endif |
1968 | if (strEQ(name, "STREAM_MAX")) |
1969 | #ifdef STREAM_MAX |
1970 | return STREAM_MAX; |
1971 | #else |
1972 | goto not_there; |
1973 | #endif |
1974 | if (strEQ(name, "SHRT_MAX")) |
1975 | #ifdef SHRT_MAX |
1976 | return SHRT_MAX; |
1977 | #else |
1978 | goto not_there; |
1979 | #endif |
1980 | if (strEQ(name, "SHRT_MIN")) |
1981 | #ifdef SHRT_MIN |
1982 | return SHRT_MIN; |
1983 | #else |
1984 | goto not_there; |
1985 | #endif |
774d564b |
1986 | if (strnEQ(name, "SA_", 3)) { |
1987 | if (strEQ(name, "SA_NOCLDSTOP")) |
2304df62 |
1988 | #ifdef SA_NOCLDSTOP |
774d564b |
1989 | return SA_NOCLDSTOP; |
2304df62 |
1990 | #else |
774d564b |
1991 | goto not_there; |
2304df62 |
1992 | #endif |
774d564b |
1993 | if (strEQ(name, "SA_NOCLDWAIT")) |
1994 | #ifdef SA_NOCLDWAIT |
1995 | return SA_NOCLDWAIT; |
1996 | #else |
1997 | goto not_there; |
1998 | #endif |
1999 | if (strEQ(name, "SA_NODEFER")) |
2000 | #ifdef SA_NODEFER |
2001 | return SA_NODEFER; |
2002 | #else |
2003 | goto not_there; |
2004 | #endif |
2005 | if (strEQ(name, "SA_ONSTACK")) |
2006 | #ifdef SA_ONSTACK |
2007 | return SA_ONSTACK; |
2008 | #else |
2009 | goto not_there; |
2010 | #endif |
2011 | if (strEQ(name, "SA_RESETHAND")) |
2012 | #ifdef SA_RESETHAND |
2013 | return SA_RESETHAND; |
2014 | #else |
2015 | goto not_there; |
2016 | #endif |
2017 | if (strEQ(name, "SA_RESTART")) |
2018 | #ifdef SA_RESTART |
2019 | return SA_RESTART; |
2020 | #else |
2021 | goto not_there; |
2022 | #endif |
2023 | if (strEQ(name, "SA_SIGINFO")) |
2024 | #ifdef SA_SIGINFO |
2025 | return SA_SIGINFO; |
2026 | #else |
2027 | goto not_there; |
2028 | #endif |
2029 | break; |
2030 | } |
2304df62 |
2031 | if (strEQ(name, "SCHAR_MAX")) |
2032 | #ifdef SCHAR_MAX |
2033 | return SCHAR_MAX; |
2034 | #else |
2035 | goto not_there; |
2036 | #endif |
2037 | if (strEQ(name, "SCHAR_MIN")) |
2038 | #ifdef SCHAR_MIN |
2039 | return SCHAR_MIN; |
2040 | #else |
2041 | goto not_there; |
2042 | #endif |
2043 | if (strEQ(name, "SSIZE_MAX")) |
2044 | #ifdef SSIZE_MAX |
2045 | return SSIZE_MAX; |
2046 | #else |
2047 | goto not_there; |
2048 | #endif |
2049 | if (strEQ(name, "STDIN_FILENO")) |
2050 | #ifdef STDIN_FILENO |
2051 | return STDIN_FILENO; |
2052 | #else |
2053 | goto not_there; |
2054 | #endif |
2055 | if (strEQ(name, "STDOUT_FILENO")) |
2056 | #ifdef STDOUT_FILENO |
2057 | return STDOUT_FILENO; |
2058 | #else |
2059 | goto not_there; |
2060 | #endif |
2061 | if (strEQ(name, "STRERR_FILENO")) |
2062 | #ifdef STRERR_FILENO |
2063 | return STRERR_FILENO; |
2064 | #else |
2065 | goto not_there; |
2066 | #endif |
2067 | break; |
2068 | case 'T': |
2069 | if (strEQ(name, "TCIFLUSH")) |
2070 | #ifdef TCIFLUSH |
2071 | return TCIFLUSH; |
2072 | #else |
2073 | goto not_there; |
2074 | #endif |
2075 | if (strEQ(name, "TCIOFF")) |
2076 | #ifdef TCIOFF |
2077 | return TCIOFF; |
2078 | #else |
2079 | goto not_there; |
2080 | #endif |
2081 | if (strEQ(name, "TCIOFLUSH")) |
2082 | #ifdef TCIOFLUSH |
2083 | return TCIOFLUSH; |
2084 | #else |
2085 | goto not_there; |
2086 | #endif |
2087 | if (strEQ(name, "TCION")) |
2088 | #ifdef TCION |
2089 | return TCION; |
2090 | #else |
2091 | goto not_there; |
2092 | #endif |
2093 | if (strEQ(name, "TCOFLUSH")) |
2094 | #ifdef TCOFLUSH |
2095 | return TCOFLUSH; |
2096 | #else |
2097 | goto not_there; |
2098 | #endif |
2099 | if (strEQ(name, "TCOOFF")) |
2100 | #ifdef TCOOFF |
2101 | return TCOOFF; |
2102 | #else |
2103 | goto not_there; |
2104 | #endif |
2105 | if (strEQ(name, "TCOON")) |
2106 | #ifdef TCOON |
2107 | return TCOON; |
2108 | #else |
2109 | goto not_there; |
2110 | #endif |
2111 | if (strEQ(name, "TCSADRAIN")) |
2112 | #ifdef TCSADRAIN |
2113 | return TCSADRAIN; |
2114 | #else |
2115 | goto not_there; |
2116 | #endif |
2117 | if (strEQ(name, "TCSAFLUSH")) |
2118 | #ifdef TCSAFLUSH |
2119 | return TCSAFLUSH; |
2120 | #else |
2121 | goto not_there; |
2122 | #endif |
2123 | if (strEQ(name, "TCSANOW")) |
2124 | #ifdef TCSANOW |
2125 | return TCSANOW; |
2126 | #else |
2127 | goto not_there; |
2128 | #endif |
2129 | if (strEQ(name, "TMP_MAX")) |
2130 | #ifdef TMP_MAX |
2131 | return TMP_MAX; |
2132 | #else |
2133 | goto not_there; |
2134 | #endif |
2135 | if (strEQ(name, "TOSTOP")) |
2136 | #ifdef TOSTOP |
2137 | return TOSTOP; |
2138 | #else |
2139 | goto not_there; |
2140 | #endif |
2141 | if (strEQ(name, "TZNAME_MAX")) |
2142 | #ifdef TZNAME_MAX |
2143 | return TZNAME_MAX; |
2144 | #else |
2145 | goto not_there; |
2146 | #endif |
2147 | break; |
2148 | case 'U': |
2149 | if (strEQ(name, "UCHAR_MAX")) |
2150 | #ifdef UCHAR_MAX |
2151 | return UCHAR_MAX; |
2152 | #else |
2153 | goto not_there; |
2154 | #endif |
2155 | if (strEQ(name, "UINT_MAX")) |
2156 | #ifdef UINT_MAX |
2157 | return UINT_MAX; |
2158 | #else |
2159 | goto not_there; |
2160 | #endif |
2161 | if (strEQ(name, "ULONG_MAX")) |
2162 | #ifdef ULONG_MAX |
2163 | return ULONG_MAX; |
2164 | #else |
2165 | goto not_there; |
2166 | #endif |
2167 | if (strEQ(name, "USHRT_MAX")) |
2168 | #ifdef USHRT_MAX |
2169 | return USHRT_MAX; |
2170 | #else |
2171 | goto not_there; |
2172 | #endif |
2173 | break; |
2174 | case 'V': |
2175 | if (strEQ(name, "VEOF")) |
2176 | #ifdef VEOF |
2177 | return VEOF; |
2178 | #else |
2179 | goto not_there; |
2180 | #endif |
2181 | if (strEQ(name, "VEOL")) |
2182 | #ifdef VEOL |
2183 | return VEOL; |
2184 | #else |
2185 | goto not_there; |
2186 | #endif |
2187 | if (strEQ(name, "VERASE")) |
2188 | #ifdef VERASE |
2189 | return VERASE; |
2190 | #else |
2191 | goto not_there; |
2192 | #endif |
2193 | if (strEQ(name, "VINTR")) |
2194 | #ifdef VINTR |
2195 | return VINTR; |
2196 | #else |
2197 | goto not_there; |
2198 | #endif |
2199 | if (strEQ(name, "VKILL")) |
2200 | #ifdef VKILL |
2201 | return VKILL; |
2202 | #else |
2203 | goto not_there; |
2204 | #endif |
2205 | if (strEQ(name, "VMIN")) |
2206 | #ifdef VMIN |
2207 | return VMIN; |
2208 | #else |
2209 | goto not_there; |
2210 | #endif |
2211 | if (strEQ(name, "VQUIT")) |
2212 | #ifdef VQUIT |
2213 | return VQUIT; |
2214 | #else |
2215 | goto not_there; |
2216 | #endif |
2217 | if (strEQ(name, "VSTART")) |
2218 | #ifdef VSTART |
2219 | return VSTART; |
2220 | #else |
2221 | goto not_there; |
2222 | #endif |
2223 | if (strEQ(name, "VSTOP")) |
2224 | #ifdef VSTOP |
2225 | return VSTOP; |
2226 | #else |
2227 | goto not_there; |
2228 | #endif |
2229 | if (strEQ(name, "VSUSP")) |
2230 | #ifdef VSUSP |
2231 | return VSUSP; |
2232 | #else |
2233 | goto not_there; |
2234 | #endif |
2235 | if (strEQ(name, "VTIME")) |
2236 | #ifdef VTIME |
2237 | return VTIME; |
2238 | #else |
2239 | goto not_there; |
2240 | #endif |
2241 | break; |
2242 | case 'W': |
2243 | if (strEQ(name, "W_OK")) |
2244 | #ifdef W_OK |
2245 | return W_OK; |
2246 | #else |
2247 | goto not_there; |
2248 | #endif |
4633a7c4 |
2249 | if (strEQ(name, "WNOHANG")) |
2250 | #ifdef WNOHANG |
2251 | return WNOHANG; |
2252 | #else |
2253 | goto not_there; |
2254 | #endif |
2255 | if (strEQ(name, "WUNTRACED")) |
2256 | #ifdef WUNTRACED |
2257 | return WUNTRACED; |
2258 | #else |
2259 | goto not_there; |
2260 | #endif |
2261 | errno = EAGAIN; /* the following aren't constants */ |
2304df62 |
2262 | #ifdef WEXITSTATUS |
2263 | if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg); |
2264 | #endif |
2265 | #ifdef WIFEXITED |
2266 | if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg); |
2267 | #endif |
2268 | #ifdef WIFSIGNALED |
2269 | if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg); |
2270 | #endif |
2271 | #ifdef WIFSTOPPED |
2272 | if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg); |
2273 | #endif |
2304df62 |
2274 | #ifdef WSTOPSIG |
2275 | if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg); |
2276 | #endif |
2277 | #ifdef WTERMSIG |
2278 | if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg); |
2279 | #endif |
2304df62 |
2280 | break; |
2281 | case 'X': |
2282 | if (strEQ(name, "X_OK")) |
2283 | #ifdef X_OK |
2284 | return X_OK; |
2285 | #else |
2286 | goto not_there; |
2287 | #endif |
2288 | break; |
2289 | case '_': |
2290 | if (strnEQ(name, "_PC_", 4)) { |
2291 | if (strEQ(name, "_PC_CHOWN_RESTRICTED")) |
491527d0 |
2292 | #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST |
2304df62 |
2293 | return _PC_CHOWN_RESTRICTED; |
2294 | #else |
2295 | goto not_there; |
2296 | #endif |
2297 | if (strEQ(name, "_PC_LINK_MAX")) |
491527d0 |
2298 | #if defined(_PC_LINK_MAX) || HINT_SC_EXIST |
2304df62 |
2299 | return _PC_LINK_MAX; |
2300 | #else |
2301 | goto not_there; |
2302 | #endif |
2303 | if (strEQ(name, "_PC_MAX_CANON")) |
491527d0 |
2304 | #if defined(_PC_MAX_CANON) || HINT_SC_EXIST |
2304df62 |
2305 | return _PC_MAX_CANON; |
2306 | #else |
2307 | goto not_there; |
2308 | #endif |
2309 | if (strEQ(name, "_PC_MAX_INPUT")) |
491527d0 |
2310 | #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST |
2304df62 |
2311 | return _PC_MAX_INPUT; |
2312 | #else |
2313 | goto not_there; |
2314 | #endif |
2315 | if (strEQ(name, "_PC_NAME_MAX")) |
491527d0 |
2316 | #if defined(_PC_NAME_MAX) || HINT_SC_EXIST |
2304df62 |
2317 | return _PC_NAME_MAX; |
2318 | #else |
2319 | goto not_there; |
2320 | #endif |
2321 | if (strEQ(name, "_PC_NO_TRUNC")) |
491527d0 |
2322 | #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST |
2304df62 |
2323 | return _PC_NO_TRUNC; |
2324 | #else |
2325 | goto not_there; |
2326 | #endif |
2327 | if (strEQ(name, "_PC_PATH_MAX")) |
491527d0 |
2328 | #if defined(_PC_PATH_MAX) || HINT_SC_EXIST |
2304df62 |
2329 | return _PC_PATH_MAX; |
2330 | #else |
2331 | goto not_there; |
2332 | #endif |
2333 | if (strEQ(name, "_PC_PIPE_BUF")) |
491527d0 |
2334 | #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST |
2304df62 |
2335 | return _PC_PIPE_BUF; |
2336 | #else |
2337 | goto not_there; |
2338 | #endif |
2339 | if (strEQ(name, "_PC_VDISABLE")) |
491527d0 |
2340 | #if defined(_PC_VDISABLE) || HINT_SC_EXIST |
2304df62 |
2341 | return _PC_VDISABLE; |
2342 | #else |
2343 | goto not_there; |
2344 | #endif |
2345 | break; |
2346 | } |
2347 | if (strnEQ(name, "_POSIX_", 7)) { |
2348 | if (strEQ(name, "_POSIX_ARG_MAX")) |
2349 | #ifdef _POSIX_ARG_MAX |
2350 | return _POSIX_ARG_MAX; |
2351 | #else |
2352 | return 0; |
2353 | #endif |
2354 | if (strEQ(name, "_POSIX_CHILD_MAX")) |
2355 | #ifdef _POSIX_CHILD_MAX |
2356 | return _POSIX_CHILD_MAX; |
2357 | #else |
2358 | return 0; |
2359 | #endif |
2360 | if (strEQ(name, "_POSIX_CHOWN_RESTRICTED")) |
2361 | #ifdef _POSIX_CHOWN_RESTRICTED |
2362 | return _POSIX_CHOWN_RESTRICTED; |
2363 | #else |
2364 | return 0; |
2365 | #endif |
2366 | if (strEQ(name, "_POSIX_JOB_CONTROL")) |
2367 | #ifdef _POSIX_JOB_CONTROL |
2368 | return _POSIX_JOB_CONTROL; |
2369 | #else |
2370 | return 0; |
2371 | #endif |
2372 | if (strEQ(name, "_POSIX_LINK_MAX")) |
2373 | #ifdef _POSIX_LINK_MAX |
2374 | return _POSIX_LINK_MAX; |
2375 | #else |
2376 | return 0; |
2377 | #endif |
2378 | if (strEQ(name, "_POSIX_MAX_CANON")) |
2379 | #ifdef _POSIX_MAX_CANON |
2380 | return _POSIX_MAX_CANON; |
2381 | #else |
2382 | return 0; |
2383 | #endif |
2384 | if (strEQ(name, "_POSIX_MAX_INPUT")) |
2385 | #ifdef _POSIX_MAX_INPUT |
2386 | return _POSIX_MAX_INPUT; |
2387 | #else |
2388 | return 0; |
2389 | #endif |
2390 | if (strEQ(name, "_POSIX_NAME_MAX")) |
2391 | #ifdef _POSIX_NAME_MAX |
2392 | return _POSIX_NAME_MAX; |
2393 | #else |
2394 | return 0; |
2395 | #endif |
2396 | if (strEQ(name, "_POSIX_NGROUPS_MAX")) |
2397 | #ifdef _POSIX_NGROUPS_MAX |
2398 | return _POSIX_NGROUPS_MAX; |
2399 | #else |
2400 | return 0; |
2401 | #endif |
2402 | if (strEQ(name, "_POSIX_NO_TRUNC")) |
2403 | #ifdef _POSIX_NO_TRUNC |
2404 | return _POSIX_NO_TRUNC; |
2405 | #else |
2406 | return 0; |
2407 | #endif |
2408 | if (strEQ(name, "_POSIX_OPEN_MAX")) |
2409 | #ifdef _POSIX_OPEN_MAX |
2410 | return _POSIX_OPEN_MAX; |
2411 | #else |
2412 | return 0; |
2413 | #endif |
2414 | if (strEQ(name, "_POSIX_PATH_MAX")) |
2415 | #ifdef _POSIX_PATH_MAX |
2416 | return _POSIX_PATH_MAX; |
2417 | #else |
2418 | return 0; |
2419 | #endif |
2420 | if (strEQ(name, "_POSIX_PIPE_BUF")) |
2421 | #ifdef _POSIX_PIPE_BUF |
2422 | return _POSIX_PIPE_BUF; |
2423 | #else |
2424 | return 0; |
2425 | #endif |
2426 | if (strEQ(name, "_POSIX_SAVED_IDS")) |
2427 | #ifdef _POSIX_SAVED_IDS |
2428 | return _POSIX_SAVED_IDS; |
2429 | #else |
2430 | return 0; |
2431 | #endif |
2432 | if (strEQ(name, "_POSIX_SSIZE_MAX")) |
2433 | #ifdef _POSIX_SSIZE_MAX |
2434 | return _POSIX_SSIZE_MAX; |
2435 | #else |
2436 | return 0; |
2437 | #endif |
2438 | if (strEQ(name, "_POSIX_STREAM_MAX")) |
2439 | #ifdef _POSIX_STREAM_MAX |
2440 | return _POSIX_STREAM_MAX; |
2441 | #else |
2442 | return 0; |
2443 | #endif |
2444 | if (strEQ(name, "_POSIX_TZNAME_MAX")) |
2445 | #ifdef _POSIX_TZNAME_MAX |
2446 | return _POSIX_TZNAME_MAX; |
2447 | #else |
2448 | return 0; |
2449 | #endif |
2450 | if (strEQ(name, "_POSIX_VDISABLE")) |
2451 | #ifdef _POSIX_VDISABLE |
2452 | return _POSIX_VDISABLE; |
2453 | #else |
2454 | return 0; |
2455 | #endif |
2456 | if (strEQ(name, "_POSIX_VERSION")) |
2457 | #ifdef _POSIX_VERSION |
2458 | return _POSIX_VERSION; |
2459 | #else |
2460 | return 0; |
2461 | #endif |
2462 | break; |
2463 | } |
2464 | if (strnEQ(name, "_SC_", 4)) { |
2465 | if (strEQ(name, "_SC_ARG_MAX")) |
491527d0 |
2466 | #if defined(_SC_ARG_MAX) || HINT_SC_EXIST |
2304df62 |
2467 | return _SC_ARG_MAX; |
2468 | #else |
2469 | goto not_there; |
2470 | #endif |
2471 | if (strEQ(name, "_SC_CHILD_MAX")) |
491527d0 |
2472 | #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST |
2304df62 |
2473 | return _SC_CHILD_MAX; |
2474 | #else |
2475 | goto not_there; |
2476 | #endif |
2477 | if (strEQ(name, "_SC_CLK_TCK")) |
491527d0 |
2478 | #if defined(_SC_CLK_TCK) || HINT_SC_EXIST |
2304df62 |
2479 | return _SC_CLK_TCK; |
2480 | #else |
2481 | goto not_there; |
2482 | #endif |
2483 | if (strEQ(name, "_SC_JOB_CONTROL")) |
491527d0 |
2484 | #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST |
2304df62 |
2485 | return _SC_JOB_CONTROL; |
2486 | #else |
2487 | goto not_there; |
2488 | #endif |
2489 | if (strEQ(name, "_SC_NGROUPS_MAX")) |
491527d0 |
2490 | #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST |
2304df62 |
2491 | return _SC_NGROUPS_MAX; |
2492 | #else |
2493 | goto not_there; |
2494 | #endif |
2495 | if (strEQ(name, "_SC_OPEN_MAX")) |
491527d0 |
2496 | #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST |
2304df62 |
2497 | return _SC_OPEN_MAX; |
2498 | #else |
2499 | goto not_there; |
2500 | #endif |
2501 | if (strEQ(name, "_SC_SAVED_IDS")) |
491527d0 |
2502 | #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST |
2304df62 |
2503 | return _SC_SAVED_IDS; |
2504 | #else |
2505 | goto not_there; |
2506 | #endif |
2507 | if (strEQ(name, "_SC_STREAM_MAX")) |
491527d0 |
2508 | #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST |
2304df62 |
2509 | return _SC_STREAM_MAX; |
2510 | #else |
2511 | goto not_there; |
2512 | #endif |
2513 | if (strEQ(name, "_SC_TZNAME_MAX")) |
491527d0 |
2514 | #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST |
2304df62 |
2515 | return _SC_TZNAME_MAX; |
2516 | #else |
2517 | goto not_there; |
2518 | #endif |
2519 | if (strEQ(name, "_SC_VERSION")) |
491527d0 |
2520 | #if defined(_SC_VERSION) || HINT_SC_EXIST |
2304df62 |
2521 | return _SC_VERSION; |
2522 | #else |
2523 | goto not_there; |
2524 | #endif |
2525 | break; |
2526 | } |
2304df62 |
2527 | } |
2528 | errno = EINVAL; |
2529 | return 0; |
2530 | |
2531 | not_there: |
2532 | errno = ENOENT; |
2533 | return 0; |
2534 | } |
2535 | |
2536 | MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig |
2537 | |
2538 | POSIX::SigSet |
2539 | new(packname = "POSIX::SigSet", ...) |
2540 | char * packname |
2541 | CODE: |
2542 | { |
2543 | int i; |
2544 | RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t)); |
2545 | sigemptyset(RETVAL); |
a0d0e21e |
2546 | for (i = 1; i < items; i++) |
2304df62 |
2547 | sigaddset(RETVAL, SvIV(ST(i))); |
2548 | } |
2549 | OUTPUT: |
2550 | RETVAL |
463ee0b2 |
2551 | |
8990e307 |
2552 | void |
2304df62 |
2553 | DESTROY(sigset) |
2554 | POSIX::SigSet sigset |
2555 | CODE: |
a0d0e21e |
2556 | safefree((char *)sigset); |
2304df62 |
2557 | |
2558 | SysRet |
2559 | sigaddset(sigset, sig) |
2560 | POSIX::SigSet sigset |
2561 | int sig |
2562 | |
2563 | SysRet |
2564 | sigdelset(sigset, sig) |
2565 | POSIX::SigSet sigset |
2566 | int sig |
2567 | |
2568 | SysRet |
2569 | sigemptyset(sigset) |
2570 | POSIX::SigSet sigset |
2571 | |
2572 | SysRet |
2573 | sigfillset(sigset) |
2574 | POSIX::SigSet sigset |
2575 | |
2576 | int |
2577 | sigismember(sigset, sig) |
2578 | POSIX::SigSet sigset |
2579 | int sig |
2580 | |
2581 | |
a0d0e21e |
2582 | MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf |
2583 | |
2584 | POSIX::Termios |
2585 | new(packname = "POSIX::Termios", ...) |
2586 | char * packname |
2587 | CODE: |
2588 | { |
2589 | #ifdef I_TERMIOS |
2590 | RETVAL = (struct termios*)safemalloc(sizeof(struct termios)); |
2591 | #else |
2592 | not_here("termios"); |
640cc986 |
2593 | RETVAL = 0; |
a0d0e21e |
2594 | #endif |
2595 | } |
2596 | OUTPUT: |
2597 | RETVAL |
2598 | |
2599 | void |
2600 | DESTROY(termios_ref) |
2601 | POSIX::Termios termios_ref |
2602 | CODE: |
2603 | #ifdef I_TERMIOS |
2604 | safefree((char *)termios_ref); |
2605 | #else |
2606 | not_here("termios"); |
2607 | #endif |
2608 | |
2609 | SysRet |
2610 | getattr(termios_ref, fd = 0) |
2611 | POSIX::Termios termios_ref |
2612 | int fd |
2613 | CODE: |
2614 | RETVAL = tcgetattr(fd, termios_ref); |
2615 | OUTPUT: |
2616 | RETVAL |
2617 | |
2618 | SysRet |
2619 | setattr(termios_ref, fd = 0, optional_actions = 0) |
2620 | POSIX::Termios termios_ref |
2621 | int fd |
2622 | int optional_actions |
2623 | CODE: |
2624 | RETVAL = tcsetattr(fd, optional_actions, termios_ref); |
2625 | OUTPUT: |
2626 | RETVAL |
2627 | |
2628 | speed_t |
2629 | cfgetispeed(termios_ref) |
2630 | POSIX::Termios termios_ref |
2631 | |
2632 | speed_t |
2633 | cfgetospeed(termios_ref) |
2634 | POSIX::Termios termios_ref |
2635 | |
2636 | tcflag_t |
2637 | getiflag(termios_ref) |
2638 | POSIX::Termios termios_ref |
2639 | CODE: |
2640 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2641 | RETVAL = termios_ref->c_iflag; |
2642 | #else |
640cc986 |
2643 | not_here("getiflag"); |
2644 | RETVAL = 0; |
a0d0e21e |
2645 | #endif |
2646 | OUTPUT: |
2647 | RETVAL |
2648 | |
2649 | tcflag_t |
2650 | getoflag(termios_ref) |
2651 | POSIX::Termios termios_ref |
2652 | CODE: |
2653 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2654 | RETVAL = termios_ref->c_oflag; |
2655 | #else |
640cc986 |
2656 | not_here("getoflag"); |
2657 | RETVAL = 0; |
a0d0e21e |
2658 | #endif |
2659 | OUTPUT: |
2660 | RETVAL |
2661 | |
2662 | tcflag_t |
2663 | getcflag(termios_ref) |
2664 | POSIX::Termios termios_ref |
2665 | CODE: |
2666 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2667 | RETVAL = termios_ref->c_cflag; |
2668 | #else |
640cc986 |
2669 | not_here("getcflag"); |
2670 | RETVAL = 0; |
a0d0e21e |
2671 | #endif |
2672 | OUTPUT: |
2673 | RETVAL |
2674 | |
2675 | tcflag_t |
2676 | getlflag(termios_ref) |
2677 | POSIX::Termios termios_ref |
2678 | CODE: |
2679 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2680 | RETVAL = termios_ref->c_lflag; |
2681 | #else |
640cc986 |
2682 | not_here("getlflag"); |
2683 | RETVAL = 0; |
a0d0e21e |
2684 | #endif |
2685 | OUTPUT: |
2686 | RETVAL |
2687 | |
2688 | cc_t |
2689 | getcc(termios_ref, ccix) |
2690 | POSIX::Termios termios_ref |
2691 | int ccix |
2692 | CODE: |
2693 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2694 | if (ccix >= NCCS) |
2695 | croak("Bad getcc subscript"); |
2696 | RETVAL = termios_ref->c_cc[ccix]; |
2697 | #else |
640cc986 |
2698 | not_here("getcc"); |
2699 | RETVAL = 0; |
a0d0e21e |
2700 | #endif |
2701 | OUTPUT: |
2702 | RETVAL |
2703 | |
2704 | SysRet |
2705 | cfsetispeed(termios_ref, speed) |
2706 | POSIX::Termios termios_ref |
2707 | speed_t speed |
2708 | |
2709 | SysRet |
2710 | cfsetospeed(termios_ref, speed) |
2711 | POSIX::Termios termios_ref |
2712 | speed_t speed |
2713 | |
2714 | void |
2715 | setiflag(termios_ref, iflag) |
2716 | POSIX::Termios termios_ref |
2717 | tcflag_t iflag |
2718 | CODE: |
2719 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2720 | termios_ref->c_iflag = iflag; |
2721 | #else |
2722 | not_here("setiflag"); |
2723 | #endif |
2724 | |
2725 | void |
2726 | setoflag(termios_ref, oflag) |
2727 | POSIX::Termios termios_ref |
2728 | tcflag_t oflag |
2729 | CODE: |
2730 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2731 | termios_ref->c_oflag = oflag; |
2732 | #else |
2733 | not_here("setoflag"); |
2734 | #endif |
2735 | |
2736 | void |
2737 | setcflag(termios_ref, cflag) |
2738 | POSIX::Termios termios_ref |
2739 | tcflag_t cflag |
2740 | CODE: |
2741 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2742 | termios_ref->c_cflag = cflag; |
2743 | #else |
2744 | not_here("setcflag"); |
2745 | #endif |
2746 | |
2747 | void |
2748 | setlflag(termios_ref, lflag) |
2749 | POSIX::Termios termios_ref |
2750 | tcflag_t lflag |
2751 | CODE: |
2752 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2753 | termios_ref->c_lflag = lflag; |
2754 | #else |
2755 | not_here("setlflag"); |
2756 | #endif |
2757 | |
2758 | void |
2759 | setcc(termios_ref, ccix, cc) |
2760 | POSIX::Termios termios_ref |
2761 | int ccix |
2762 | cc_t cc |
2763 | CODE: |
2764 | #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ |
2765 | if (ccix >= NCCS) |
2766 | croak("Bad setcc subscript"); |
2767 | termios_ref->c_cc[ccix] = cc; |
2768 | #else |
2769 | not_here("setcc"); |
2770 | #endif |
2771 | |
2772 | |
a0d0e21e |
2773 | MODULE = POSIX PACKAGE = POSIX |
2774 | |
2775 | double |
2304df62 |
2776 | constant(name,arg) |
2777 | char * name |
2778 | int arg |
2779 | |
2780 | int |
2781 | isalnum(charstring) |
5344da4e |
2782 | unsigned char * charstring |
2304df62 |
2783 | CODE: |
5344da4e |
2784 | unsigned char *s = charstring; |
2785 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2786 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2787 | if (!isalnum(*s)) |
2788 | RETVAL = 0; |
2789 | OUTPUT: |
2790 | RETVAL |
2791 | |
2792 | int |
2793 | isalpha(charstring) |
5344da4e |
2794 | unsigned char * charstring |
2304df62 |
2795 | CODE: |
5344da4e |
2796 | unsigned char *s = charstring; |
2797 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2798 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2799 | if (!isalpha(*s)) |
2800 | RETVAL = 0; |
2801 | OUTPUT: |
2802 | RETVAL |
2803 | |
2804 | int |
2805 | iscntrl(charstring) |
5344da4e |
2806 | unsigned char * charstring |
2304df62 |
2807 | CODE: |
5344da4e |
2808 | unsigned char *s = charstring; |
2809 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2810 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2811 | if (!iscntrl(*s)) |
2812 | RETVAL = 0; |
2813 | OUTPUT: |
2814 | RETVAL |
2815 | |
2816 | int |
2817 | isdigit(charstring) |
5344da4e |
2818 | unsigned char * charstring |
2304df62 |
2819 | CODE: |
5344da4e |
2820 | unsigned char *s = charstring; |
2821 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2822 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2823 | if (!isdigit(*s)) |
2824 | RETVAL = 0; |
2825 | OUTPUT: |
2826 | RETVAL |
2827 | |
2828 | int |
2829 | isgraph(charstring) |
5344da4e |
2830 | unsigned char * charstring |
2304df62 |
2831 | CODE: |
5344da4e |
2832 | unsigned char *s = charstring; |
2833 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2834 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2835 | if (!isgraph(*s)) |
2836 | RETVAL = 0; |
2837 | OUTPUT: |
2838 | RETVAL |
2839 | |
2840 | int |
2841 | islower(charstring) |
5344da4e |
2842 | unsigned char * charstring |
2304df62 |
2843 | CODE: |
5344da4e |
2844 | unsigned char *s = charstring; |
2845 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2846 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2847 | if (!islower(*s)) |
2848 | RETVAL = 0; |
2849 | OUTPUT: |
2850 | RETVAL |
2851 | |
2852 | int |
2853 | isprint(charstring) |
5344da4e |
2854 | unsigned char * charstring |
2304df62 |
2855 | CODE: |
5344da4e |
2856 | unsigned char *s = charstring; |
2857 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2858 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2859 | if (!isprint(*s)) |
2860 | RETVAL = 0; |
2861 | OUTPUT: |
2862 | RETVAL |
2863 | |
2864 | int |
2865 | ispunct(charstring) |
5344da4e |
2866 | unsigned char * charstring |
2304df62 |
2867 | CODE: |
5344da4e |
2868 | unsigned char *s = charstring; |
2869 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2870 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2871 | if (!ispunct(*s)) |
2872 | RETVAL = 0; |
2873 | OUTPUT: |
2874 | RETVAL |
2875 | |
2876 | int |
2877 | isspace(charstring) |
5344da4e |
2878 | unsigned char * charstring |
2304df62 |
2879 | CODE: |
5344da4e |
2880 | unsigned char *s = charstring; |
2881 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2882 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2883 | if (!isspace(*s)) |
2884 | RETVAL = 0; |
2885 | OUTPUT: |
2886 | RETVAL |
8990e307 |
2887 | |
2888 | int |
2304df62 |
2889 | isupper(charstring) |
5344da4e |
2890 | unsigned char * charstring |
2304df62 |
2891 | CODE: |
5344da4e |
2892 | unsigned char *s = charstring; |
2893 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2894 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2895 | if (!isupper(*s)) |
2896 | RETVAL = 0; |
2897 | OUTPUT: |
2898 | RETVAL |
8990e307 |
2899 | |
2900 | int |
2304df62 |
2901 | isxdigit(charstring) |
5344da4e |
2902 | unsigned char * charstring |
2304df62 |
2903 | CODE: |
5344da4e |
2904 | unsigned char *s = charstring; |
2905 | unsigned char *e = s + na; /* "na" set by typemap side effect */ |
2906 | for (RETVAL = 1; RETVAL && s < e; s++) |
2304df62 |
2907 | if (!isxdigit(*s)) |
2908 | RETVAL = 0; |
2909 | OUTPUT: |
2910 | RETVAL |
2911 | |
2912 | SysRet |
2913 | open(filename, flags = O_RDONLY, mode = 0666) |
2914 | char * filename |
2915 | int flags |
a0d0e21e |
2916 | Mode_t mode |
748a9306 |
2917 | CODE: |
2918 | if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL)) |
2919 | TAINT_PROPER("open"); |
2920 | RETVAL = open(filename, flags, mode); |
2921 | OUTPUT: |
2922 | RETVAL |
2923 | |
2304df62 |
2924 | |
2925 | HV * |
2926 | localeconv() |
2927 | CODE: |
a0d0e21e |
2928 | #ifdef HAS_LOCALECONV |
2304df62 |
2929 | struct lconv *lcbuf; |
2930 | RETVAL = newHV(); |
5f05dabc |
2931 | SET_NUMERIC_LOCAL(); |
2304df62 |
2932 | if (lcbuf = localeconv()) { |
2933 | /* the strings */ |
2934 | if (lcbuf->decimal_point && *lcbuf->decimal_point) |
2935 | hv_store(RETVAL, "decimal_point", 13, |
2936 | newSVpv(lcbuf->decimal_point, 0), 0); |
2937 | if (lcbuf->thousands_sep && *lcbuf->thousands_sep) |
2938 | hv_store(RETVAL, "thousands_sep", 13, |
2939 | newSVpv(lcbuf->thousands_sep, 0), 0); |
2940 | if (lcbuf->grouping && *lcbuf->grouping) |
2941 | hv_store(RETVAL, "grouping", 8, |
2942 | newSVpv(lcbuf->grouping, 0), 0); |
2943 | if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol) |
2944 | hv_store(RETVAL, "int_curr_symbol", 15, |
2945 | newSVpv(lcbuf->int_curr_symbol, 0), 0); |
2946 | if (lcbuf->currency_symbol && *lcbuf->currency_symbol) |
2947 | hv_store(RETVAL, "currency_symbol", 15, |
2948 | newSVpv(lcbuf->currency_symbol, 0), 0); |
2949 | if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point) |
2950 | hv_store(RETVAL, "mon_decimal_point", 17, |
2951 | newSVpv(lcbuf->mon_decimal_point, 0), 0); |
39e571d4 |
2952 | #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP |
2304df62 |
2953 | if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep) |
2954 | hv_store(RETVAL, "mon_thousands_sep", 17, |
2955 | newSVpv(lcbuf->mon_thousands_sep, 0), 0); |
39e571d4 |
2956 | #endif |
2304df62 |
2957 | if (lcbuf->mon_grouping && *lcbuf->mon_grouping) |
2958 | hv_store(RETVAL, "mon_grouping", 12, |
2959 | newSVpv(lcbuf->mon_grouping, 0), 0); |
2960 | if (lcbuf->positive_sign && *lcbuf->positive_sign) |
2961 | hv_store(RETVAL, "positive_sign", 13, |
2962 | newSVpv(lcbuf->positive_sign, 0), 0); |
2963 | if (lcbuf->negative_sign && *lcbuf->negative_sign) |
2964 | hv_store(RETVAL, "negative_sign", 13, |
2965 | newSVpv(lcbuf->negative_sign, 0), 0); |
2966 | /* the integers */ |
2967 | if (lcbuf->int_frac_digits != CHAR_MAX) |
2968 | hv_store(RETVAL, "int_frac_digits", 15, |
2969 | newSViv(lcbuf->int_frac_digits), 0); |
2970 | if (lcbuf->frac_digits != CHAR_MAX) |
2971 | hv_store(RETVAL, "frac_digits", 11, |
2972 | newSViv(lcbuf->frac_digits), 0); |
2973 | if (lcbuf->p_cs_precedes != CHAR_MAX) |
2974 | hv_store(RETVAL, "p_cs_precedes", 13, |
2975 | newSViv(lcbuf->p_cs_precedes), 0); |
2976 | if (lcbuf->p_sep_by_space != CHAR_MAX) |
2977 | hv_store(RETVAL, "p_sep_by_space", 14, |
2978 | newSViv(lcbuf->p_sep_by_space), 0); |
2979 | if (lcbuf->n_cs_precedes != CHAR_MAX) |
2980 | hv_store(RETVAL, "n_cs_precedes", 13, |
2981 | newSViv(lcbuf->n_cs_precedes), 0); |
2982 | if (lcbuf->n_sep_by_space != CHAR_MAX) |
2983 | hv_store(RETVAL, "n_sep_by_space", 14, |
2984 | newSViv(lcbuf->n_sep_by_space), 0); |
2985 | if (lcbuf->p_sign_posn != CHAR_MAX) |
2986 | hv_store(RETVAL, "p_sign_posn", 11, |
2987 | newSViv(lcbuf->p_sign_posn), 0); |
2988 | if (lcbuf->n_sign_posn != CHAR_MAX) |
2989 | hv_store(RETVAL, "n_sign_posn", 11, |
2990 | newSViv(lcbuf->n_sign_posn), 0); |
2991 | } |
a0d0e21e |
2992 | #else |
2993 | localeconv(); /* A stub to call not_here(). */ |
2994 | #endif |
2304df62 |
2995 | OUTPUT: |
2996 | RETVAL |
2997 | |
2998 | char * |
c28ee57b |
2999 | setlocale(category, locale = 0) |
2304df62 |
3000 | int category |
3001 | char * locale |
c28ee57b |
3002 | CODE: |
3003 | RETVAL = setlocale(category, locale); |
bbce6d69 |
3004 | if (RETVAL) { |
36477c24 |
3005 | #ifdef USE_LOCALE_CTYPE |
bbce6d69 |
3006 | if (category == LC_CTYPE |
3007 | #ifdef LC_ALL |
3008 | || category == LC_ALL |
3009 | #endif |
3010 | ) |
3011 | { |
3012 | char *newctype; |
3013 | #ifdef LC_ALL |
3014 | if (category == LC_ALL) |
3015 | newctype = setlocale(LC_CTYPE, NULL); |
3016 | else |
3017 | #endif |
3018 | newctype = RETVAL; |
3019 | perl_new_ctype(newctype); |
3020 | } |
36477c24 |
3021 | #endif /* USE_LOCALE_CTYPE */ |
3022 | #ifdef USE_LOCALE_COLLATE |
bbce6d69 |
3023 | if (category == LC_COLLATE |
3024 | #ifdef LC_ALL |
3025 | || category == LC_ALL |
3026 | #endif |
3027 | ) |
3028 | { |
3029 | char *newcoll; |
3030 | #ifdef LC_ALL |
3031 | if (category == LC_ALL) |
3032 | newcoll = setlocale(LC_COLLATE, NULL); |
3033 | else |
3034 | #endif |
3035 | newcoll = RETVAL; |
3036 | perl_new_collate(newcoll); |
3037 | } |
36477c24 |
3038 | #endif /* USE_LOCALE_COLLATE */ |
3039 | #ifdef USE_LOCALE_NUMERIC |
bbce6d69 |
3040 | if (category == LC_NUMERIC |
3041 | #ifdef LC_ALL |
3042 | || category == LC_ALL |
3043 | #endif |
3044 | ) |
3045 | { |
3046 | char *newnum; |
3047 | #ifdef LC_ALL |
3048 | if (category == LC_ALL) |
3049 | newnum = setlocale(LC_NUMERIC, NULL); |
3050 | else |
3051 | #endif |
3052 | newnum = RETVAL; |
3053 | perl_new_numeric(newnum); |
3054 | } |
36477c24 |
3055 | #endif /* USE_LOCALE_NUMERIC */ |
bbce6d69 |
3056 | } |
c28ee57b |
3057 | OUTPUT: |
3058 | RETVAL |
3059 | |
2304df62 |
3060 | |
3061 | double |
3062 | acos(x) |
3063 | double x |
3064 | |
3065 | double |
3066 | asin(x) |
3067 | double x |
3068 | |
3069 | double |
3070 | atan(x) |
3071 | double x |
3072 | |
3073 | double |
3074 | ceil(x) |
3075 | double x |
3076 | |
3077 | double |
3078 | cosh(x) |
3079 | double x |
3080 | |
3081 | double |
3082 | floor(x) |
3083 | double x |
3084 | |
3085 | double |
3086 | fmod(x,y) |
3087 | double x |
3088 | double y |
3089 | |
3090 | void |
3091 | frexp(x) |
3092 | double x |
3093 | PPCODE: |
3094 | int expvar; |
2304df62 |
3095 | /* (We already know stack is long enough.) */ |
3096 | PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar)))); |
3097 | PUSHs(sv_2mortal(newSViv(expvar))); |
3098 | |
3099 | double |
3100 | ldexp(x,exp) |
3101 | double x |
3102 | int exp |
3103 | |
3104 | double |
3105 | log10(x) |
3106 | double x |
3107 | |
3108 | void |
3109 | modf(x) |
3110 | double x |
3111 | PPCODE: |
3112 | double intvar; |
2304df62 |
3113 | /* (We already know stack is long enough.) */ |
3114 | PUSHs(sv_2mortal(newSVnv(modf(x,&intvar)))); |
3115 | PUSHs(sv_2mortal(newSVnv(intvar))); |
3116 | |
3117 | double |
3118 | sinh(x) |
3119 | double x |
3120 | |
3121 | double |
3b35bae3 |
3122 | tan(x) |
3123 | double x |
3124 | |
3125 | double |
2304df62 |
3126 | tanh(x) |
3127 | double x |
3128 | |
3129 | SysRet |
3130 | sigaction(sig, action, oldaction = 0) |
3131 | int sig |
3132 | POSIX::SigAction action |
3133 | POSIX::SigAction oldaction |
3134 | CODE: |
6dead956 |
3135 | #ifdef WIN32 |
3136 | RETVAL = not_here("sigaction"); |
3137 | #else |
2304df62 |
3138 | # This code is really grody because we're trying to make the signal |
3139 | # interface look beautiful, which is hard. |
3140 | |
3141 | if (!siggv) |
85e6fe83 |
3142 | gv_fetchpv("SIG", TRUE, SVt_PVHV); |
2304df62 |
3143 | |
3144 | { |
3145 | struct sigaction act; |
3146 | struct sigaction oact; |
3147 | POSIX__SigSet sigset; |
3148 | SV** svp; |
3149 | SV** sigsvp = hv_fetch(GvHVn(siggv), |
4633a7c4 |
3150 | sig_name[sig], |
3151 | strlen(sig_name[sig]), |
2304df62 |
3152 | TRUE); |
3153 | |
3154 | /* Remember old handler name if desired. */ |
3155 | if (oldaction) { |
3156 | char *hand = SvPVx(*sigsvp, na); |
3157 | svp = hv_fetch(oldaction, "HANDLER", 7, TRUE); |
3158 | sv_setpv(*svp, *hand ? hand : "DEFAULT"); |
3159 | } |
3160 | |
3161 | if (action) { |
3162 | /* Vector new handler through %SIG. (We always use sighandler |
3163 | for the C signal handler, which reads %SIG to dispatch.) */ |
3164 | svp = hv_fetch(action, "HANDLER", 7, FALSE); |
3165 | if (!svp) |
3166 | croak("Can't supply an action without a HANDLER"); |
3167 | sv_setpv(*sigsvp, SvPV(*svp, na)); |
3168 | mg_set(*sigsvp); /* handles DEFAULT and IGNORE */ |
3169 | act.sa_handler = sighandler; |
3170 | |
3171 | /* Set up any desired mask. */ |
3172 | svp = hv_fetch(action, "MASK", 4, FALSE); |
3173 | if (svp && sv_isa(*svp, "POSIX::SigSet")) { |
a0d0e21e |
3174 | unsigned long tmp; |
3175 | tmp = (unsigned long)SvNV((SV*)SvRV(*svp)); |
3176 | sigset = (sigset_t*) tmp; |
2304df62 |
3177 | act.sa_mask = *sigset; |
3178 | } |
3179 | else |
85e6fe83 |
3180 | sigemptyset(& act.sa_mask); |
2304df62 |
3181 | |
3182 | /* Set up any desired flags. */ |
3183 | svp = hv_fetch(action, "FLAGS", 5, FALSE); |
3184 | act.sa_flags = svp ? SvIV(*svp) : 0; |
3185 | } |
3186 | |
3187 | /* Now work around sigaction oddities */ |
3188 | if (action && oldaction) |
85e6fe83 |
3189 | RETVAL = sigaction(sig, & act, & oact); |
2304df62 |
3190 | else if (action) |
6c418a22 |
3191 | RETVAL = sigaction(sig, & act, (struct sigaction *)0); |
2304df62 |
3192 | else if (oldaction) |
6c418a22 |
3193 | RETVAL = sigaction(sig, (struct sigaction *)0, & oact); |
a0d0e21e |
3194 | else |
3195 | RETVAL = -1; |
2304df62 |
3196 | |
3197 | if (oldaction) { |
3198 | /* Get back the mask. */ |
3199 | svp = hv_fetch(oldaction, "MASK", 4, TRUE); |
a0d0e21e |
3200 | if (sv_isa(*svp, "POSIX::SigSet")) { |
3201 | unsigned long tmp; |
3202 | tmp = (unsigned long)SvNV((SV*)SvRV(*svp)); |
3203 | sigset = (sigset_t*) tmp; |
3204 | } |
2304df62 |
3205 | else { |
3206 | sigset = (sigset_t*)safemalloc(sizeof(sigset_t)); |
3207 | sv_setptrobj(*svp, sigset, "POSIX::SigSet"); |
3208 | } |
3209 | *sigset = oact.sa_mask; |
3210 | |
3211 | /* Get back the flags. */ |
3212 | svp = hv_fetch(oldaction, "FLAGS", 5, TRUE); |
3213 | sv_setiv(*svp, oact.sa_flags); |
3214 | } |
3215 | } |
6dead956 |
3216 | #endif |
2304df62 |
3217 | OUTPUT: |
3218 | RETVAL |
3219 | |
3220 | SysRet |
3221 | sigpending(sigset) |
3222 | POSIX::SigSet sigset |
3223 | |
3224 | SysRet |
3225 | sigprocmask(how, sigset, oldsigset = 0) |
3226 | int how |
3227 | POSIX::SigSet sigset |
3228 | POSIX::SigSet oldsigset |
3229 | |
3230 | SysRet |
3231 | sigsuspend(signal_mask) |
3232 | POSIX::SigSet signal_mask |
3233 | |
2304df62 |
3234 | void |
3235 | _exit(status) |
3236 | int status |
8990e307 |
3237 | |
85e6fe83 |
3238 | SysRet |
8990e307 |
3239 | close(fd) |
3240 | int fd |
3241 | |
85e6fe83 |
3242 | SysRet |
8990e307 |
3243 | dup(fd) |
3244 | int fd |
3245 | |
85e6fe83 |
3246 | SysRet |
8990e307 |
3247 | dup2(fd1, fd2) |
3248 | int fd1 |
3249 | int fd2 |
3250 | |
94b6baf5 |
3251 | SysRetLong |
a0d0e21e |
3252 | lseek(fd, offset, whence) |
85e6fe83 |
3253 | int fd |
3254 | Off_t offset |
3255 | int whence |
8990e307 |
3256 | |
85e6fe83 |
3257 | SysRet |
8990e307 |
3258 | nice(incr) |
3259 | int incr |
3260 | |
3261 | int |
8990e307 |
3262 | pipe() |
85e6fe83 |
3263 | PPCODE: |
3264 | int fds[2]; |
85e6fe83 |
3265 | if (pipe(fds) != -1) { |
924508f0 |
3266 | EXTEND(SP,2); |
85e6fe83 |
3267 | PUSHs(sv_2mortal(newSViv(fds[0]))); |
3268 | PUSHs(sv_2mortal(newSViv(fds[1]))); |
3269 | } |
8990e307 |
3270 | |
85e6fe83 |
3271 | SysRet |
a0d0e21e |
3272 | read(fd, buffer, nbytes) |
7747499c |
3273 | PREINIT: |
3274 | SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1); |
3275 | INPUT: |
3276 | int fd |
3277 | size_t nbytes |
3278 | char * buffer = sv_grow( sv_buffer, nbytes+1 ); |
a0d0e21e |
3279 | CLEANUP: |
7747499c |
3280 | if (RETVAL >= 0) { |
3281 | SvCUR(sv_buffer) = RETVAL; |
3282 | SvPOK_only(sv_buffer); |
3283 | *SvEND(sv_buffer) = '\0'; |
bbce6d69 |
3284 | SvTAINTED_on(sv_buffer); |
7747499c |
3285 | } |
8990e307 |
3286 | |
85e6fe83 |
3287 | SysRet |
8990e307 |
3288 | setpgid(pid, pgid) |
3289 | pid_t pid |
3290 | pid_t pgid |
3291 | |
8990e307 |
3292 | pid_t |
3293 | setsid() |
3294 | |
8990e307 |
3295 | pid_t |
3296 | tcgetpgrp(fd) |
3297 | int fd |
3298 | |
85e6fe83 |
3299 | SysRet |
8990e307 |
3300 | tcsetpgrp(fd, pgrp_id) |
3301 | int fd |
3302 | pid_t pgrp_id |
3303 | |
3304 | int |
8990e307 |
3305 | uname() |
2304df62 |
3306 | PPCODE: |
a0d0e21e |
3307 | #ifdef HAS_UNAME |
85e6fe83 |
3308 | struct utsname buf; |
85e6fe83 |
3309 | if (uname(&buf) >= 0) { |
924508f0 |
3310 | EXTEND(SP, 5); |
85e6fe83 |
3311 | PUSHs(sv_2mortal(newSVpv(buf.sysname, 0))); |
3312 | PUSHs(sv_2mortal(newSVpv(buf.nodename, 0))); |
3313 | PUSHs(sv_2mortal(newSVpv(buf.release, 0))); |
3314 | PUSHs(sv_2mortal(newSVpv(buf.version, 0))); |
3315 | PUSHs(sv_2mortal(newSVpv(buf.machine, 0))); |
8990e307 |
3316 | } |
a0d0e21e |
3317 | #else |
3318 | uname((char *) 0); /* A stub to call not_here(). */ |
3319 | #endif |
8990e307 |
3320 | |
85e6fe83 |
3321 | SysRet |
a0d0e21e |
3322 | write(fd, buffer, nbytes) |
3323 | int fd |
3324 | char * buffer |
3325 | size_t nbytes |
3326 | |
3327 | char * |
3328 | tmpnam(s = 0) |
3329 | char * s = 0; |
3330 | |
3331 | void |
3332 | abort() |
3333 | |
3334 | int |
3335 | mblen(s, n) |
3336 | char * s |
3337 | size_t n |
3338 | |
3339 | size_t |
3340 | mbstowcs(s, pwcs, n) |
3341 | wchar_t * s |
3342 | char * pwcs |
3343 | size_t n |
3344 | |
3345 | int |
3346 | mbtowc(pwc, s, n) |
3347 | wchar_t * pwc |
3348 | char * s |
3349 | size_t n |
3350 | |
3351 | int |
3352 | wcstombs(s, pwcs, n) |
3353 | char * s |
3354 | wchar_t * pwcs |
3355 | size_t n |
3356 | |
3357 | int |
3358 | wctomb(s, wchar) |
3359 | char * s |
3360 | wchar_t wchar |
3361 | |
3362 | int |
3363 | strcoll(s1, s2) |
3364 | char * s1 |
3365 | char * s2 |
3366 | |
a89d8a78 |
3367 | void |
3368 | strtod(str) |
3369 | char * str |
3370 | PREINIT: |
3371 | double num; |
3372 | char *unparsed; |
3373 | PPCODE: |
36477c24 |
3374 | SET_NUMERIC_LOCAL(); |
a89d8a78 |
3375 | num = strtod(str, &unparsed); |
3376 | PUSHs(sv_2mortal(newSVnv(num))); |
3377 | if (GIMME == G_ARRAY) { |
924508f0 |
3378 | EXTEND(SP, 1); |
a89d8a78 |
3379 | if (unparsed) |
3380 | PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); |
3381 | else |
3382 | PUSHs(&sv_undef); |
3383 | } |
3384 | |
3385 | void |
3386 | strtol(str, base = 0) |
3387 | char * str |
3388 | int base |
3389 | PREINIT: |
3390 | long num; |
3391 | char *unparsed; |
3392 | PPCODE: |
3393 | num = strtol(str, &unparsed, base); |
3394 | if (num >= IV_MIN && num <= IV_MAX) |
3395 | PUSHs(sv_2mortal(newSViv((IV)num))); |
3396 | else |
3397 | PUSHs(sv_2mortal(newSVnv((double)num))); |
3398 | if (GIMME == G_ARRAY) { |
924508f0 |
3399 | EXTEND(SP, 1); |
a89d8a78 |
3400 | if (unparsed) |
3401 | PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); |
3402 | else |
3403 | PUSHs(&sv_undef); |
3404 | } |
3405 | |
3406 | void |
3407 | strtoul(str, base = 0) |
3408 | char * str |
3409 | int base |
3410 | PREINIT: |
3411 | unsigned long num; |
3412 | char *unparsed; |
3413 | PPCODE: |
3414 | num = strtoul(str, &unparsed, base); |
3415 | if (num <= IV_MAX) |
3416 | PUSHs(sv_2mortal(newSViv((IV)num))); |
3417 | else |
3418 | PUSHs(sv_2mortal(newSVnv((double)num))); |
3419 | if (GIMME == G_ARRAY) { |
924508f0 |
3420 | EXTEND(SP, 1); |
a89d8a78 |
3421 | if (unparsed) |
3422 | PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); |
3423 | else |
3424 | PUSHs(&sv_undef); |
3425 | } |
3426 | |
a0d0e21e |
3427 | SV * |
3428 | strxfrm(src) |
3429 | SV * src |
85e6fe83 |
3430 | CODE: |
a0d0e21e |
3431 | { |
3432 | STRLEN srclen; |
3433 | STRLEN dstlen; |
3434 | char *p = SvPV(src,srclen); |
3435 | srclen++; |
748a9306 |
3436 | ST(0) = sv_2mortal(NEWSV(800,srclen)); |
a0d0e21e |
3437 | dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen); |
3438 | if (dstlen > srclen) { |
3439 | dstlen++; |
3440 | SvGROW(ST(0), dstlen); |
3441 | strxfrm(SvPVX(ST(0)), p, (size_t)dstlen); |
3442 | dstlen--; |
3443 | } |
3444 | SvCUR(ST(0)) = dstlen; |
3445 | SvPOK_only(ST(0)); |
3446 | } |
3447 | |
3448 | SysRet |
3449 | mkfifo(filename, mode) |
3450 | char * filename |
3451 | Mode_t mode |
748a9306 |
3452 | CODE: |
3453 | TAINT_PROPER("mkfifo"); |
3454 | RETVAL = mkfifo(filename, mode); |
3455 | OUTPUT: |
3456 | RETVAL |
a0d0e21e |
3457 | |
3458 | SysRet |
3459 | tcdrain(fd) |
3460 | int fd |
3461 | |
3462 | |
3463 | SysRet |
3464 | tcflow(fd, action) |
3465 | int fd |
3466 | int action |
3467 | |
3468 | |
3469 | SysRet |
3470 | tcflush(fd, queue_selector) |
3471 | int fd |
3472 | int queue_selector |
3473 | |
3474 | SysRet |
3475 | tcsendbreak(fd, duration) |
3476 | int fd |
3477 | int duration |
3478 | |
3479 | char * |
3480 | asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) |
3481 | int sec |
3482 | int min |
3483 | int hour |
3484 | int mday |
3485 | int mon |
3486 | int year |
3487 | int wday |
3488 | int yday |
3489 | int isdst |
3490 | CODE: |
3491 | { |
3492 | struct tm mytm; |
7747499c |
3493 | init_tm(&mytm); /* XXX workaround - see init_tm() above */ |
a0d0e21e |
3494 | mytm.tm_sec = sec; |
3495 | mytm.tm_min = min; |
3496 | mytm.tm_hour = hour; |
3497 | mytm.tm_mday = mday; |
3498 | mytm.tm_mon = mon; |
3499 | mytm.tm_year = year; |
3500 | mytm.tm_wday = wday; |
3501 | mytm.tm_yday = yday; |
3502 | mytm.tm_isdst = isdst; |
3503 | RETVAL = asctime(&mytm); |
3504 | } |
3505 | OUTPUT: |
3506 | RETVAL |
3507 | |
3508 | long |
3509 | clock() |
3510 | |
3511 | char * |
3512 | ctime(time) |
748a9306 |
3513 | Time_t &time |
8990e307 |
3514 | |
37120919 |
3515 | void |
3516 | times() |
3517 | PPCODE: |
3518 | struct tms tms; |
3519 | clock_t realtime; |
3520 | realtime = times( &tms ); |
924508f0 |
3521 | EXTEND(SP,5); |
9607fc9c |
3522 | PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) ); |
3523 | PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) ); |
3524 | PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) ); |
3525 | PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) ); |
3526 | PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) ); |
37120919 |
3527 | |
a0d0e21e |
3528 | double |
3529 | difftime(time1, time2) |
3530 | Time_t time1 |
3531 | Time_t time2 |
3532 | |
3533 | SysRetLong |
3534 | mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) |
3535 | int sec |
3536 | int min |
3537 | int hour |
3538 | int mday |
3539 | int mon |
3540 | int year |
3541 | int wday |
3542 | int yday |
3543 | int isdst |
3544 | CODE: |
3545 | { |
3546 | struct tm mytm; |
7747499c |
3547 | init_tm(&mytm); /* XXX workaround - see init_tm() above */ |
a0d0e21e |
3548 | mytm.tm_sec = sec; |
3549 | mytm.tm_min = min; |
3550 | mytm.tm_hour = hour; |
3551 | mytm.tm_mday = mday; |
3552 | mytm.tm_mon = mon; |
3553 | mytm.tm_year = year; |
3554 | mytm.tm_wday = wday; |
3555 | mytm.tm_yday = yday; |
3556 | mytm.tm_isdst = isdst; |
3557 | RETVAL = mktime(&mytm); |
3558 | } |
85e6fe83 |
3559 | OUTPUT: |
3560 | RETVAL |
a0d0e21e |
3561 | |
3562 | char * |
3563 | strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) |
3564 | char * fmt |
3565 | int sec |
3566 | int min |
3567 | int hour |
3568 | int mday |
3569 | int mon |
3570 | int year |
3571 | int wday |
3572 | int yday |
3573 | int isdst |
3574 | CODE: |
3575 | { |
3576 | char tmpbuf[128]; |
3577 | struct tm mytm; |
3578 | int len; |
7747499c |
3579 | init_tm(&mytm); /* XXX workaround - see init_tm() above */ |
a0d0e21e |
3580 | mytm.tm_sec = sec; |
3581 | mytm.tm_min = min; |
3582 | mytm.tm_hour = hour; |
3583 | mytm.tm_mday = mday; |
3584 | mytm.tm_mon = mon; |
3585 | mytm.tm_year = year; |
3586 | mytm.tm_wday = wday; |
3587 | mytm.tm_yday = yday; |
3588 | mytm.tm_isdst = isdst; |
3589 | len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm); |
3590 | ST(0) = sv_2mortal(newSVpv(tmpbuf, len)); |
3591 | } |
3592 | |
3593 | void |
3594 | tzset() |
3595 | |
3596 | void |
3597 | tzname() |
3598 | PPCODE: |
924508f0 |
3599 | EXTEND(SP,2); |
a0d0e21e |
3600 | PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0])))); |
3601 | PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1])))); |
3602 | |
3603 | SysRet |
3604 | access(filename, mode) |
3605 | char * filename |
3606 | Mode_t mode |
3607 | |
3608 | char * |
3609 | ctermid(s = 0) |
3610 | char * s = 0; |
3611 | |
3612 | char * |
3613 | cuserid(s = 0) |
3614 | char * s = 0; |
3615 | |
3616 | SysRetLong |
3617 | fpathconf(fd, name) |
3618 | int fd |
3619 | int name |
3620 | |
3621 | SysRetLong |
3622 | pathconf(filename, name) |
3623 | char * filename |
3624 | int name |
3625 | |
3626 | SysRet |
3627 | pause() |
3628 | |
3629 | SysRetLong |
3630 | sysconf(name) |
3631 | int name |
3632 | |
3633 | char * |
3634 | ttyname(fd) |
3635 | int fd |