This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix a few places that said 'int', but meant 'STRLEN'
[perl5.git] / pp_sys.c
index 32ce19f..00ee2b1 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1,6 +1,6 @@
 /*    pp_sys.c
  *
- *    Copyright (c) 1991-1997, Larry Wall
+ *    Copyright (c) 1991-1999, Larry Wall
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -173,14 +173,6 @@ static int dooneliner _((char *cmd, char *filename));
 
 #endif /* no flock() */
 
-#ifndef MAXPATHLEN
-#  ifdef PATH_MAX
-#    define MAXPATHLEN PATH_MAX
-#  else
-#    define MAXPATHLEN 1024
-#  endif
-#endif
-
 #define ZBTLEN 10
 static char zero_but_true[ZBTLEN + 1] = "0 but true";
 
@@ -195,24 +187,32 @@ static char zero_but_true[ZBTLEN + 1] = "0 but true";
 /* F_OK unused: if stat() cannot find it... */
 
 #if !defined(PERL_EFF_ACCESS_R_OK) && defined(HAS_ACCESS) && defined(EFF_ONLY_OK) && !defined(NO_EFF_ONLY_OK)
-/* Digital UNIX (when the EFF_ONLY_OK gets fixed), UnixWare */
+    /* Digital UNIX (when the EFF_ONLY_OK gets fixed), UnixWare */
 #   define PERL_EFF_ACCESS_R_OK(p) (access((p), R_OK | EFF_ONLY_OK))
 #   define PERL_EFF_ACCESS_W_OK(p) (access((p), W_OK | EFF_ONLY_OK))
 #   define PERL_EFF_ACCESS_X_OK(p) (access((p), X_OK | EFF_ONLY_OK))
 #endif
 
 #if !defined(PERL_EFF_ACCESS_R_OK) && defined(HAS_EACCESS)
-/* HP SecureWare */
 #   if defined(I_SYS_SECURITY)
 #       include <sys/security.h>
 #   endif
-#   define PERL_EFF_ACCESS_R_OK(p) (eaccess((p), R_OK, ACC_SELF))
-#   define PERL_EFF_ACCESS_W_OK(p) (eaccess((p), W_OK, ACC_SELF))
-#   define PERL_EFF_ACCESS_X_OK(p) (eaccess((p), X_OK, ACC_SELF))
+    /* XXX Configure test needed for eaccess */
+#   ifdef ACC_SELF
+        /* HP SecureWare */
+#       define PERL_EFF_ACCESS_R_OK(p) (eaccess((p), R_OK, ACC_SELF))
+#       define PERL_EFF_ACCESS_W_OK(p) (eaccess((p), W_OK, ACC_SELF))
+#       define PERL_EFF_ACCESS_X_OK(p) (eaccess((p), X_OK, ACC_SELF))
+#   else
+        /* SCO */
+#       define PERL_EFF_ACCESS_R_OK(p) (eaccess((p), R_OK))
+#       define PERL_EFF_ACCESS_W_OK(p) (eaccess((p), W_OK))
+#       define PERL_EFF_ACCESS_X_OK(p) (eaccess((p), X_OK))
+#   endif
 #endif
 
 #if !defined(PERL_EFF_ACCESS_R_OK) && defined(HAS_ACCESSX) && defined(ACC_SELF)
-/* AIX */
+    /* AIX */
 #   define PERL_EFF_ACCESS_R_OK(p) (accessx((p), R_OK, ACC_SELF))
 #   define PERL_EFF_ACCESS_W_OK(p) (accessx((p), W_OK, ACC_SELF))
 #   define PERL_EFF_ACCESS_X_OK(p) (accessx((p), X_OK, ACC_SELF))
@@ -298,7 +298,8 @@ PP(pp_backtick)
 {
     djSP; dTARGET;
     PerlIO *fp;
-    char *tmps = POPp;
+    STRLEN n_a;
+    char *tmps = POPpx;
     I32 gimme = GIMME_V;
 
     TAINT_PROPER("``");
@@ -350,6 +351,8 @@ PP(pp_backtick)
 PP(pp_glob)
 {
     OP *result;
+    tryAMAGICunTARGET(iter, -1);
+
     ENTER;
 
 #ifndef VMS
@@ -359,7 +362,7 @@ PP(pp_glob)
         * so for security reasons we must assume the worst.
         */
        TAINT;
-       taint_proper(no_security, "glob");
+       taint_proper(PL_no_security, "glob");
     }
 #endif /* !VMS */
 
@@ -382,7 +385,8 @@ PP(pp_glob)
 #if 0          /* XXX never used! */
 PP(pp_indread)
 {
-    PL_last_in_gv = gv_fetchpv(SvPVx(GvSV((GV*)(*PL_stack_sp--)), PL_na), TRUE,SVt_PVIO);
+    STRLEN n_a;
+    PL_last_in_gv = gv_fetchpv(SvPVx(GvSV((GV*)(*PL_stack_sp--)), n_a), TRUE,SVt_PVIO);
     return do_readline();
 }
 #endif
@@ -397,21 +401,22 @@ PP(pp_warn)
 {
     djSP; dMARK;
     char *tmps;
+    STRLEN n_a;
     if (SP - MARK != 1) {
        dTARGET;
        do_join(TARG, &PL_sv_no, MARK, SP);
-       tmps = SvPV(TARG, PL_na);
+       tmps = SvPV(TARG, n_a);
        SP = MARK + 1;
     }
     else {
-       tmps = SvPV(TOPs, PL_na);
+       tmps = SvPV(TOPs, n_a);
     }
     if (!tmps || !*tmps) {
        SV *error = ERRSV;
        (void)SvUPGRADE(error, SVt_PV);
        if (SvPOK(error) && SvCUR(error))
            sv_catpv(error, "\t...caught");
-       tmps = SvPV(error, PL_na);
+       tmps = SvPV(error, n_a);
     }
     if (!tmps || !*tmps)
        tmps = "Warning: something's wrong";
@@ -425,15 +430,16 @@ PP(pp_die)
     char *tmps;
     SV *tmpsv = Nullsv;
     char *pat = "%s";
+    STRLEN n_a;
     if (SP - MARK != 1) {
        dTARGET;
        do_join(TARG, &PL_sv_no, MARK, SP);
-       tmps = SvPV(TARG, PL_na);
+       tmps = SvPV(TARG, n_a);
        SP = MARK + 1;
     }
     else {
        tmpsv = TOPs;
-       tmps = SvROK(tmpsv) ? Nullch : SvPV(tmpsv, PL_na);
+       tmps = SvROK(tmpsv) ? Nullch : SvPV(tmpsv, n_a);
     }
     if (!tmps || !*tmps) {
        SV *error = ERRSV;
@@ -463,7 +469,7 @@ PP(pp_die)
        else {
            if (SvPOK(error) && SvCUR(error))
                sv_catpv(error, "\t...propagated");
-           tmps = SvPV(error, PL_na);
+           tmps = SvPV(error, n_a);
        }
     }
     if (!tmps || !*tmps)
@@ -484,12 +490,12 @@ PP(pp_open)
     if (MAXARG > 1)
        sv = POPs;
     if (!isGV(TOPs))
-       DIE(no_usym, "filehandle");
+       DIE(PL_no_usym, "filehandle");
     if (MAXARG <= 1)
        sv = GvSV(TOPs);
     gv = (GV*)POPs;
     if (!isGV(gv))
-       DIE(no_usym, "filehandle");
+       DIE(PL_no_usym, "filehandle");
     if (GvIOp(gv))
        IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT;
     tmps = SvPV(sv, len);
@@ -545,7 +551,7 @@ PP(pp_pipe_op)
        goto badexit;
 
     if (SvTYPE(rgv) != SVt_PVGV || SvTYPE(wgv) != SVt_PVGV)
-       DIE(no_usym, "filehandle");
+       DIE(PL_no_usym, "filehandle");
     rstio = GvIOn(rgv);
     wstio = GvIOn(wgv);
 
@@ -570,13 +576,16 @@ PP(pp_pipe_op)
        else PerlLIO_close(fd[1]);
        goto badexit;
     }
-
+#if defined(HAS_FCNTL) && defined(F_SETFD)
+    fcntl(fd[0],F_SETFD,fd[0] > PL_maxsysfd);  /* ensure close-on-exec */
+    fcntl(fd[1],F_SETFD,fd[1] > PL_maxsysfd);  /* ensure close-on-exec */
+#endif
     RETPUSHYES;
 
 badexit:
     RETPUSHUNDEF;
 #else
-    DIE(no_func, "pipe");
+    DIE(PL_no_func, "pipe");
 #endif
 }
 
