-#ifdef WIN32
-#define _POSIX_
-#endif
+#define PERL_EXT_POSIX
#ifdef NETWARE
#define _POSIX_
# define sigfillset(a) not_here("sigfillset")
# define sigismember(a,b) not_here("sigismember")
#ifndef NETWARE
+# undef setuid
+# undef setgid
# define setuid(a) not_here("setuid")
# define setgid(a) not_here("setgid")
#endif /* NETWARE */
/* Possibly needed prototypes */
char *cuserid (char *);
+#ifndef WIN32
double strtod (const char *, char **);
long strtol (const char *, char **, int);
unsigned long strtoul (const char *, char **, int);
+#endif
#ifndef HAS_CUSERID
#define cuserid(a) (char *) not_here("cuserid")
#endif
#endif
+/* Background: in most systems the low byte of the wait status
+ * is the signal (the lowest 7 bits) and the coredump flag is
+ * the eight bit, and the second lowest byte is the exit status.
+ * BeOS bucks the trend and has the bytes in different order.
+ * See beos/beos.c for how the reality is bent even in BeOS
+ * to follow the traditional. However, to make the POSIX
+ * wait W*() macros to work in BeOS, we need to unbend the
+ * reality back in place. --jhi */
+#ifdef __BEOS__
+# define WMUNGE(x) (((x) & 0xFF00) >> 8 | ((x) & 0x00FF) << 8)
+#else
+# define WMUNGE(x) (x)
+#endif
+
static int
not_here(char *s)
{
return -1;
}
-#include "constants.c"
+#include "const-c.inc"
/* These were implemented in the old "constant" subroutine. They are actually
macros that take an integer argument and return an integer result. */
if (memEQ(name, "WSTOPSIG", 8)) {
/* ^ */
#ifdef WSTOPSIG
- *arg_result = WSTOPSIG(*arg_result);
+ int i = *arg_result;
+ *arg_result = WSTOPSIG(WMUNGE(i));
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
if (memEQ(name, "WTERMSIG", 8)) {
/* ^ */
#ifdef WTERMSIG
- *arg_result = WTERMSIG(*arg_result);
+ int i = *arg_result;
+ *arg_result = WTERMSIG(WMUNGE(i));
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
case 9:
if (memEQ(name, "WIFEXITED", 9)) {
#ifdef WIFEXITED
- *arg_result = WIFEXITED(*arg_result);
+ int i = *arg_result;
+ *arg_result = WIFEXITED(WMUNGE(i));
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
case 10:
if (memEQ(name, "WIFSTOPPED", 10)) {
#ifdef WIFSTOPPED
- *arg_result = WIFSTOPPED(*arg_result);
+ int i = *arg_result;
+ *arg_result = WIFSTOPPED(WMUNGE(i));
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
if (memEQ(name, "WEXITSTATUS", 11)) {
/* ^ */
#ifdef WEXITSTATUS
- *arg_result = WEXITSTATUS(*arg_result);
+ int i = *arg_result;
+ *arg_result = WEXITSTATUS(WMUNGE(i));
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
if (memEQ(name, "WIFSIGNALED", 11)) {
/* ^ */
#ifdef WIFSIGNALED
- *arg_result = WIFSIGNALED(*arg_result);
+ int i = *arg_result;
+ *arg_result = WIFSIGNALED(WMUNGE(i));
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
MODULE = POSIX PACKAGE = POSIX
-INCLUDE: constants.xs
+INCLUDE: const-xs.inc
void
int_macro_int(sv, iv)
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isalnum(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isalpha(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!iscntrl(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isdigit(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isgraph(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!islower(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isprint(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!ispunct(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isspace(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isupper(*s))
RETVAL = 0;
unsigned char * charstring
CODE:
unsigned char *s = charstring;
- unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
+ unsigned char *e = s + SvCUR(ST(0));
for (RETVAL = 1; RETVAL && s < e; s++)
if (!isxdigit(*s))
RETVAL = 0;
STRLEN dstlen;
char *p = SvPV(src,srclen);
srclen++;
- ST(0) = sv_2mortal(NEWSV(800,srclen));
+ ST(0) = sv_2mortal(NEWSV(800,srclen*4+1));
dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
if (dstlen > srclen) {
dstlen++;