Updated.
[p5sagit/p5-mst-13.2.git] / doio.c
diff --git a/doio.c b/doio.c
index e8cac8d..c01c14e 100644 (file)
--- a/doio.c
+++ b/doio.c
 #include <sys/file.h>
 #endif
 
+#if defined(HAS_SOCKET) && !defined(VMS) /* VMS handles sockets via vmsish.h */
+# include <sys/socket.h>
+# include <netdb.h>
+# ifndef ENOTSOCK
+#  ifdef I_NET_ERRNO
+#   include <net/errno.h>
+#  endif
+# endif
+#endif
+
 bool
 do_open(gv,name,len,supplied_fp)
 GV *gv;
@@ -334,7 +344,7 @@ register GV *gv;
            if (inplace) {
                TAINT_PROPER("inplace open");
                if (strEQ(oldname,"-")) {
-                   defoutgv = gv_fetchpv("STDOUT",TRUE,SVt_PVIO);
+                   setdefout(gv_fetchpv("STDOUT",TRUE,SVt_PVIO));
                    return IoIFP(GvIOp(gv));
                }
 #ifndef FLEXFILENAMES
@@ -413,7 +423,7 @@ register GV *gv;
                    do_close(gv,FALSE);
                    continue;
                }
-               defoutgv = argvoutgv;
+               setdefout(argvoutgv);
                lastfd = fileno(IoIFP(GvIOp(argvoutgv)));
                (void)Fstat(lastfd,&statbuf);
 #ifdef HAS_FCHMOD
@@ -438,7 +448,7 @@ register GV *gv;
     }
     if (inplace) {
        (void)do_close(argvoutgv,FALSE);
-       defoutgv = gv_fetchpv("STDOUT",TRUE,SVt_PVIO);
+       setdefout(gv_fetchpv("STDOUT",TRUE,SVt_PVIO));
     }
     return Nullfp;
 }
@@ -557,8 +567,8 @@ GV *gv;
 
     while (IoIFP(io)) {
 
-#ifdef USE_STD_STDIO                   /* (the code works without this) */
-       if (IoIFP(io)->_cnt > 0)        /* cheat a little, since */
+#ifdef USE_STDIO_PTR                   /* (the code works without this) */
+       if (FILE_cnt(IoIFP(io)) > 0)    /* cheat a little, since */
            return FALSE;               /* this is the most usual case */
 #endif
 
@@ -567,9 +577,9 @@ GV *gv;
            (void)ungetc(ch, IoIFP(io));
            return FALSE;
        }
-#ifdef USE_STD_STDIO
-       if (IoIFP(io)->_cnt < -1)
-           IoIFP(io)->_cnt = -1;
+#if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE)
+       if (FILE_cnt(IoIFP(io)) < -1)
+           FILE_cnt(IoIFP(io)) = -1;
 #endif
        if (op->op_flags & OPf_SPECIAL) { /* not necessarily a real EOF yet? */
            if (!nextargv(argvgv))      /* get another fp handy */