ExternalStream.st
changeset 16308 4f0cb8a09d1d
parent 16302 6e87ae369992
child 16368 1efe4d36fd3f
--- a/ExternalStream.st	Wed Apr 09 00:34:21 2014 +0200
+++ b/ExternalStream.st	Wed Apr 09 23:10:05 2014 +0200
@@ -197,7 +197,7 @@
 # define DEBUGBUFFER(buf)  \
     if (((char *)(buf) >= __survStartPtr) \
      && ((char *)(buf) < __survEndPtr)) { \
-	__fatal0("read into survivor\n"); \
+        __fatal0("read into survivor\n"); \
     }
 
 #else
@@ -223,69 +223,69 @@
 
 #  define READ(ret,f, cp, n, handleType) \
       { int __res;\
-	HANDLE h; \
-	h = _get_osfhandle(fileno(f)); \
-	if ((handleType == @symbol(socketFilePointer)) \
-	|| ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
-	  (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\
-	} else { \
-	  (ret) = __STX_C_NOINT_CALL3("_rtl_read", _rtl_read, fileno(f), (cp), (n));\
-	} \
+        HANDLE h; \
+        h = _get_osfhandle(fileno(f)); \
+        if ((handleType == @symbol(socketFilePointer)) \
+        || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
+          (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\
+        } else { \
+          (ret) = __STX_C_NOINT_CALL3("_rtl_read", _rtl_read, fileno(f), (cp), (n));\
+        } \
       }
 
 #  define WRITE(ret,f, cp, n, handleType) \
       { int __res;\
-	HANDLE h; \
-	h = _get_osfhandle(fileno(f)); \
-	if ((handleType == @symbol(socketFilePointer)) \
-	|| ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
-	  (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\
-	} else { \
-	  (ret) = __STX_C_NOINT_CALL3("_rtl_write", _rtl_write, fileno(f), (cp), (n));\
-	} \
+        HANDLE h; \
+        h = _get_osfhandle(fileno(f)); \
+        if ((handleType == @symbol(socketFilePointer)) \
+        || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
+          (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\
+        } else { \
+          (ret) = __STX_C_NOINT_CALL3("_rtl_write", _rtl_write, fileno(f), (cp), (n));\
+        } \
       }
 
 # else /* MSC */
 
 #  define READ(ret,f, cp, n, handleType) \
       { int __res;\
-	int fd; \
-	HANDLE h; \
-	fd = fileno(f); \
-	if ((handleType == @symbol(socketFileDescriptor)) \
-	 || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \
-	  (ret) = __STX_WSA_NOINT_CALL4("recv", recv, fd, (cp), (n), 0);\
-	} else { \
-	  h = _get_osfhandle(fd); \
-	  if ((handleType == @symbol(socketFilePointer)) \
-	  || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
-	    (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\
-	  } else { \
-	    (ret) = __STX_API_NOINT_CALL5("ReadFile", ReadFile, h, (cp), (n), &__res, 0);\
-	    if (ret) \
-	      ret = __res; \
-	  } \
-	} \
+        int fd; \
+        HANDLE h; \
+        fd = fileno(f); \
+        if ((handleType == @symbol(socketFileDescriptor)) \
+         || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \
+          (ret) = __STX_WSA_NOINT_CALL4("recv", recv, fd, (cp), (n), 0);\
+        } else { \
+          h = _get_osfhandle(fd); \
+          if ((handleType == @symbol(socketFilePointer)) \
+          || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
+            (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\
+          } else { \
+            (ret) = __STX_API_NOINT_CALL5("ReadFile", ReadFile, h, (cp), (n), &__res, 0);\
+            if (ret) \
+              ret = __res; \
+          } \
+        } \
       }
 #  define WRITE(ret,f, cp, n, handleType) \
       { int __res;\
-	int fd; \
-	HANDLE h; \
-	fd = fileno(f); \
-	if ((handleType == @symbol(socketFileDescriptor)) \
-	 || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \
-	  (ret) = __STX_WSA_NOINT_CALL4("send", send, fd, (cp), (n), 0);\
-	} else {\
-	  h = _get_osfhandle(fd); \
-	  if ((handleType == @symbol(socketFilePointer)) \
-	  || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
-	    (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\
-	  } else {\
-	    (ret) = __STX_API_NOINT_CALL5("WriteFile", WriteFile, h, (cp), (n), &__res, 0);\
-	    if (ret) \
-	      ret = __res; \
-	  } \
-	} \
+        int fd; \
+        HANDLE h; \
+        fd = fileno(f); \
+        if ((handleType == @symbol(socketFileDescriptor)) \
+         || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \
+          (ret) = __STX_WSA_NOINT_CALL4("send", send, fd, (cp), (n), 0);\
+        } else {\
+          h = _get_osfhandle(fd); \
+          if ((handleType == @symbol(socketFilePointer)) \
+          || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \
+            (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\
+          } else {\
+            (ret) = __STX_API_NOINT_CALL5("WriteFile", WriteFile, h, (cp), (n), &__res, 0);\
+            if (ret) \
+              ret = __res; \
+          } \
+        } \
       }
 # endif /* MSC */
 
@@ -297,56 +297,56 @@
 # define __READING__(f)                          \
     if ((__INST(didWrite) != false)              \
      && (__INST(mode) == @symbol(readwrite))) {  \
-	__INST(didWrite) = false;                \
-	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+        __INST(didWrite) = false;                \
+        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 # define __WRITING__(f)                          \
     if ((__INST(didWrite) != true)               \
      && (__INST(mode) == @symbol(readwrite))) {  \
-	__INST(didWrite) = true;                 \
-	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+        __INST(didWrite) = true;                 \
+        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 # define __UNGETC__(c, f, isBuffered)                   \
     if (isBuffered) {                                   \
-	ungetc((c), (f));                               \
+        ungetc((c), (f));                               \
     } else {                                            \
       __INST(readAhead) = __mkSmallInteger((c));            \
     }
 
 # define __READBYTE__(ret, f, buf, isBuffered, handleType)          \
     if (isBuffered) {                                   \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) >= 0) {                           \
-		*(buf) = (ret);                         \
-		(ret) = 1;                              \
-	    } else if (ferror(f)) {                     \
-		if (__threadErrno == EINTR) {           \
-		    clearerr(f);                        \
-		    continue;                           \
-		}                                       \
-	    } else {                                    \
-		(ret) = 0;                              \
-	    }                                           \
-	    break;                                      \
-	}                                               \
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) >= 0) {                           \
+                *(buf) = (ret);                         \
+                (ret) = 1;                              \
+            } else if (ferror(f)) {                     \
+                if (__threadErrno == EINTR) {           \
+                    clearerr(f);                        \
+                    continue;                           \
+                }                                       \
+            } else {                                    \
+                (ret) = 0;                              \
+            }                                           \
+            break;                                      \
+        }                                               \
     } else {                                            \
-	OBJ rA = __INST(readAhead);                     \
-	if (rA != nil) {                                \
-	    *(buf) = (char)__intVal(rA);                \
-	    __INST(readAhead) = nil;                    \
-	    (ret) = 1;                                  \
-	} else {                                        \
-	    for (;;) {                                  \
-		CLEAR_ERRNO;                            \
-		READ(ret,f, buf, 1, handleType);                    \
-		if ((ret) >= 0 || __threadErrno != EINTR)       \
-		    break;                              \
-	    }                                           \
-	}                                               \
+        OBJ rA = __INST(readAhead);                     \
+        if (rA != nil) {                                \
+            *(buf) = (char)__intVal(rA);                \
+            __INST(readAhead) = nil;                    \
+            (ret) = 1;                                  \
+        } else {                                        \
+            for (;;) {                                  \
+                CLEAR_ERRNO;                            \
+                READ(ret,f, buf, 1, handleType);                    \
+                if ((ret) >= 0 || __threadErrno != EINTR)       \
+                    break;                              \
+            }                                           \
+        }                                               \
     }
 
   /*
@@ -356,120 +356,120 @@
 # define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType)    \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (__threadErrno == EINTR) {               \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    (buf)[__offs++] = (ret);                    \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (__threadErrno == EINTR) {               \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            (buf)[__offs++] = (ret);                    \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int __offs = 0;                                 \
-							\
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__offs] = __intVal(rA);           \
-		__INST(readAhead) = nil;                \
-		(ret) = 1;                              \
-	    } else {                                    \
-		CLEAR_ERRNO;                            \
-		READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \
-		if ((ret) <= 0) {                       \
-		    if ((ret) < 0 && __threadErrno == EINTR) {  \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		}                                       \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+                                                        \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__offs] = __intVal(rA);           \
+                __INST(readAhead) = nil;                \
+                (ret) = 1;                              \
+            } else {                                    \
+                CLEAR_ERRNO;                            \
+                READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \
+                if ((ret) <= 0) {                       \
+                    if ((ret) < 0 && __threadErrno == EINTR) {  \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                }                                       \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
    }
 
 # define __READAVAILBYTES__(ret, f, buf, cnt, isBuffered, handleType) \
   {                                                     \
     int __offs = 0;                                     \
     int oldFlags;                                       \
-							\
+                                                        \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (__threadErrno == EINTR) {               \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    (buf)[__offs++] = (ret);                    \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (__threadErrno == EINTR) {               \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            (buf)[__offs++] = (ret);                    \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__offs] = __intVal(rA);           \
-		__INST(readAhead) = nil;                \
-		(ret) = 1;                              \
-		__offs += (ret);                        \
-		continue;                               \
-	    }                                           \
-	    CLEAR_ERRNO;                                \
-	    {                                           \
-	      int res;                                  \
-	      if ((handleType == @symbol(socketFilePointer)) \
-	       || ((handleType == nil) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0))) { \
-		  if (res > 0) {                        \
-		      if (res > ((cnt)-__offs))         \
-			res = (cnt)-__offs;             \
-		      READ(ret,f, (buf)+__offs, res, handleType);   \
-		  } else {                              \
-		      (ret) = 0;                        \
-		  }                                     \
-	      } else if ((handleType == @symbol(pipeFilePointer)) \
-			 || ((handleType == nil) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)))) { \
-		  if (res > 0) {                        \
-		      if (res > ((cnt)-__offs))         \
-			res = (cnt)-__offs;             \
-		      READ(ret,f, (buf)+__offs, res, handleType);   \
-		  } else                                \
-		      ret = 0;                          \
-	      } else {                                  \
-		  READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \
-	      }                                         \
-	    }                                           \
-	    if ((ret) < 0) {                            \
-		if (__threadErrno == EINTR) {                   \
-		    continue;                           \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	    break;                                      \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__offs] = __intVal(rA);           \
+                __INST(readAhead) = nil;                \
+                (ret) = 1;                              \
+                __offs += (ret);                        \
+                continue;                               \
+            }                                           \
+            CLEAR_ERRNO;                                \
+            {                                           \
+              int res;                                  \
+              if ((handleType == @symbol(socketFilePointer)) \
+               || ((handleType == nil) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0))) { \
+                  if (res > 0) {                        \
+                      if (res > ((cnt)-__offs))         \
+                        res = (cnt)-__offs;             \
+                      READ(ret,f, (buf)+__offs, res, handleType);   \
+                  } else {                              \
+                      (ret) = 0;                        \
+                  }                                     \
+              } else if ((handleType == @symbol(pipeFilePointer)) \
+                         || ((handleType == nil) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)))) { \
+                  if (res > 0) {                        \
+                      if (res > ((cnt)-__offs))         \
+                        res = (cnt)-__offs;             \
+                      READ(ret,f, (buf)+__offs, res, handleType);   \
+                  } else                                \
+                      ret = 0;                          \
+              } else {                                  \
+                  READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \
+              }                                         \
+            }                                           \
+            if ((ret) < 0) {                            \
+                if (__threadErrno == EINTR) {                   \
+                    continue;                           \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+            break;                                      \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -480,63 +480,63 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-							\
+                                                        \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (__threadErrno == EINTR) {       \
-			clearerr(f);                    \
-			/* refetch */                   \
-			buf = (char *)(obj);   \
-			continue;                       \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    (buf)[__ooffs+__offs] = (ret);              \
-	    __offs++;                                   \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (__threadErrno == EINTR) {       \
+                        clearerr(f);                    \
+                        /* refetch */                   \
+                        buf = (char *)(obj);   \
+                        continue;                       \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            (buf)[__ooffs+__offs] = (ret);              \
+            __offs++;                                   \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	while (__offs < (cnt)) {                        \
-	    char __buf[IO_BUFFER_SIZE];                 \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__ooffs+__offs] = __intVal(rA);   \
-		__INST(readAhead) = nil;                \
-		(ret) = 1;                              \
-	    } else {                                    \
-		int l;                                  \
-		CLEAR_ERRNO;                            \
-		l = (cnt)-__offs;                       \
-		if ( l > IO_BUFFER_SIZE)                \
-		  l = IO_BUFFER_SIZE;                   \
-		READ(ret,f, __buf, l, handleType);                  \
-		if ((ret) <= 0) {                       \
-		    if ((ret) < 0 && __threadErrno == EINTR) {  \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		}                                       \
-	    }                                           \
-	    if( (ret) > 0 ) {                               \
-		/* refetch */                               \
-		buf = (char *)(obj);               \
-		memcpy((buf)+__ooffs+__offs,__buf,(ret));   \
-		__offs += (ret);                            \
-	    } else {                                        \
-		(ret) = 0;                                  \
-	    }                                               \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            char __buf[IO_BUFFER_SIZE];                 \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__ooffs+__offs] = __intVal(rA);   \
+                __INST(readAhead) = nil;                \
+                (ret) = 1;                              \
+            } else {                                    \
+                int l;                                  \
+                CLEAR_ERRNO;                            \
+                l = (cnt)-__offs;                       \
+                if ( l > IO_BUFFER_SIZE)                \
+                  l = IO_BUFFER_SIZE;                   \
+                READ(ret,f, __buf, l, handleType);                  \
+                if ((ret) <= 0) {                       \
+                    if ((ret) < 0 && __threadErrno == EINTR) {  \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                }                                       \
+            }                                           \
+            if( (ret) > 0 ) {                               \
+                /* refetch */                               \
+                buf = (char *)(obj);               \
+                memcpy((buf)+__ooffs+__offs,__buf,(ret));   \
+                __offs += (ret);                            \
+            } else {                                        \
+                (ret) = 0;                                  \
+            }                                               \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -545,147 +545,147 @@
     int __ooffs = obj_offs;                          \
     int __offs = 0;                                  \
     char *buf = (char *)(obj);                       \
-						     \
+                                                     \
     (ret) = 0;                                       \
     if (isBuffered) {                                \
-	while (__offs < (cnt)) {                     \
-	    CLEAR_ERRNO;                             \
-	    (ret) = getc(f);                         \
-	    if ((ret) < 0) {                         \
-		if (ferror(f)) {                     \
-		    if (__threadErrno == EINTR) {    \
-			clearerr(f);                 \
-			/* refetch */                \
-			buf = (char *)(obj);\
-			continue;                    \
-		    }                                \
-		} else {                             \
-		    (ret) = 0;                       \
-		}                                    \
-		break;                               \
-	    }                                        \
-	    (buf)[__ooffs+__offs] = (ret);           \
-	    __offs++;                                \
-	}                                            \
-	if (__offs > 0)                              \
-	    (ret) = __offs;                          \
+        while (__offs < (cnt)) {                     \
+            CLEAR_ERRNO;                             \
+            (ret) = getc(f);                         \
+            if ((ret) < 0) {                         \
+                if (ferror(f)) {                     \
+                    if (__threadErrno == EINTR) {    \
+                        clearerr(f);                 \
+                        /* refetch */                \
+                        buf = (char *)(obj);\
+                        continue;                    \
+                    }                                \
+                } else {                             \
+                    (ret) = 0;                       \
+                }                                    \
+                break;                               \
+            }                                        \
+            (buf)[__ooffs+__offs] = (ret);           \
+            __offs++;                                \
+        }                                            \
+        if (__offs > 0)                              \
+            (ret) = __offs;                          \
     } else {                                         \
-	while (__offs < (cnt)) {                     \
-	    char __buf[IO_BUFFER_SIZE];              \
-	    OBJ rA = __INST(readAhead);              \
-	    if (rA != nil) {                         \
-		(buf)[__ooffs+__offs] = __intVal(rA);\
-		__INST(readAhead) = nil;             \
-		(ret) = 1;                           \
-		__offs += (ret);                     \
-		continue;                            \
-	    }                                        \
-	    {                                        \
-		int l;                               \
-		int res;                             \
-		CLEAR_ERRNO;                         \
-		l = (cnt)-__offs;                    \
-		if ( l > IO_BUFFER_SIZE)             \
-		    l = IO_BUFFER_SIZE;              \
-		if (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0) { \
-		    if (res > 0) {                   \
-			if (res > l)                 \
-			    res = l;                 \
-			READ(ret,f, __buf, res, handleType);     \
-		    } else {                         \
-			(ret) = 0;                   \
-		    }                                \
-		} else if (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)) { \
-		    if (res > 0) {                   \
-			if (res > l)                 \
-			    res = l;                 \
-			READ(ret,f, __buf, res, handleType);     \
-		    } else                           \
-			(ret) = 0;                   \
-		} else {                             \
-		    READ(ret,f, __buf, l, handleType);           \
-		}                                    \
-		if ((ret) < 0 && __threadErrno == EINTR) {   \
-		    continue;                        \
-		}                                    \
-	    }                                        \
-	    if( (ret) > 0 ) {                               \
-		/* refetch */                               \
-		buf = (char *)(obj);               \
-		memcpy((buf)+__ooffs+__offs,__buf,(ret));   \
-		__offs += (ret);                            \
-	    } else {                                        \
-		(ret) = 0;                                  \
-	    }                                               \
-	    break;                                      \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                     \
+            char __buf[IO_BUFFER_SIZE];              \
+            OBJ rA = __INST(readAhead);              \
+            if (rA != nil) {                         \
+                (buf)[__ooffs+__offs] = __intVal(rA);\
+                __INST(readAhead) = nil;             \
+                (ret) = 1;                           \
+                __offs += (ret);                     \
+                continue;                            \
+            }                                        \
+            {                                        \
+                int l;                               \
+                int res;                             \
+                CLEAR_ERRNO;                         \
+                l = (cnt)-__offs;                    \
+                if ( l > IO_BUFFER_SIZE)             \
+                    l = IO_BUFFER_SIZE;              \
+                if (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0) { \
+                    if (res > 0) {                   \
+                        if (res > l)                 \
+                            res = l;                 \
+                        READ(ret,f, __buf, res, handleType);     \
+                    } else {                         \
+                        (ret) = 0;                   \
+                    }                                \
+                } else if (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)) { \
+                    if (res > 0) {                   \
+                        if (res > l)                 \
+                            res = l;                 \
+                        READ(ret,f, __buf, res, handleType);     \
+                    } else                           \
+                        (ret) = 0;                   \
+                } else {                             \
+                    READ(ret,f, __buf, l, handleType);           \
+                }                                    \
+                if ((ret) < 0 && __threadErrno == EINTR) {   \
+                    continue;                        \
+                }                                    \
+            }                                        \
+            if( (ret) > 0 ) {                               \
+                /* refetch */                               \
+                buf = (char *)(obj);               \
+                memcpy((buf)+__ooffs+__offs,__buf,(ret));   \
+                __offs += (ret);                            \
+            } else {                                        \
+                (ret) = 0;                                  \
+            }                                               \
+            break;                                      \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 
 # define __WRITEBYTE__(ret, f, buf, isBuffered, handleType)         \
     if (isBuffered) {                                   \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    ret = putc(*(buf), f);                      \
-	    if ((ret) >= 0) {                           \
-		(ret) = 1;                              \
-	    } else if (ferror(f)) {                     \
-		if (__threadErrno == EINTR) {                   \
-		    clearerr(f);                        \
-		    continue;                           \
-		}                                       \
-	    } else                                      \
-		(ret) = 0;                              \
-	    break;                                      \
-	}                                               \
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            ret = putc(*(buf), f);                      \
+            if ((ret) >= 0) {                           \
+                (ret) = 1;                              \
+            } else if (ferror(f)) {                     \
+                if (__threadErrno == EINTR) {                   \
+                    clearerr(f);                        \
+                    continue;                           \
+                }                                       \
+            } else                                      \
+                (ret) = 0;                              \
+            break;                                      \
+        }                                               \
     } else {                                            \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    WRITE(ret,f, buf, 1, handleType);                       \
-	    if ((ret) >= 0 || __threadErrno != EINTR)           \
-		break;                                  \
-	}                                               \
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            WRITE(ret,f, buf, 1, handleType);                       \
+            if ((ret) >= 0 || __threadErrno != EINTR)           \
+                break;                                  \
+        }                                               \
    }
 
 # define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType)   \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