@@ -655,6 +664,7 @@ PP(pp_tie)
     char *methname;
     int how = 'P';
     U32 items;
+    STRLEN n_a;
 
     varsv = *++MARK;
     switch(SvTYPE(varsv)) {
@@ -691,7 +701,7 @@ PP(pp_tie)
        stash = gv_stashsv(*MARK, FALSE);
        if (!stash || !(gv = gv_fetchmethod(stash, methname))) {
            DIE("Can't locate object method \"%s\" via package \"%s\"",
-                methname, SvPV(*MARK,PL_na));                   
+                methname, SvPV(*MARK,n_a));                   
        }
        ENTER;
        PUSHSTACKi(PERLSI_MAGIC);
@@ -830,6 +840,7 @@ PP(pp_sselect)
     struct timeval *tbuf = &timebuf;
     I32 growsize;
     char *fd_sets[4];
+    STRLEN n_a;
 #if BYTEORDER != 0x1234 && BYTEORDER != 0x12345678
        I32 masksize;
        I32 offset;
@@ -858,8 +869,8 @@ PP(pp_sselect)
     /* If SELECT_MIN_BITS is greater than one we most probably will want
      * to align the sizes with SELECT_MIN_BITS/8 because for example
      * in many little-endian (Intel, Alpha) systems (Linux, OS/2, Digital
-     * UNIX, Solaris, NeXT) the smallest quantum select() operates on
-     * (sets bit) is 32 bits.  */
+     * UNIX, Solaris, NeXT, Rhapsody) the smallest quantum select() operates
+     * on (sets/tests/clears bits) is 32 bits.  */
     growsize = maxlen + (SELECT_MIN_BITS/8 - (maxlen % (SELECT_MIN_BITS/8)));
 #  else
     growsize = sizeof(fd_set);
@@ -898,7 +909,7 @@ PP(pp_sselect)
            continue;
        }
        else if (!SvPOK(sv))
-           SvPV_force(sv,PL_na);       /* force string conversion */
+           SvPV_force(sv,n_a); /* force string conversion */
        j = SvLEN(sv);
        if (j < growsize) {
            Sv_Grow(sv, growsize);
@@ -1225,6 +1236,7 @@ PP(pp_prtf)
     PerlIO *fp;
     SV *sv;
     MAGIC *mg;
+    STRLEN n_a;
 
     if (PL_op->op_flags & OPf_STACKED)
        gv = (GV*)*++MARK;
@@ -1255,7 +1267,7 @@ PP(pp_prtf)
     if (!(io = GvIO(gv))) {
        if (ckWARN(WARN_UNOPENED)) {
            gv_fullname3(sv, gv, Nullch);
-           warner(WARN_UNOPENED, "Filehandle %s never opened", SvPV(sv,PL_na));
+           warner(WARN_UNOPENED, "Filehandle %s never opened", SvPV(sv,n_a));
        }
        SETERRNO(EBADF,RMS$_IFI);
        goto just_say_no;
@@ -1265,10 +1277,10 @@ PP(pp_prtf)
            gv_fullname3(sv, gv, Nullch);
            if (IoIFP(io))
                warner(WARN_IO, "Filehandle %s opened only for input",
-                       SvPV(sv,PL_na));
+                       SvPV(sv,n_a));
            else if (ckWARN(WARN_CLOSED))
                warner(WARN_CLOSED, "printf on closed filehandle %s",
-                       SvPV(sv,PL_na));
+                       SvPV(sv,n_a));
        }
        SETERRNO(EBADF,IoIFP(io)?RMS$_FAC:RMS$_IFI);
        goto just_say_no;
@@ -1404,7 +1416,7 @@ PP(pp_sysread)
     }
 #else
     if (PL_op->op_type == OP_RECV)
-       DIE(no_sock_func, "recv");
+       DIE(PL_no_sock_func, "recv");
 #endif
     if (offset < 0) {
        if (-offset > blen)
@@ -1417,7 +1429,17 @@ PP(pp_sysread)
        Zero(buffer+bufsize, offset-bufsize, char);
     }
     if (PL_op->op_type == OP_SYSREAD) {
-       length = PerlLIO_read(PerlIO_fileno(IoIFP(io)), buffer+offset, length);
+#ifdef PERL_SOCK_SYSREAD_IS_RECV
+       if (IoTYPE(io) == 's') {
+           length = PerlSock_recv(PerlIO_fileno(IoIFP(io)),
+                                  buffer+offset, length, 0);
+       }
+       else
+#endif
+       {
+           length = PerlLIO_read(PerlIO_fileno(IoIFP(io)),
+                                 buffer+offset, length);
+       }
     }
     else
 #ifdef HAS_SOCKET__bad_code_maybe
@@ -1462,8 +1484,10 @@ PP(pp_syswrite)
     djSP;
     int items = (SP - PL_stack_base) - TOPMARK;
     if (items == 2) {
+       SV *sv;
         EXTEND(SP, 1);
-        PUSHs(sv_2mortal(newSViv(sv_len(*SP))));
+       sv = sv_2mortal(newSViv(sv_len(*SP)));
+       PUSHs(sv);
         PUTBACK;
     }
     return pp_send(ARGS);
