.
authorclaus
Fri, 15 Sep 1995 16:54:57 +0200
changeset 436 b891da8db89c
parent 435 ff583b2bb958
child 437 a005e97d261e
.
ExtStream.st
ExternalStream.st
--- a/ExtStream.st	Fri Sep 15 01:22:26 1995 +0200
+++ b/ExtStream.st	Fri Sep 15 16:54:57 1995 +0200
@@ -24,7 +24,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.50 1995-09-08 16:45:40 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.51 1995-09-15 14:54:57 claus Exp $
 '!
 
 !ExternalStream primitiveDefinitions!
@@ -86,7 +86,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.50 1995-09-08 16:45:40 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.51 1995-09-15 14:54:57 claus Exp $
 "
 !
 
@@ -2681,14 +2681,28 @@
 	}
 
 	f = MKFD(fp);
+
+	if (feof(f)) {
+	    _INST(hitEOF) = true;
+	    RETURN (false);
+	}
+
 	__READING__(f)
+
 	errno = 0;
 	__BEGIN_INTERRUPTABLE__
 	do {
+	    if (feof(f)) {
+		break;
+	    }
 	    c = getc(f);
 	} while ((c < 0) && (errno == EINTR));
 	__END_INTERRUPTABLE__
 
+	if (feof(f)) {
+	    _INST(hitEOF) = true;
+	}
+
 	if (c == peekValue) {
 	    OBJ pos;
 
@@ -2703,10 +2717,10 @@
 	    RETURN (false);
 	}
 
+	_INST(hitEOF) = true;
 	if (ferror(f) && (errno != 0)) {
 	    _INST(lastErrorNumber) = __MKSMALLINT(errno);
 	} else {
-	    _INST(hitEOF) = true;
 	    RETURN (false);
 	}
     }
@@ -2978,17 +2992,21 @@
 	if (_INST(binary) != true) {
 	    f = MKFD(fp);
             
+            if (feof(f)) {
+		_INST(hitEOF) = true;
+		RETURN ( nil );
+	    }
+
 	    __READING__(f)
 
 	    __BEGIN_INTERRUPTABLE__
 	    while (1) {
-		if (feof(f)) {
-		    __END_INTERRUPTABLE__
-		    _INST(hitEOF) = true;
-		    RETURN ( nil );
-		}
-
 		do {
+		    if (feof(f)) {
+			__END_INTERRUPTABLE__
+			_INST(hitEOF) = true;
+			RETURN ( nil );
+		    }
 		    c = getc(f);
 		} while ((c < 0) && (errno == EINTR));
 
@@ -3004,11 +3022,11 @@
 		    default:
 			__END_INTERRUPTABLE__
 			if (c < 0) {
+			    _INST(hitEOF) = true;
 			    if (ferror(f) && (errno != 0)) {
 				_INST(lastErrorNumber) = __MKSMALLINT(errno);
 				goto err;
 			    }
-			    _INST(hitEOF) = true;
 			    RETURN ( nil );
 			}
 			ungetc(c, f);
@@ -3228,12 +3246,11 @@
     
     __READING__(f)
 
-#ifdef SYSV
     if (feof(f)) {
 	_INST(hitEOF) = true;
 	RETURN (nil);
     }
-#endif
+
     /*
      * skip spaces
      */
@@ -3334,11 +3351,11 @@
 	}
 
 	if (c < 0) {
+	    _INST(hitEOF) = true;
 	    if (ferror(f) && (errno != 0)) {
 		_INST(lastErrorNumber) = __MKSMALLINT(errno);
 		goto err;
 	    }
-	    _INST(hitEOF) = true;
 	    break;
 	}
 	buffer[index++] = c;
--- a/ExternalStream.st	Fri Sep 15 01:22:26 1995 +0200
+++ b/ExternalStream.st	Fri Sep 15 16:54:57 1995 +0200
@@ -24,7 +24,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.50 1995-09-08 16:45:40 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.51 1995-09-15 14:54:57 claus Exp $
 '!
 
 !ExternalStream primitiveDefinitions!
@@ -86,7 +86,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.50 1995-09-08 16:45:40 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.51 1995-09-15 14:54:57 claus Exp $
 "
 !
 
@@ -2681,14 +2681,28 @@
 	}
 
 	f = MKFD(fp);
+
+	if (feof(f)) {
+	    _INST(hitEOF) = true;
+	    RETURN (false);
+	}
+
 	__READING__(f)
+
 	errno = 0;
 	__BEGIN_INTERRUPTABLE__
 	do {
+	    if (feof(f)) {
+		break;
+	    }
 	    c = getc(f);
 	} while ((c < 0) && (errno == EINTR));
 	__END_INTERRUPTABLE__
 
+	if (feof(f)) {
+	    _INST(hitEOF) = true;
+	}
+
 	if (c == peekValue) {
 	    OBJ pos;
 
@@ -2703,10 +2717,10 @@
 	    RETURN (false);
 	}
 
+	_INST(hitEOF) = true;
 	if (ferror(f) && (errno != 0)) {
 	    _INST(lastErrorNumber) = __MKSMALLINT(errno);
 	} else {
-	    _INST(hitEOF) = true;
 	    RETURN (false);
 	}
     }
@@ -2978,17 +2992,21 @@
 	if (_INST(binary) != true) {
 	    f = MKFD(fp);
             
+            if (feof(f)) {
+		_INST(hitEOF) = true;
+		RETURN ( nil );
+	    }
+
 	    __READING__(f)
 
 	    __BEGIN_INTERRUPTABLE__
 	    while (1) {
-		if (feof(f)) {
-		    __END_INTERRUPTABLE__
-		    _INST(hitEOF) = true;
-		    RETURN ( nil );
-		}
-
 		do {
+		    if (feof(f)) {
+			__END_INTERRUPTABLE__
+			_INST(hitEOF) = true;
+			RETURN ( nil );
+		    }
 		    c = getc(f);
 		} while ((c < 0) && (errno == EINTR));
 
@@ -3004,11 +3022,11 @@
 		    default:
 			__END_INTERRUPTABLE__
 			if (c < 0) {
+			    _INST(hitEOF) = true;
 			    if (ferror(f) && (errno != 0)) {
 				_INST(lastErrorNumber) = __MKSMALLINT(errno);
 				goto err;
 			    }
-			    _INST(hitEOF) = true;
 			    RETURN ( nil );
 			}
 			ungetc(c, f);
@@ -3228,12 +3246,11 @@
     
     __READING__(f)
 
-#ifdef SYSV
     if (feof(f)) {
 	_INST(hitEOF) = true;
 	RETURN (nil);
     }
-#endif
+
     /*
      * skip spaces
      */
@@ -3334,11 +3351,11 @@
 	}
 
 	if (c < 0) {
+	    _INST(hitEOF) = true;
 	    if (ferror(f) && (errno != 0)) {
 		_INST(lastErrorNumber) = __MKSMALLINT(errno);
 		goto err;
 	    }
-	    _INST(hitEOF) = true;
 	    break;
 	}
 	buffer[index++] = c;