-	    if ((ret) <= 0) {                           \
-		if (ferror(f)) {                        \
-		    if (__threadErrno == EINTR) {               \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
+            if ((ret) <= 0) {                           \
+                if (ferror(f)) {                        \
+                    if (__threadErrno == EINTR) {               \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    WRITE(ret,f, (buf)+__offs, (cnt)-__offs, handleType);   \
-	    if (ret <= 0) {                             \
-		if (ret < 0 && __threadErrno == EINTR) {        \
-		    continue;                           \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            WRITE(ret,f, (buf)+__offs, (cnt)-__offs, handleType);   \
+            if (ret <= 0) {                             \
+                if (ret < 0 && __threadErrno == EINTR) {        \
+                    continue;                           \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
    }
 
 # define __WRITEBYTES_OBJ__(ret, f, obj, obj_offs, cnt, isBuffered, handleType) \
@@ -693,51 +693,51 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-							\
+                                                        \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \
-	    if ((ret) <= 0) {                           \
-		if (ferror(f)) {                        \
-		    if (__threadErrno == EINTR) {       \
-			/* refetch */                   \
-			buf = (char *)(obj);   \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \
+            if ((ret) <= 0) {                           \
+                if (ferror(f)) {                        \
+                    if (__threadErrno == EINTR) {       \
+                        /* refetch */                   \
+                        buf = (char *)(obj);   \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	while (__offs < (cnt)) {                        \
-	    char __buf[IO_BUFFER_SIZE];                 \
-	    int l;                                      \
-	    CLEAR_ERRNO;                                \
-	    l = (cnt)-__offs;                           \
-	    if ( l > IO_BUFFER_SIZE)                    \
-	      l = IO_BUFFER_SIZE;                       \
-	    /* refetch */                               \
-	    buf = (char *)(obj);               \
-	    memcpy(__buf,(buf)+__ooffs+__offs,l);       \
-	    WRITE(ret,f, __buf, l, handleType);                     \
-	    if (ret <= 0) {                             \
-		if (ret < 0 && __threadErrno == EINTR) {        \
-		    continue;                           \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            char __buf[IO_BUFFER_SIZE];                 \
+            int l;                                      \
+            CLEAR_ERRNO;                                \
+            l = (cnt)-__offs;                           \
+            if ( l > IO_BUFFER_SIZE)                    \
+              l = IO_BUFFER_SIZE;                       \
+            /* refetch */                               \
+            buf = (char *)(obj);               \
+            memcpy(__buf,(buf)+__ooffs+__offs,l);       \
+            WRITE(ret,f, __buf, l, handleType);                     \
+            if (ret <= 0) {                             \
+                if (ret < 0 && __threadErrno == EINTR) {        \
+                    continue;                           \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -746,15 +746,15 @@
 # define __READING__(f)                          \
     if ((__INST(didWrite) != false)              \
      && (__INST(mode) == @symbol(readwrite))) {  \
-	__INST(didWrite) = false;                \
-	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+        __INST(didWrite) = false;                \
+        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 # define __WRITING__(f)                          \
     if ((__INST(didWrite) != true)               \
      && (__INST(mode) == @symbol(readwrite))) {  \
-	__INST(didWrite) = true;                 \
-	OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
+        __INST(didWrite) = true;                 \
+        OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */  \
     }
 
 
@@ -764,73 +764,73 @@
 # else /* use STDIO */
 #  define __UNGETC__(c, f, isBuffered)                  \
     if (isBuffered) {                                   \
-	ungetc((c), (f));                               \
+        ungetc((c), (f));                               \
     } else {                                            \
-	__INST(readAhead) = __mkSmallInteger((c));          \
+        __INST(readAhead) = __mkSmallInteger((c));          \
     }
 # endif /* use STDIO */
 
 # ifdef NO_STDIO
 #  define __READBYTE__(ret, f, buf, isBuffered, handleType)         \
     {                                                   \
-	OBJ rA = __INST(readAhead);                     \
-	if (rA != nil) {                                \
-	    *(buf) = __intVal(rA);                      \
-	    DEBUGBUFFER(buf);                           \
-	    __INST(readAhead) = nil;                    \
-	    (ret) = 1;                                  \
-	} else {                                        \
-	    for (;;) {                                  \
-		CLEAR_ERRNO;                            \
-		(ret) = READ(f, buf, 1, handleType);    \
-		DEBUGBUFFER(buf);                       \
-		if ((ret) >= 0) break;                  \
-		if (errno != EINTR) {                   \
-		    break;                              \
-		}                                       \
-		__HANDLE_INTERRUPTS__;                  \
-	    }                                           \
-	}                                               \
+        OBJ rA = __INST(readAhead);                     \
+        if (rA != nil) {                                \
+            *(buf) = __intVal(rA);                      \
+            DEBUGBUFFER(buf);                           \
+            __INST(readAhead) = nil;                    \
+            (ret) = 1;                                  \
+        } else {                                        \
+            for (;;) {                                  \
+                CLEAR_ERRNO;                            \
+                (ret) = READ(f, buf, 1, handleType);    \
+                DEBUGBUFFER(buf);                       \
+                if ((ret) >= 0) break;                  \
+                if (errno != EINTR) {                   \
+                    break;                              \
+                }                                       \
+                __HANDLE_INTERRUPTS__;                  \
+            }                                           \
+        }                                               \
     }
 # else /* use STDIO */
 #  define __READBYTE__(ret, f, buf, isBuffered, handleType)         \
     if (isBuffered) {                                   \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) >= 0) {                           \
-		DEBUGBUFFER(buf);                       \
-		*(buf) = (ret);                         \
-		(ret) = 1;                              \
-	    } else if (ferror(f)) {                     \
-		if (errno == EINTR) {                   \
-		    __HANDLE_INTERRUPTS__;              \
-		    clearerr(f);                        \
-		    continue;                           \
-		}                                       \
-	    } else                                      \
-		(ret) = 0;                              \
-	    break;                                      \
-	}                                               \
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) >= 0) {                           \
+                DEBUGBUFFER(buf);                       \
+                *(buf) = (ret);                         \
+                (ret) = 1;                              \
+            } else if (ferror(f)) {                     \
+                if (errno == EINTR) {                   \
+                    __HANDLE_INTERRUPTS__;              \
+                    clearerr(f);                        \
+                    continue;                           \
+                }                                       \
+            } else                                      \
+                (ret) = 0;                              \
+            break;                                      \
+        }                                               \
     } else {                                            \
-	OBJ rA = __INST(readAhead);                     \
-	if (rA != nil) {                                \
-	    *(buf) = __intVal(rA);                      \
-	    DEBUGBUFFER(buf);                           \
-	    __INST(readAhead) = nil;                    \
-	    (ret) = 1;                                  \
-	} else {                                        \
-	    for (;;) {                                  \
-		CLEAR_ERRNO;                            \
-		(ret) = read(fileno(f), buf, 1);        \
-		DEBUGBUFFER(buf);                       \
-		if ((ret) >= 0) break;                  \
-		if (errno != EINTR) {                   \
-		    break;                              \
-		}                                       \
-		__HANDLE_INTERRUPTS__;                  \
-	    }                                           \
-	}                                               \
+        OBJ rA = __INST(readAhead);                     \
+        if (rA != nil) {                                \
+            *(buf) = __intVal(rA);                      \
+            DEBUGBUFFER(buf);                           \
+            __INST(readAhead) = nil;                    \
+            (ret) = 1;                                  \
+        } else {                                        \
+            for (;;) {                                  \
+                CLEAR_ERRNO;                            \
+                (ret) = read(fileno(f), buf, 1);        \
+                DEBUGBUFFER(buf);                       \
+                if ((ret) >= 0) break;                  \
+                if (errno != EINTR) {                   \
+                    break;                              \
+                }                                       \
+                __HANDLE_INTERRUPTS__;                  \
+            }                                           \
+        }                                               \
    }
 # endif /* use STDIO */
 
@@ -841,84 +841,84 @@
 # ifdef NO_STDIO
 #  define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType)   \
     {                                                   \
-	int __offs = 0, __cnt;                          \
-							\
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__offs] = __intVal(rA);           \
-		DEBUGBUFFER(buf);                       \
-		__INST(readAhead) = nil;                \
-		__offs++;                               \
-	    } else {                                    \
-		CLEAR_ERRNO;                            \
-		__cnt = READ(f, (buf)+__offs, (cnt)-__offs, handleType); \
-		DEBUGBUFFER(buf);                       \
-		if (__cnt <= 0) {                       \
-		    if (__cnt < 0 && errno == EINTR) {  \
-			__HANDLE_INTERRUPTS__;          \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		}                                       \
-		__offs += __cnt;                        \
-	    }                                           \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0, __cnt;                          \
+                                                        \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__offs] = __intVal(rA);           \
+                DEBUGBUFFER(buf);                       \
+                __INST(readAhead) = nil;                \
+                __offs++;                               \
+            } else {                                    \
+                CLEAR_ERRNO;                            \
+                __cnt = READ(f, (buf)+__offs, (cnt)-__offs, handleType); \
+                DEBUGBUFFER(buf);                       \
+                if (__cnt <= 0) {                       \
+                    if (__cnt < 0 && errno == EINTR) {  \
+                        __HANDLE_INTERRUPTS__;          \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                }                                       \
+                __offs += __cnt;                        \
+            }                                           \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
    }
 # else /* use STDIO */
 #  define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType)     \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (errno == EINTR) {               \
-			__HANDLE_INTERRUPTS__;          \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    DEBUGBUFFER(buf);                           \
-	    (buf)[__offs++] = (ret);                    \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (errno == EINTR) {               \
+                        __HANDLE_INTERRUPTS__;          \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            DEBUGBUFFER(buf);                           \
+            (buf)[__offs++] = (ret);                    \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int __offs = 0, __cnt;                          \
-	int fd = fileno(f);                             \
-							\
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		DEBUGBUFFER(buf);                       \
-		(buf)[__offs] = __intVal(rA);           \
-		__INST(readAhead) = nil;                \
-		__offs++;                               \
-	    } else {                                    \
-		CLEAR_ERRNO;                            \
-		__cnt = read(fd, (buf)+__offs, (cnt)-__offs);  \
-		DEBUGBUFFER(buf);                       \
-		if (__cnt <= 0) {                       \
-		    if (__cnt < 0 && errno == EINTR) {  \
-			__HANDLE_INTERRUPTS__;          \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		}                                       \
-		__offs += __cnt;                        \
-	    }                                           \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0, __cnt;                          \
+        int fd = fileno(f);                             \
+                                                        \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                DEBUGBUFFER(buf);                       \
+                (buf)[__offs] = __intVal(rA);           \
+                __INST(readAhead) = nil;                \
+                __offs++;                               \
+            } else {                                    \
+                CLEAR_ERRNO;                            \
+                __cnt = read(fd, (buf)+__offs, (cnt)-__offs);  \
+                DEBUGBUFFER(buf);                       \
+                if (__cnt <= 0) {                       \
+                    if (__cnt < 0 && errno == EINTR) {  \
+                        __HANDLE_INTERRUPTS__;          \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                }                                       \
+                __offs += __cnt;                        \
+            }                                           \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
    }
 
 
@@ -928,7 +928,7 @@
 
 #  if defined(F_GETFL) && defined(F_SETFL) && (defined(O_NONBLOCK) || defined(O_NDELAY) || defined(FNDELAY))
 #   define SETFLAGS(fd, flags) \
-	fcntl(fd, F_SETFL, flags)
+        fcntl(fd, F_SETFL, flags)
 
 #   if defined(O_NONBLOCK)
 #    define __STX_NONBLOCK_FLAG O_NONBLOCK
@@ -941,13 +941,13 @@
 #   endif
 
 #   define SETNONBLOCKING(fd, oldFlags) \
-	{ \
-	    int flags = fcntl(fd, F_GETFL, 0); \
-	    if (flags >= 0) { \
-		fcntl(fd, F_SETFL, flags | __STX_NONBLOCK_FLAG); \
-	    } \
-	    oldFlags = flags; \
-	}
+        { \
+            int flags = fcntl(fd, F_GETFL, 0); \
+            if (flags >= 0) { \
+                fcntl(fd, F_SETFL, flags | __STX_NONBLOCK_FLAG); \
+            } \
+            oldFlags = flags; \
+        }
 #  else
 #   define SETFLAGS(fd, flags) /* nothing */
 #   define SETNONBLOCKING(fd, oldFlags) /* nothing */
@@ -957,52 +957,52 @@
   {                                                     \
     int __offs = 0, __cnt;                              \
     int oldFlags;                                       \
-							\
+                                                        \
     (ret) = 0;                                          \
     SETNONBLOCKING(fileno(f), oldFlags);                \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (errno == EINTR) {               \
-			(ret) = 0;                      \
-			clearerr(f);                    \
-			break;                          \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    (buf)[__offs++] = (ret);                    \
-	    DEBUGBUFFER(buf);                           \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (errno == EINTR) {               \
+                        (ret) = 0;                      \
+                        clearerr(f);                    \
+                        break;                          \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            (buf)[__offs++] = (ret);                    \
+            DEBUGBUFFER(buf);                           \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int fd = fileno(f);                             \
-							\
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__offs] = __intVal(rA);           \
-		DEBUGBUFFER(buf);                       \
-		__INST(readAhead) = nil;                \
-		__offs++;                               \
-		continue;                               \
-	    }                                           \
-	    CLEAR_ERRNO;                                \
-	    __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \
-	    DEBUGBUFFER(buf);                           \
-	    if (__cnt > 0) {                            \
-		__offs += __cnt;                        \
-	    }                                           \
-	    break;                                      \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int fd = fileno(f);                             \
+                                                        \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__offs] = __intVal(rA);           \
+                DEBUGBUFFER(buf);                       \
+                __INST(readAhead) = nil;                \
+                __offs++;                               \
+                continue;                               \
+            }                                           \
+            CLEAR_ERRNO;                                \
+            __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \
+            DEBUGBUFFER(buf);                           \
+            if (__cnt > 0) {                            \
+                __offs += __cnt;                        \
+            }                                           \
+            break;                                      \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
     SETFLAGS(fileno(f), oldFlags);                      \
   }
@@ -1020,34 +1020,34 @@
     int __offs = 0;                                     \
     int __cnt;                                          \
     char *buf = (char *)(obj);                          \
-							\
+                                                        \
     (ret) = 0;                                          \
     {                                                   \
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__ooffs+__offs] = __intVal(rA);   \
-		DEBUGBUFFER(buf);                       \
-		__INST(readAhead) = nil;                \
-		__offs++;                               \
-	    } else {                                    \
-		CLEAR_ERRNO;                            \
-		__cnt = READ(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
-		DEBUGBUFFER(buf);                       \
-		if (__cnt <= 0) {                       \
-		    if (__cnt < 0 && errno == EINTR) {  \
-			__HANDLE_INTERRUPTS__;          \
-			/* refetch */                   \
-			buf = (char *)(obj);            \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		}                                       \
-		__offs += __cnt;                        \
-	    }                                           \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__ooffs+__offs] = __intVal(rA);   \
+                DEBUGBUFFER(buf);                       \
+                __INST(readAhead) = nil;                \
+                __offs++;                               \
+            } else {                                    \
+                CLEAR_ERRNO;                            \
+                __cnt = READ(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
+                DEBUGBUFFER(buf);                       \
+                if (__cnt <= 0) {                       \
+                    if (__cnt < 0 && errno == EINTR) {  \
+                        __HANDLE_INTERRUPTS__;          \
+                        /* refetch */                   \
+                        buf = (char *)(obj);            \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                }                                       \
+                __offs += __cnt;                        \
+            }                                           \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -1059,61 +1059,61 @@
     int __offs = 0;                                     \
     int __cnt;                                          \
     char *buf = (char *)(obj);                          \
-							\
+                                                        \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (errno == EINTR) {               \
-			__HANDLE_INTERRUPTS__;          \
-			clearerr(f);                    \
-			/* refetch */                   \
-			buf = (char *)(obj);            \
-			DEBUGBUFFER(buf);               \
-			continue;                       \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    (buf)[__ooffs+__offs] = (ret);              \
-	    DEBUGBUFFER(buf);                           \
-	    __offs++;                                   \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (errno == EINTR) {               \
+                        __HANDLE_INTERRUPTS__;          \
+                        clearerr(f);                    \
+                        /* refetch */                   \
+                        buf = (char *)(obj);            \
+                        DEBUGBUFFER(buf);               \
+                        continue;                       \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            (buf)[__ooffs+__offs] = (ret);              \
+            DEBUGBUFFER(buf);                           \
+            __offs++;                                   \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int fd = fileno(f);                             \
-							\
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__ooffs+__offs] = __intVal(rA);   \
-		DEBUGBUFFER(buf);                       \
-		__INST(readAhead) = nil;                \
-		__offs++;                               \
-	    } else {                                    \
-		CLEAR_ERRNO;                            \
-		__cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
-		DEBUGBUFFER(buf);                       \
-		if (__cnt <= 0) {                       \
-		    if (__cnt < 0 && errno == EINTR) {  \
-			__HANDLE_INTERRUPTS__;          \
-			/* refetch */                   \
-			buf = (char *)(obj);            \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		}                                       \
-		__offs += __cnt;                        \
-	    }                                           \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int fd = fileno(f);                             \
+                                                        \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__ooffs+__offs] = __intVal(rA);   \
+                DEBUGBUFFER(buf);                       \
+                __INST(readAhead) = nil;                \
+                __offs++;                               \
+            } else {                                    \
+                CLEAR_ERRNO;                            \
+                __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
+                DEBUGBUFFER(buf);                       \
+                if (__cnt <= 0) {                       \
+                    if (__cnt < 0 && errno == EINTR) {  \
+                        __HANDLE_INTERRUPTS__;          \
+                        /* refetch */                   \
+                        buf = (char *)(obj);            \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                }                                       \
+                __offs += __cnt;                        \
+            }                                           \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 
@@ -1124,56 +1124,56 @@
     int __cnt;                                          \
     char *buf = (char *)(obj);                          \
     int oldFlags;                                       \
-							\
+                                                        \
     (ret) = 0;                                          \
     SETNONBLOCKING(fileno(f), oldFlags);                \
-							\
+                                                        \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = getc(f);                            \
-	    if ((ret) < 0) {                            \
-		if (ferror(f)) {                        \
-		    if (errno == EINTR) {               \
-			clearerr(f);                    \
-			/* refetch */                   \
-			buf = (char *)(obj);            \
-			(ret) = 0;                      \
-			break;                          \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    (buf)[__ooffs+__offs] = (ret);              \
-	    DEBUGBUFFER(buf);                           \
-	    __offs++;                                   \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = getc(f);                            \
+            if ((ret) < 0) {                            \
+                if (ferror(f)) {                        \
+                    if (errno == EINTR) {               \
+                        clearerr(f);                    \
+                        /* refetch */                   \
+                        buf = (char *)(obj);            \
+                        (ret) = 0;                      \
+                        break;                          \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            (buf)[__ooffs+__offs] = (ret);              \
+            DEBUGBUFFER(buf);                           \
+            __offs++;                                   \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int fd = fileno(f);                             \
-							\
-	while (__offs < (cnt)) {                        \
-	    OBJ rA = __INST(readAhead);                 \
-	    if (rA != nil) {                            \
-		(buf)[__ooffs+__offs] = __intVal(rA);   \
-		DEBUGBUFFER(buf);                       \
-		__INST(readAhead) = nil;                \
-		__offs++;                               \
-		continue;                               \
-	    }                                           \
-	    CLEAR_ERRNO;                                \
-	    __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
-	    DEBUGBUFFER(buf);                           \
-	    if (__cnt > 0) {                            \
-		__offs += __cnt;                        \
-	    }                                           \
-	    break;                                      \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int fd = fileno(f);                             \
+                                                        \
+        while (__offs < (cnt)) {                        \
+            OBJ rA = __INST(readAhead);                 \
+            if (rA != nil) {                            \
+                (buf)[__ooffs+__offs] = __intVal(rA);   \
+                DEBUGBUFFER(buf);                       \
+                __INST(readAhead) = nil;                \
+                __offs++;                               \
+                continue;                               \
+            }                                           \
+            CLEAR_ERRNO;                                \
+            __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \
+            DEBUGBUFFER(buf);                           \
+            if (__cnt > 0) {                            \
+                __offs += __cnt;                        \
+            }                                           \
+            break;                                      \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
     SETFLAGS(fileno(f), oldFlags);                      \
   }
@@ -1183,44 +1183,44 @@
 
 # ifdef NO_STDIO
 #  define __WRITEBYTE__(ret, f, buf, isBuffered, handleType)          \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    (ret) = WRITE(f, buf, 1, handleType);       \
-	    if ((ret) >= 0) break;                      \
-	    if (errno != EINTR) {                       \
-		break;                                  \
-	    }                                           \
-	    __HANDLE_INTERRUPTS__;                      \
-	}
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            (ret) = WRITE(f, buf, 1, handleType);       \
+            if ((ret) >= 0) break;                      \
+            if (errno != EINTR) {                       \
+                break;                                  \
+            }                                           \
+            __HANDLE_INTERRUPTS__;                      \
+        }
 # else /* use STDIO */
 #  define __WRITEBYTE__(ret, f, buf, isBuffered, handleType)        \
     if (isBuffered) {                                   \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    ret = putc(*(buf), f);                      \
-	    if ((ret) >= 0) {                           \
-		(ret) = 1;                              \
-	    } else if (ferror(f)) {                     \
-		/* SOLARIS/SPARC (2.6) generates spurious errors with errno = 0 */ \
-		if (errno == EINTR || errno == 0) {     \
-		    __HANDLE_INTERRUPTS__;              \
-		    clearerr(f);                        \
-		    continue;                           \
-		}                                       \
-	    } else                                      \
-		(ret) = 0;                              \
-	    break;                                      \
-	}                                               \
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            ret = putc(*(buf), f);                      \
+            if ((ret) >= 0) {                           \
+                (ret) = 1;                              \
+            } else if (ferror(f)) {                     \
+                /* SOLARIS/SPARC (2.6) generates spurious errors with errno = 0 */ \
+                if (errno == EINTR || errno == 0) {     \
+                    __HANDLE_INTERRUPTS__;              \
+                    clearerr(f);                        \
+                    continue;                           \
+                }                                       \
+            } else                                      \
+                (ret) = 0;                              \
+            break;                                      \
+        }                                               \
     } else {                                            \
-	for (;;) {                                      \
-	    CLEAR_ERRNO;                                \
-	    (ret) = write(fileno(f), buf, 1);           \
-	    if ((ret) >= 0) break;                      \
-	    if (errno != EINTR) {                       \
-		break;                                  \
-	    }                                           \
-	    __HANDLE_INTERRUPTS__;                      \
-	}                                               \
+        for (;;) {                                      \
+            CLEAR_ERRNO;                                \
+            (ret) = write(fileno(f), buf, 1);           \
+            if ((ret) >= 0) break;                      \
+            if (errno != EINTR) {                       \
+                break;                                  \
+            }                                           \
+            __HANDLE_INTERRUPTS__;                      \
+        }                                               \
    }
 # endif /* use STDIO */
 
@@ -1232,64 +1232,64 @@
 #  define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType)    \
     (ret) = 0;                                          \
     {                                                   \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    ret = WRITE(f, (buf)+__offs, (cnt)-__offs, handleType); \
-	    if (ret <= 0) {                             \
-		if (ret < 0 && errno == EINTR) {        \
-		    __HANDLE_INTERRUPTS__;              \
-		    continue;                           \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            ret = WRITE(f, (buf)+__offs, (cnt)-__offs, handleType); \
+            if (ret <= 0) {                             \
+                if (ret < 0 && errno == EINTR) {        \
+                    __HANDLE_INTERRUPTS__;              \
+                    continue;                           \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
    }
 # else /* use STDIO */
 #  define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType)    \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
-	    if ((ret) <= 0) {                            \
-		if (ferror(f)) {                        \
-		    if (errno == EINTR) {               \
-			__HANDLE_INTERRUPTS__;          \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\
+            if ((ret) <= 0) {                            \
+                if (ferror(f)) {                        \
+                    if (errno == EINTR) {               \
+                        __HANDLE_INTERRUPTS__;          \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     } else {                                            \
-	int __offs = 0;                                 \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = write(fileno(f), (buf)+__offs, (cnt)-__offs);\
-	    if ((ret) <= 0) {                           \
-		if ((ret) < 0) {                        \
-		    if (errno == EINTR) {               \
-			__HANDLE_INTERRUPTS__;          \
-			continue;                       \
-		    }                                   \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        int __offs = 0;                                 \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = write(fileno(f), (buf)+__offs, (cnt)-__offs);\
+            if ((ret) <= 0) {                           \
+                if ((ret) < 0) {                        \
+                    if (errno == EINTR) {               \
+                        __HANDLE_INTERRUPTS__;          \
+                        continue;                       \
+                    }                                   \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
    }
 # endif /* use STDIO */
 
@@ -1303,25 +1303,25 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-							\
+                                                        \
     (ret) = 0;                                          \
     {                                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    ret = WRITE(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
-	    if (ret <= 0) {                             \
-		if (ret < 0 && errno == EINTR) {        \
-		    __HANDLE_INTERRUPTS__;              \
-		    /* refetch */                       \
-		    buf = (char *)(obj);                \
-		    continue;                           \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
-	if (__offs > 0)                                 \
-	    (ret) = __offs;                             \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            ret = WRITE(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \
+            if (ret <= 0) {                             \
+                if (ret < 0 && errno == EINTR) {        \
+                    __HANDLE_INTERRUPTS__;              \
+                    /* refetch */                       \
+                    buf = (char *)(obj);                \
+                    continue;                           \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
+        if (__offs > 0)                                 \
+            (ret) = __offs;                             \
     }                                                   \
   }
 # else /* use STDIO */
@@ -1330,48 +1330,48 @@
     int __ooffs = obj_offs;                             \
     int __offs = 0;                                     \
     char *buf = (char *)(obj);                          \
-							\
+                                                        \
     (ret) = 0;                                          \
     if (isBuffered) {                                   \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f);  \
-	    if ((ret) <= 0) {                           \
-		if (ferror(f)) {                        \
-		    if (errno == EINTR) {               \
-			__HANDLE_INTERRUPTS__;          \
-			/* refetch */                   \
-			buf = (char *)(obj);            \
-			clearerr(f);                    \
-			continue;                       \
-		    }                                   \
-		    break;                              \
-		} else {                                \
-		    (ret) = 0;                          \
-		}                                       \
-	    }                                           \
-	    __offs += (ret);                            \
-	}                                               \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f);  \
+            if ((ret) <= 0) {                           \
+                if (ferror(f)) {                        \
+                    if (errno == EINTR) {               \
+                        __HANDLE_INTERRUPTS__;          \
+                        /* refetch */                   \
+                        buf = (char *)(obj);            \
+                        clearerr(f);                    \
+                        continue;                       \
+                    }                                   \
+                    break;                              \
+                } else {                                \
+                    (ret) = 0;                          \
+                }                                       \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
     } else {                                            \
-	while (__offs < (cnt)) {                        \
-	    CLEAR_ERRNO;                                \
-	    (ret) = write(fileno(f), (buf)+__ooffs+__offs, (cnt)-__offs); \
-	    if ((ret) <= 0) {                           \
-		if ((ret) < 0) {                        \
-		    if (errno == EINTR){                \
-			__HANDLE_INTERRUPTS__;          \
-			/* refetch */                   \
-			buf = (char *)(obj);            \
-			continue;                       \
-		    }                                   \
-		}                                       \
-		break;                                  \
-	    }                                           \
-	    __offs += (ret); break;                     \
-	}                                               \
+        while (__offs < (cnt)) {                        \
+            CLEAR_ERRNO;                                \
+            (ret) = write(fileno(f), (buf)+__ooffs+__offs, (cnt)-__offs); \
+            if ((ret) <= 0) {                           \
+                if ((ret) < 0) {                        \
+                    if (errno == EINTR){                \
+                        __HANDLE_INTERRUPTS__;          \
+                        /* refetch */                   \
+                        buf = (char *)(obj);            \
+                        continue;                       \
+                    }                                   \
+                }                                       \
+                break;                                  \
+            }                                           \
+            __offs += (ret);                            \
+        }                                               \
     }                                                   \
     if (__offs > 0)                                     \
-	(ret) = __offs;                                 \
+        (ret) = __offs;                                 \
   }
 # endif /* use STDIO */
 #endif /* unix */
@@ -5958,11 +5958,11 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.383 2014-04-04 08:18:36 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.384 2014-04-09 21:10:05 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.383 2014-04-04 08:18:36 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.384 2014-04-09 21:10:05 stefan Exp $'
 ! !