@@ -1527,7 +1551,17 @@ PP(pp_send)
            offset = 0;
        if (length > blen - offset)
            length = blen - offset;
-       length = PerlLIO_write(PerlIO_fileno(IoIFP(io)), buffer+offset, length);
+#ifdef PERL_SOCK_SYSWRITE_IS_SEND
+       if (IoTYPE(io) == 's') {
+           length = PerlSock_send(PerlIO_fileno(IoIFP(io)),
+                                  buffer+offset, length, 0);
+       }
+       else
+#endif
+       {
+           length = PerlLIO_write(PerlIO_fileno(IoIFP(io)),
+                                  buffer+offset, length);
+       }
     }
 #ifdef HAS_SOCKET
     else if (SP > MARK) {
@@ -1542,7 +1576,7 @@ PP(pp_send)
 
 #else
     else
-       DIE(no_sock_func, "send");
+       DIE(PL_no_sock_func, "send");
 #endif
     if (length < 0)
        goto say_undef;
@@ -1616,11 +1650,12 @@ PP(pp_truncate)
     Off_t len = (Off_t)POPn;
     int result = 1;
     GV *tmpgv;
+    STRLEN n_a;
 
     SETERRNO(0,0);
 #if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE) || defined(F_FREESP)
     if (PL_op->op_flags & OPf_SPECIAL) {
-       tmpgv = gv_fetchpv(POPp, FALSE, SVt_PVIO);
+       tmpgv = gv_fetchpv(POPpx, FALSE, SVt_PVIO);
     do_ftruncate:
        TAINT_PROPER("truncate");
        if (!GvIO(tmpgv) || !IoIFP(GvIOp(tmpgv)) ||
@@ -1634,6 +1669,7 @@ PP(pp_truncate)
     else {
        SV *sv = POPs;
        char *name;
+       STRLEN n_a;
 
        if (SvTYPE(sv) == SVt_PVGV) {
            tmpgv = (GV*)sv;            /* *main::FRED for example */
@@ -1644,7 +1680,7 @@ PP(pp_truncate)
            goto do_ftruncate;
        }
 
-       name = SvPV(sv, PL_na);
+       name = SvPV(sv, n_a);
        TAINT_PROPER("truncate");
 #ifdef HAS_TRUNCATE
        if (truncate(name, len) < 0)
@@ -1733,7 +1769,7 @@ PP(pp_ioctl)
     if (SvPOK(argsv)) {
        if (s[SvCUR(argsv)] != 17)
            DIE("Possible memory corruption: %s overflowed 3rd argument",
-               op_name[optype]);
+               PL_op_name[optype]);
        s[SvCUR(argsv)] = 0;            /* put our null back */
        SvSETMAGIC(argsv);              /* Assume it has changed */
     }
@@ -1776,7 +1812,7 @@ PP(pp_flock)
     PUSHi(value);
     RETURN;
 #else
-    DIE(no_func, "flock()");
+    DIE(PL_no_func, "flock()");
 #endif
 }
 
@@ -1820,7 +1856,7 @@ PP(pp_socket)
 
     RETPUSHYES;
 #else
-    DIE(no_sock_func, "socket");
+    DIE(PL_no_sock_func, "socket");
 #endif
 }
 
@@ -1870,7 +1906,7 @@ PP(pp_sockpair)
 
     RETPUSHYES;
 #else
-    DIE(no_sock_func, "socketpair");
+    DIE(PL_no_sock_func, "socketpair");
 #endif
 }
 
@@ -1929,7 +1965,7 @@ nuts:
     SETERRNO(EBADF,SS$_IVCHAN);
     RETPUSHUNDEF;
 #else
-    DIE(no_sock_func, "bind");
+    DIE(PL_no_sock_func, "bind");
 #endif
 }
 
@@ -1959,7 +1995,7 @@ nuts:
     SETERRNO(EBADF,SS$_IVCHAN);
     RETPUSHUNDEF;
 #else
-    DIE(no_sock_func, "connect");
+    DIE(PL_no_sock_func, "connect");
 #endif
 }
 
@@ -1985,7 +2021,7 @@ nuts:
     SETERRNO(EBADF,SS$_IVCHAN);
     RETPUSHUNDEF;
 #else
-    DIE(no_sock_func, "listen");
+    DIE(PL_no_sock_func, "listen");
 #endif
 }
 
@@ -2042,7 +2078,7 @@ badexit:
     RETPUSHUNDEF;
 
 #else
-    DIE(no_sock_func, "accept");
+    DIE(PL_no_sock_func, "accept");
 #endif
 }
 
@@ -2066,7 +2102,7 @@ nuts:
     SETERRNO(EBADF,SS$_IVCHAN);
     RETPUSHUNDEF;
 #else
-    DIE(no_sock_func, "shutdown");
+    DIE(PL_no_sock_func, "shutdown");
 #endif
 }
 
@@ -2075,7 +2111,7 @@ PP(pp_gsockopt)
 #ifdef HAS_SOCKET
     return pp_ssockopt(ARGS);
 #else
-    DIE(no_sock_func, "getsockopt");
+    DIE(PL_no_sock_func, "getsockopt");
 #endif
 }
 
@@ -2122,8 +2158,9 @@ PP(pp_ssockopt)
            char *buf;
            int aint;
            if (SvPOKp(sv)) {
-               buf = SvPV(sv, PL_na);
-               len = PL_na;
+               STRLEN l;
+               buf = SvPV(sv, l);
+               len = l;
            }
            else {
                aint = (int)SvIV(sv);
@@ -2146,7 +2183,7 @@ nuts2:
     RETPUSHUNDEF;
 
 #else
-    DIE(no_sock_func, "setsockopt");
+    DIE(PL_no_sock_func, "setsockopt");
 #endif
 }
 
@@ -2155,7 +2192,7 @@ PP(pp_getsockname)
 #ifdef HAS_SOCKET
     return pp_getpeername(ARGS);
 #else
-    DIE(no_sock_func, "getsockname");
+    DIE(PL_no_sock_func, "getsockname");
 #endif
 }
 
@@ -2219,7 +2256,7 @@ nuts2:
     RETPUSHUNDEF;
 
 #else
-    DIE(no_sock_func, "getpeername");
+    DIE(PL_no_sock_func, "getpeername");
 #endif
 }
 
@@ -2236,6 +2273,7 @@ PP(pp_stat)
     GV *tmpgv;
     I32 gimme;
     I32 max = 13;
+    STRLEN n_a;
 
     if (PL_op->op_flags & OPf_REF) {
        tmpgv = cGVOP->op_gv;
@@ -2260,18 +2298,18 @@ PP(pp_stat)
            tmpgv = (GV*)SvRV(sv);
            goto do_fstat;
        }
