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