-       sv_setpv(PL_statname, SvPV(sv,PL_na));
+       sv_setpv(PL_statname, SvPV(sv,n_a));
        PL_statgv = Nullgv;
 #ifdef HAS_LSTAT
        PL_laststype = PL_op->op_type;
        if (PL_op->op_type == OP_LSTAT)
-           PL_laststatval = PerlLIO_lstat(SvPV(PL_statname, PL_na), &PL_statcache);
+           PL_laststatval = PerlLIO_lstat(SvPV(PL_statname, n_a), &PL_statcache);
        else
 #endif
-           PL_laststatval = PerlLIO_stat(SvPV(PL_statname, PL_na), &PL_statcache);
+           PL_laststatval = PerlLIO_stat(SvPV(PL_statname, n_a), &PL_statcache);
        if (PL_laststatval < 0) {
-           if (ckWARN(WARN_NEWLINE) && strchr(SvPV(PL_statname, PL_na), '\n'))
-               warner(WARN_NEWLINE, warn_nl, "stat");
+           if (ckWARN(WARN_NEWLINE) && strchr(SvPV(PL_statname, n_a), '\n'))
+               warner(WARN_NEWLINE, PL_warn_nl, "stat");
            max = 0;
        }
     }
@@ -2322,8 +2360,9 @@ PP(pp_ftrread)
     I32 result;
     djSP;
 #if defined(HAS_ACCESS) && defined(R_OK)
+    STRLEN n_a;
     if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
-       result = access(TOPp, R_OK);
+       result = access(TOPpx, R_OK);
        if (result == 0)
            RETPUSHYES;
        if (result < 0)
@@ -2348,8 +2387,9 @@ PP(pp_ftrwrite)
     I32 result;
     djSP;
 #if defined(HAS_ACCESS) && defined(W_OK)
+    STRLEN n_a;
     if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
-       result = access(TOPp, W_OK);
+       result = access(TOPpx, W_OK);
        if (result == 0)
            RETPUSHYES;
        if (result < 0)
@@ -2374,8 +2414,9 @@ PP(pp_ftrexec)
     I32 result;
     djSP;
 #if defined(HAS_ACCESS) && defined(X_OK)
+    STRLEN n_a;
     if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
-       result = access(TOPp, X_OK);
+       result = access(TOPpx, X_OK);
        if (result == 0)
            RETPUSHYES;
        if (result < 0)
@@ -2400,8 +2441,9 @@ PP(pp_fteread)
     I32 result;
     djSP;
 #ifdef PERL_EFF_ACCESS_R_OK
+    STRLEN n_a;
     if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
-       result = PERL_EFF_ACCESS_R_OK(TOPp);
+       result = PERL_EFF_ACCESS_R_OK(TOPpx);
        if (result == 0)
            RETPUSHYES;
        if (result < 0)
@@ -2426,8 +2468,9 @@ PP(pp_ftewrite)
     I32 result;
     djSP;
 #ifdef PERL_EFF_ACCESS_W_OK
+    STRLEN n_a;
     if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
-       result = PERL_EFF_ACCESS_W_OK(TOPp);
+       result = PERL_EFF_ACCESS_W_OK(TOPpx);
        if (result == 0)
            RETPUSHYES;
        if (result < 0)
@@ -2452,8 +2495,9 @@ PP(pp_fteexec)
     I32 result;
     djSP;
 #ifdef PERL_EFF_ACCESS_X_OK
+    STRLEN n_a;
     if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
-       result = PERL_EFF_ACCESS_X_OK(TOPp);
+       result = PERL_EFF_ACCESS_X_OK(TOPpx);
        if (result == 0)
            RETPUSHYES;
        if (result < 0)
@@ -2674,6 +2718,7 @@ PP(pp_fttty)
     int fd;
     GV *gv;
     char *tmps = Nullch;
+    STRLEN n_a;
 
     if (PL_op->op_flags & OPf_REF)
        gv = cGVOP->op_gv;
@@ -2682,7 +2727,7 @@ PP(pp_fttty)
     else if (SvROK(TOPs) && isGV(SvRV(TOPs)))
        gv = (GV*)SvRV(POPs);
     else
-       gv = gv_fetchpv(tmps = POPp, FALSE, SVt_PVIO);
+       gv = gv_fetchpv(tmps = POPpx, FALSE, SVt_PVIO);
 
     if (GvIO(gv) && IoIFP(GvIOp(gv)))
        fd = PerlIO_fileno(IoIFP(GvIOp(gv)));
@@ -2714,6 +2759,7 @@ PP(pp_fttext)
     register IO *io;
     register SV *sv;
     GV *gv;
+    STRLEN n_a;
 
     if (PL_op->op_flags & OPf_REF)
        gv = cGVOP->op_gv;
@@ -2777,15 +2823,15 @@ PP(pp_fttext)
       really_filename:
        PL_statgv = Nullgv;
        PL_laststatval = -1;
-       sv_setpv(PL_statname, SvPV(sv, PL_na));
+       sv_setpv(PL_statname, SvPV(sv, n_a));
 #ifdef HAS_OPEN3
-       i = PerlLIO_open3(SvPV(sv, PL_na), O_RDONLY, 0);
+       i = PerlLIO_open3(SvPV(sv, n_a), O_RDONLY, 0);
 #else
-       i = PerlLIO_open(SvPV(sv, PL_na), 0);
+       i = PerlLIO_open(SvPV(sv, n_a), 0);
 #endif
        if (i < 0) {
-           if (ckWARN(WARN_NEWLINE) && strchr(SvPV(sv, PL_na), '\n'))
-               warner(WARN_NEWLINE, warn_nl, "open");
+           if (ckWARN(WARN_NEWLINE) && strchr(SvPV(sv, n_a), '\n'))
+               warner(WARN_NEWLINE, PL_warn_nl, "open");
            RETPUSHUNDEF;
        }
        PL_laststatval = PerlLIO_fstat(i, &PL_statcache);
@@ -2840,26 +2886,27 @@ PP(pp_chdir)
     djSP; dTARGET;
     char *tmps;
     SV **svp;
+    STRLEN n_a;
 
     if (MAXARG < 1)
        tmps = Nullch;
     else
-       tmps = POPp;
+       tmps = POPpx;
     if (!tmps || !*tmps) {
        svp = hv_fetch(GvHVn(PL_envgv), "HOME", 4, FALSE);
        if (svp)
-           tmps = SvPV(*svp, PL_na);
+           tmps = SvPV(*svp, n_a);
     }
     if (!tmps || !*tmps) {
        svp = hv_fetch(GvHVn(PL_envgv), "LOGDIR", 6, FALSE);
        if (svp)
-           tmps = SvPV(*svp, PL_na);
+           tmps = SvPV(*svp, n_a);
     }
 #ifdef VMS
     if (!tmps || !*tmps) {
        svp = hv_fetch(GvHVn(PL_envgv), "SYS$LOGIN", 9, FALSE);
        if (svp)
-           tmps = SvPV(*svp, PL_na);
+           tmps = SvPV(*svp, n_a);
     }
 #endif
     TAINT_PROPER("chdir");
@@ -2882,7 +2929,7 @@ PP(pp_chown)
     PUSHi(value);
     RETURN;
 #else
-    DIE(no_func, "Unsupported function chown");
+    DIE(PL_no_func, "Unsupported function chown");
 #endif
 }
 
@@ -2891,12 +2938,13 @@ PP(pp_chroot)
     djSP; dTARGET;
     char *tmps;
 #ifdef HAS_CHROOT
-    tmps = POPp;
+    STRLEN n_a;
+    tmps = POPpx;
     TAINT_PROPER("chroot");
     PUSHi( chroot(tmps) >= 0 );
     RETURN;
 #else
-    DIE(no_func, "chroot");
+    DIE(PL_no_func, "chroot");
 #endif
 }
 
@@ -2934,9 +2982,10 @@ PP(pp_rename)
 {
     djSP; dTARGET;
     int anum;
+    STRLEN n_a;
 
-    char *tmps2 = POPp;
-    char *tmps = SvPV(TOPs, PL_na);
+    char *tmps2 = POPpx;
+    char *tmps = SvPV(TOPs, n_a);
     TAINT_PROPER("rename");
 #ifdef HAS_RENAME
     anum = PerlLIO_rename(tmps, tmps2);
@@ -2960,12 +3009,13 @@ PP(pp_link)
 {
     djSP; dTARGET;
 #ifdef HAS_LINK
-    char *tmps2 = POPp;
-    char *tmps = SvPV(TOPs, PL_na);
+    STRLEN n_a;
+    char *tmps2 = POPpx;
+    char *tmps = SvPV(TOPs, n_a);
     TAINT_PROPER("link");
     SETi( link(tmps, tmps2) >= 0 );
 #else
-    DIE(no_func, "Unsupported function link");
+    DIE(PL_no_func, "Unsupported function link");
 #endif
     RETURN;
 }
@@ -2974,13 +3024,14 @@ PP(pp_symlink)
 {
     djSP; dTARGET;
 #ifdef HAS_SYMLINK
-    char *tmps2 = POPp;
-    char *tmps = SvPV(TOPs, PL_na);
+    STRLEN n_a;
+    char *tmps2 = POPpx;
+    char *tmps = SvPV(TOPs, n_a);
     TAINT_PROPER("symlink");
     SETi( symlink(tmps, tmps2) >= 0 );
     RETURN;
 #else
-    DIE(no_func, "symlink");
+    DIE(PL_no_func, "symlink");
 #endif
 }
 
@@ -2991,11 +3042,12 @@ PP(pp_readlink)
     char *tmps;
     char buf[MAXPATHLEN];
     int len;
+    STRLEN n_a;
 
 #ifndef INCOMPLETE_TAINTS
     TAINT;
 #endif
-    tmps = POPp;
+    tmps = POPpx;
     len = readlink(tmps, buf, sizeof buf);
     EXTEND(SP, 1);
     if (len < 0)
@@ -3104,7 +3156,8 @@ PP(pp_mkdir)
 #ifndef HAS_MKDIR
     int oldumask;
 #endif
-    char *tmps = SvPV(TOPs, PL_na);
+    STRLEN n_a;
+    char *tmps = SvPV(TOPs, n_a);
 
     TAINT_PROPER("mkdir");
 #ifdef HAS_MKDIR
@@ -3122,8 +3175,9 @@ PP(pp_rmdir)
 {
     djSP; dTARGET;
     char *tmps;
+    STRLEN n_a;
 
-    tmps = POPp;
+    tmps = POPpx;
     TAINT_PROPER("rmdir");
 #ifdef HAS_RMDIR
     XPUSHi( PerlDir_rmdir(tmps) >= 0 );
@@ -3139,7 +3193,8 @@ PP(pp_open_dir)
 {
     djSP;
 #if defined(Direntry_t) && defined(HAS_READDIR)
-    char *dirname = POPp;
+    STRLEN n_a;
+    char *dirname = POPpx;
     GV *gv = (GV*)POPs;
     register IO *io = GvIOn(gv);
 
@@ -3157,7 +3212,7 @@ nope:
        SETERRNO(EBADF,RMS$_DIR);
     RETPUSHUNDEF;
 #else
-    DIE(no_dir_func, "opendir");
+    DIE(PL_no_dir_func, "opendir");
 #endif
 }
 
@@ -3213,7 +3268,7 @@ nope:
     else
        RETPUSHUNDEF;
 #else
-    DIE(no_dir_func, "readdir");
+    DIE(PL_no_dir_func, "readdir");
 #endif
 }
 
@@ -3221,7 +3276,11 @@ PP(pp_telldir)
 {
     djSP; dTARGET;
 #if defined(HAS_TELLDIR) || defined(telldir)
-# ifdef NEED_TELLDIR_PROTO /* XXX does _anyone_ need this? --AD 2/20/1998 */
+ /* XXX does _anyone_ need this? --AD 2/20/1998 */
+ /* XXX netbsd still seemed to.
+    XXX HAS_TELLDIR_PROTO is new style, NEED_TELLDIR_PROTO is old style.
+    --JHI 1999-Feb-02 */
+# if !defined(HAS_TELLDIR_PROTO) || defined(NEED_TELLDIR_PROTO)
     long telldir _((DIR *));
 # endif
     GV *gv = (GV*)POPs;
@@ -3237,7 +3296,7 @@ nope:
        SETERRNO(EBADF,RMS$_ISI);
     RETPUSHUNDEF;
 #else
-    DIE(no_dir_func, "telldir");
+    DIE(PL_no_dir_func, "telldir");
 #endif
 }
 
@@ -3260,7 +3319,7 @@ nope:
        SETERRNO(EBADF,RMS$_ISI);
     RETPUSHUNDEF;
 #else
-    DIE(no_dir_func, "seekdir");
+    DIE(PL_no_dir_func, "seekdir");
 #endif
 }
 
@@ -3281,7 +3340,7 @@ nope:
        SETERRNO(EBADF,RMS$_ISI);
     RETPUSHUNDEF;
 #else
-    DIE(no_dir_func, "rewinddir");
+    DIE(PL_no_dir_func, "rewinddir");
 #endif
 }
 
@@ -3311,7 +3370,7 @@ nope:
        SETERRNO(EBADF,RMS$_IFI);
     RETPUSHUNDEF;
 #else
-    DIE(no_dir_func, "closedir");
+    DIE(PL_no_dir_func, "closedir");
 #endif
 }
 
@@ -3337,7 +3396,7 @@ PP(pp_fork)
     PUSHi(childpid);
     RETURN;
 #else
-    DIE(no_func, "Unsupported function fork");
+    DIE(PL_no_func, "Unsupported function fork");
 #endif
 }
 
@@ -3353,7 +3412,7 @@ PP(pp_wait)
     XPUSHi(childpid);
     RETURN;
 #else
-    DIE(no_func, "Unsupported function wait");
+    DIE(PL_no_func, "Unsupported function wait");
 #endif
 }
 
@@ -3372,7 +3431,7 @@ PP(pp_waitpid)
     SETi(childpid);
     RETURN;
 #else
-    DIE(no_func, "Unsupported function waitpid");
+    DIE(PL_no_func, "Unsupported function waitpid");
 #endif
 }
 
@@ -3384,10 +3443,11 @@ PP(pp_system)
     int result;
     int status;
     Sigsave_t ihand,qhand;     /* place to save signals during system() */
+    STRLEN n_a;
 
     if (SP - MARK == 1) {
        if (PL_tainting) {
-           char *junk = SvPV(TOPs, PL_na);
+           char *junk = SvPV(TOPs, n_a);
            TAINT_ENV();
            TAINT_PROPER("system");
        }
@@ -3423,7 +3483,7 @@ PP(pp_system)
     else if (SP - MARK != 1)
        value = (I32)do_aexec(Nullsv, MARK, SP);
     else {
-       value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), PL_na));
+       value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), n_a));
     }
     PerlProc__exit(-1);
 #else /* ! FORK or VMS or OS/2 */
@@ -3434,7 +3494,7 @@ PP(pp_system)
     else if (SP - MARK != 1)
        value = (I32)do_aspawn(Nullsv, (void **)MARK, (void **)SP);
     else {
-       value = (I32)do_spawn(SvPVx(sv_mortalcopy(*SP), PL_na));
+       value = (I32)do_spawn(SvPVx(sv_mortalcopy(*SP), n_a));
     }
     STATUS_NATIVE_SET(value);
     do_execfree();
@@ -3448,6 +3508,7 @@ PP(pp_exec)
 {
     djSP; dMARK; dORIGMARK; dTARGET;
     I32 value;
+    STRLEN n_a;
 
     if (PL_op->op_flags & OPf_STACKED) {
        SV *really = *++MARK;
@@ -3468,18 +3529,18 @@ PP(pp_exec)
 #endif
     else {
        if (PL_tainting) {
-           char *junk = SvPV(*SP, PL_na);
+           char *junk = SvPV(*SP, n_a);
            TAINT_ENV();
            TAINT_PROPER("exec");
        }
 #ifdef VMS
-       value = (I32)vms_do_exec(SvPVx(sv_mortalcopy(*SP), PL_na));
+       value = (I32)vms_do_exec(SvPVx(sv_mortalcopy(*SP), n_a));
 #else
 #  ifdef __OPEN_VM
-       (void) do_spawn(SvPVx(sv_mortalcopy(*SP), PL_na));
+       (void) do_spawn(SvPVx(sv_mortalcopy(*SP), n_a));
        value = 0;
 #  else
-       value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), PL_na));
+       value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), n_a));
 #  endif
 #endif
     }
@@ -3498,7 +3559,7 @@ PP(pp_kill)
     PUSHi(value);
     RETURN;
 #else
-    DIE(no_func, "Unsupported function kill");
+    DIE(PL_no_func, "Unsupported function kill");
 #endif
 }
 
@@ -3509,7 +3570,7 @@ PP(pp_getppid)
     XPUSHi( getppid() );
     RETURN;
 #else
-    DIE(no_func, "getppid");
+    DIE(PL_no_func, "getppid");
 #endif
 }
 
@@ -3534,7 +3595,7 @@ PP(pp_getpgrp)
     XPUSHi(value);
     RETURN;
 #else
-    DIE(no_func, "getpgrp()");
+    DIE(PL_no_func, "getpgrp()");
 #endif
 }
 
@@ -3563,7 +3624,7 @@ PP(pp_setpgrp)
 #endif /* USE_BSDPGRP */
     RETURN;
 #else
-    DIE(no_func, "setpgrp()");
+    DIE(PL_no_func, "setpgrp()");
 #endif
 }
 
@@ -3578,7 +3639,7 @@ PP(pp_getpriority)
     SETi( getpriority(which, who) );
     RETURN;
 #else
-    DIE(no_func, "getpriority()");
+    DIE(PL_no_func, "getpriority()");
 #endif
 }
 
@@ -3596,7 +3657,7 @@ PP(pp_setpriority)
     SETi( setpriority(which, who, niceval) >= 0 );
     RETURN;
 #else
-    DIE(no_func, "setpriority()");
+    DIE(PL_no_func, "setpriority()");
 #endif
 }
 
@@ -3728,7 +3789,7 @@ PP(pp_alarm)
     PUSHi((I32)anum);
     RETURN;
 #else
-    DIE(no_func, "Unsupported function alarm");
+    DIE(PL_no_func, "Unsupported function alarm");
 #endif
 }
 
@@ -3876,7 +3937,7 @@ PP(pp_ghbyname)
 #ifdef HAS_GETHOSTBYNAME
     return pp_ghostent(ARGS);
 #else
-    DIE(no_sock_func, "gethostbyname");
+    DIE(PL_no_sock_func, "gethostbyname");
 #endif
 }
 
@@ -3885,7 +3946,7 @@ PP(pp_ghbyaddr)
 #ifdef HAS_GETHOSTBYADDR
     return pp_ghostent(ARGS);
 #else
-    DIE(no_sock_func, "gethostbyaddr");
+    DIE(PL_no_sock_func, "gethostbyaddr");
 #endif
 }
 
@@ -3903,13 +3964,14 @@ PP(pp_ghostent)
 #endif
     struct hostent *hent;
     unsigned long len;
+    STRLEN n_a;
 
     EXTEND(SP, 10);
     if (which == OP_GHBYNAME)
 #ifdef HAS_GETHOSTBYNAME
-       hent = PerlSock_gethostbyname(POPp);
+       hent = PerlSock_gethostbyname(POPpx);
 #else
-       DIE(no_sock_func, "gethostbyname");
+       DIE(PL_no_sock_func, "gethostbyname");
 #endif
     else if (which == OP_GHBYADDR) {
 #ifdef HAS_GETHOSTBYADDR
@@ -3920,14 +3982,14 @@ PP(pp_ghostent)
 
        hent = PerlSock_gethostbyaddr(addr, (Netdb_hlen_t) addrlen, addrtype);
 #else
-       DIE(no_sock_func, "gethostbyaddr");
+       DIE(PL_no_sock_func, "gethostbyaddr");
 #endif
     }
     else
 #ifdef HAS_GETHOSTENT
        hent = PerlSock_gethostent();
 #else
-       DIE(no_sock_func, "gethostent");
+       DIE(PL_no_sock_func, "gethostent");
 #endif
 
 #ifdef HOST_NOT_FOUND
@@ -3975,7 +4037,7 @@ PP(pp_ghostent)
     }
     RETURN;
 #else
-    DIE(no_sock_func, "gethostent");
+    DIE(PL_no_sock_func, "gethostent");
 #endif
 }
 
@@ -3984,7 +4046,7 @@ PP(pp_gnbyname)
 #ifdef HAS_GETNETBYNAME
     return pp_gnetent(ARGS);
 #else
-    DIE(no_sock_func, "getnetbyname");
+    DIE(PL_no_sock_func, "getnetbyname");
 #endif
 }
 
@@ -3993,7 +4055,7 @@ PP(pp_gnbyaddr)
 #ifdef HAS_GETNETBYADDR
     return pp_gnetent(ARGS);
 #else
-    DIE(no_sock_func, "getnetbyaddr");
+    DIE(PL_no_sock_func, "getnetbyaddr");
 #endif
 }
 
@@ -4010,12 +4072,13 @@ PP(pp_gnetent)
     struct netent *PerlSock_getnetent(void);
 #endif
     struct netent *nent;
+    STRLEN n_a;
 
     if (which == OP_GNBYNAME)
 #ifdef HAS_GETNETBYNAME
-       nent = PerlSock_getnetbyname(POPp);
+       nent = PerlSock_getnetbyname(POPpx);
 #else
-        DIE(no_sock_func, "getnetbyname");
+        DIE(PL_no_sock_func, "getnetbyname");
 #endif
     else if (which == OP_GNBYADDR) {
 #ifdef HAS_GETNETBYADDR
@@ -4023,14 +4086,14 @@ PP(pp_gnetent)
        Netdb_net_t addr = (Netdb_net_t) U_L(POPn);
        nent = PerlSock_getnetbyaddr(addr, addrtype);
 #else
-       DIE(no_sock_func, "getnetbyaddr");
+       DIE(PL_no_sock_func, "getnetbyaddr");
 #endif
     }
     else
 #ifdef HAS_GETNETENT
        nent = PerlSock_getnetent();
 #else
-        DIE(no_sock_func, "getnetent");
+        DIE(PL_no_sock_func, "getnetent");
 #endif
 
     EXTEND(SP, 4);
@@ -4062,7 +4125,7 @@ PP(pp_gnetent)
 
     RETURN;
 #else
-    DIE(no_sock_func, "getnetent");
+    DIE(PL_no_sock_func, "getnetent");
 #endif
 }
 
@@ -4071,7 +4134,7 @@ PP(pp_gpbyname)
 #ifdef HAS_GETPROTOBYNAME
     return pp_gprotoent(ARGS);
 #else
-    DIE(no_sock_func, "getprotobyname");
+    DIE(PL_no_sock_func, "getprotobyname");
 #endif
 }
 
@@ -4080,7 +4143,7 @@ PP(pp_gpbynumber)
 #ifdef HAS_GETPROTOBYNUMBER
     return pp_gprotoent(ARGS);
 #else
-    DIE(no_sock_func, "getprotobynumber");
+    DIE(PL_no_sock_func, "getprotobynumber");
 #endif
 }
 
@@ -4097,24 +4160,25 @@ PP(pp_gprotoent)
     struct protoent *PerlSock_getprotoent(void);
 #endif
     struct protoent *pent;
+    STRLEN n_a;
 
     if (which == OP_GPBYNAME)
 #ifdef HAS_GETPROTOBYNAME
-       pent = PerlSock_getprotobyname(POPp);
+       pent = PerlSock_getprotobyname(POPpx);
 #else
-       DIE(no_sock_func, "getprotobyname");
+       DIE(PL_no_sock_func, "getprotobyname");
 #endif
     else if (which == OP_GPBYNUMBER)
 #ifdef HAS_GETPROTOBYNUMBER
        pent = PerlSock_getprotobynumber(POPi);
 #else
-    DIE(no_sock_func, "getprotobynumber");
+    DIE(PL_no_sock_func, "getprotobynumber");
 #endif
     else
 #ifdef HAS_GETPROTOENT
        pent = PerlSock_getprotoent();
 #else
-       DIE(no_sock_func, "getprotoent");
+       DIE(PL_no_sock_func, "getprotoent");
 #endif
 
     EXTEND(SP, 3);
@@ -4144,7 +4208,7 @@ PP(pp_gprotoent)
 
     RETURN;
 #else
-    DIE(no_sock_func, "getprotoent");
+    DIE(PL_no_sock_func, "getprotoent");
 #endif
 }
 
@@ -4153,7 +4217,7 @@ PP(pp_gsbyname)
 #ifdef HAS_GETSERVBYNAME
     return pp_gservent(ARGS);
 #else
-    DIE(no_sock_func, "getservbyname");
+    DIE(PL_no_sock_func, "getservbyname");
 #endif
 }
 
@@ -4162,7 +4226,7 @@ PP(pp_gsbyport)
 #ifdef HAS_GETSERVBYPORT
     return pp_gservent(ARGS);
 #else
-    DIE(no_sock_func, "getservbyport");
+    DIE(PL_no_sock_func, "getservbyport");
 #endif
 }
 
@@ -4179,23 +4243,24 @@ PP(pp_gservent)
     struct servent *PerlSock_getservent(void);
 #endif
     struct servent *sent;
+    STRLEN n_a;
 
     if (which == OP_GSBYNAME) {
 #ifdef HAS_GETSERVBYNAME
-       char *proto = POPp;
-       char *name = POPp;
+       char *proto = POPpx;
+       char *name = POPpx;
 
        if (proto && !*proto)
            proto = Nullch;
 
        sent = PerlSock_getservbyname(name, proto);
 #else
-       DIE(no_sock_func, "getservbyname");
+       DIE(PL_no_sock_func, "getservbyname");
 #endif
     }
     else if (which == OP_GSBYPORT) {
 #ifdef HAS_GETSERVBYPORT
-       char *proto = POPp;
+       char *proto = POPpx;
        unsigned short port = POPu;
 
 #ifdef HAS_HTONS
@@ -4203,14 +4268,14 @@ PP(pp_gservent)
 #endif
        sent = PerlSock_getservbyport(port, proto);
 #else
-       DIE(no_sock_func, "getservbyport");
+       DIE(PL_no_sock_func, "getservbyport");
 #endif
     }
     else
 #ifdef HAS_GETSERVENT
        sent = PerlSock_getservent();
 #else
-       DIE(no_sock_func, "getservent");
+       DIE(PL_no_sock_func, "getservent");
 #endif
 
     EXTEND(SP, 4);
@@ -4251,7 +4316,7 @@ PP(pp_gservent)
 
     RETURN;
 #else
-    DIE(no_sock_func, "getservent");
+    DIE(PL_no_sock_func, "getservent");
 #endif
 }
 
@@ -4262,7 +4327,7 @@ PP(pp_shostent)
     PerlSock_sethostent(TOPi);
     RETSETYES;
 #else
-    DIE(no_sock_func, "sethostent");
+    DIE(PL_no_sock_func, "sethostent");
 #endif
 }
 
@@ -4273,7 +4338,7 @@ PP(pp_snetent)
     PerlSock_setnetent(TOPi);
     RETSETYES;
 #else
-    DIE(no_sock_func, "setnetent");
+    DIE(PL_no_sock_func, "setnetent");
 #endif
 }
 
@@ -4284,7 +4349,7 @@ PP(pp_sprotoent)
     PerlSock_setprotoent(TOPi);
     RETSETYES;
 #else
-    DIE(no_sock_func, "setprotoent");
+    DIE(PL_no_sock_func, "setprotoent");
 #endif
 }
 
@@ -4295,7 +4360,7 @@ PP(pp_sservent)
     PerlSock_setservent(TOPi);
     RETSETYES;
 #else
-    DIE(no_sock_func, "setservent");
+    DIE(PL_no_sock_func, "setservent");
 #endif
 }
 
@@ -4307,7 +4372,7 @@ PP(pp_ehostent)
     EXTEND(SP,1);
     RETPUSHYES;
 #else
-    DIE(no_sock_func, "endhostent");
+    DIE(PL_no_sock_func, "endhostent");
 #endif
 }
 
@@ -4319,7 +4384,7 @@ PP(pp_enetent)
     EXTEND(SP,1);
     RETPUSHYES;
 #else
-    DIE(no_sock_func, "endnetent");
+    DIE(PL_no_sock_func, "endnetent");
 #endif
 }
 
@@ -4331,7 +4396,7 @@ PP(pp_eprotoent)
     EXTEND(SP,1);
     RETPUSHYES;
 #else
-    DIE(no_sock_func, "endprotoent");
+    DIE(PL_no_sock_func, "endprotoent");
 #endif
 }
 
@@ -4343,7 +4408,7 @@ PP(pp_eservent)
     EXTEND(SP,1);
     RETPUSHYES;
 #else
-    DIE(no_sock_func, "endservent");
+    DIE(PL_no_sock_func, "endservent");
 #endif
 }
 
@@ -4352,7 +4417,7 @@ PP(pp_gpwnam)
 #ifdef HAS_PASSWD
     return pp_gpwent(ARGS);
 #else
-    DIE(no_func, "getpwnam");
+    DIE(PL_no_func, "getpwnam");
 #endif
 }
 
@@ -4361,7 +4426,7 @@ PP(pp_gpwuid)
 #ifdef HAS_PASSWD
     return pp_gpwent(ARGS);
 #else
-    DIE(no_func, "getpwuid");
+    DIE(PL_no_func, "getpwuid");
 #endif
 }
 
@@ -4372,9 +4437,10 @@ PP(pp_gpwent)
     I32 which = PL_op->op_type;
     register SV *sv;
     struct passwd *pwent;
+    STRLEN n_a;
 
     if (which == OP_GPWNAM)
-       pwent = getpwnam(POPp);
+       pwent = getpwnam(POPpx);
     else if (which == OP_GPWUID)
        pwent = getpwuid(POPi);
     else
@@ -4453,7 +4519,7 @@ PP(pp_gpwent)
     }
     RETURN;
 #else
-    DIE(no_func, "getpwent");
+    DIE(PL_no_func, "getpwent");
 #endif
 }
 
@@ -4464,7 +4530,7 @@ PP(pp_spwent)
     setpwent();
     RETPUSHYES;
 #else
-    DIE(no_func, "setpwent");
+    DIE(PL_no_func, "setpwent");
 #endif
 }
 
@@ -4475,7 +4541,7 @@ PP(pp_epwent)
     endpwent();
     RETPUSHYES;
 #else
-    DIE(no_func, "endpwent");
+    DIE(PL_no_func, "endpwent");
 #endif
 }
 
@@ -4484,7 +4550,7 @@ PP(pp_ggrnam)
 #ifdef HAS_GROUP
     return pp_ggrent(ARGS);
 #else
-    DIE(no_func, "getgrnam");
+    DIE(PL_no_func, "getgrnam");
 #endif
 }
 
@@ -4493,7 +4559,7 @@ PP(pp_ggrgid)
 #ifdef HAS_GROUP
     return pp_ggrent(ARGS);
 #else
-    DIE(no_func, "getgrgid");
+    DIE(PL_no_func, "getgrgid");
 #endif
 }
 
@@ -4505,9 +4571,10 @@ PP(pp_ggrent)
     register char **elem;
     register SV *sv;
     struct group *grent;
+    STRLEN n_a;
 
     if (which == OP_GGRNAM)
-       grent = (struct group *)getgrnam(POPp);
+       grent = (struct group *)getgrnam(POPpx);
     else if (which == OP_GGRGID)
        grent = (struct group *)getgrgid(POPi);
     else
@@ -4547,7 +4614,7 @@ PP(pp_ggrent)
 
     RETURN;
 #else
-    DIE(no_func, "getgrent");
+    DIE(PL_no_func, "getgrent");
 #endif
 }
 
@@ -4558,7 +4625,7 @@ PP(pp_sgrent)
     setgrent();
     RETPUSHYES;
 #else
-    DIE(no_func, "setgrent");
+    DIE(PL_no_func, "setgrent");
 #endif
 }
 
@@ -4569,7 +4636,7 @@ PP(pp_egrent)
     endgrent();
     RETPUSHYES;
 #else
-    DIE(no_func, "endgrent");
+    DIE(PL_no_func, "endgrent");
 #endif
 }
 
@@ -4584,7 +4651,7 @@ PP(pp_getlogin)
     PUSHp(tmps, strlen(tmps));
     RETURN;
 #else
-    DIE(no_func, "getlogin");
+    DIE(PL_no_func, "getlogin");
 #endif
 }
 
@@ -4599,6 +4666,7 @@ PP(pp_syscall)
     register I32 i = 0;
     I32 retval = -1;
     MAGIC *mg;
+    STRLEN n_a;
 
     if (PL_tainting) {
        while (++MARK <= SP) {
@@ -4621,7 +4689,7 @@ PP(pp_syscall)
        else if (*MARK == &PL_sv_undef)
            a[i++] = 0;
        else 
-           a[i++] = (unsigned long)SvPV_force(*MARK, PL_na);
+           a[i++] = (unsigned long)SvPV_force(*MARK, n_a);
        if (i > 15)
            break;
     }
@@ -4683,7 +4751,7 @@ PP(pp_syscall)
     PUSHi(retval);
     RETURN;
 #else
-    DIE(no_func, "syscall");
+    DIE(PL_no_func, "syscall");
 #endif
 }