set file^ to blank on eof (for text files)
authorKirk McKusick <mckusic@ucbvax.Berkeley.EDU>
Sun, 25 Jan 1981 07:13:31 +0000 (23:13 -0800)
committerKirk McKusick <mckusic@ucbvax.Berkeley.EDU>
Sun, 25 Jan 1981 07:13:31 +0000 (23:13 -0800)
SCCS-vsn: usr.bin/pascal/libpc/FNIL.c 1.2
SCCS-vsn: usr.bin/pascal/libpc/IOSYNC.c 1.2

usr/src/usr.bin/pascal/libpc/FNIL.c
usr/src/usr.bin/pascal/libpc/IOSYNC.c

index 1f4d6ef..97daa8b 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)FNIL.c 1.1 %G%";
+static char sccsid[] = "@(#)FNIL.c 1.2 %G%";
 
 #include "h00vars.h"
 #include "h01errs.h"
 
 #include "h00vars.h"
 #include "h01errs.h"
@@ -20,10 +20,6 @@ FNIL(curfile)
        }
        if (curfile->funit & FREAD) {
                IOSYNC(curfile);
        }
        if (curfile->funit & FREAD) {
                IOSYNC(curfile);
-               if (curfile->funit & EOFF) {
-                       ERROR(EPASTEOF, curfile->pfname);
-                       return;
-               }
        }
        return curfile->fileptr;
 }
        }
        return curfile->fileptr;
 }
index 3863669..e308433 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)IOSYNC.c 1.1 %G%";
+static char sccsid[] = "@(#)IOSYNC.c 1.2 %G%";
 
 #include "h00vars.h"
 #include "h01errs.h"
 
 #include "h00vars.h"
 #include "h01errs.h"
@@ -34,6 +34,10 @@ IOSYNC(curfile)
        }
        if (feof(curfile->fbuf)) {
                curfile->funit = unit | EOFF;
        }
        if (feof(curfile->fbuf)) {
                curfile->funit = unit | EOFF;
+               if (unit & FTEXT) {
+                       *curfile->fileptr = ' ';
+                       return;
+               }
                limit = &curfile->fileptr[curfile->fsize];
                for (ptr = curfile->fileptr; ptr < limit; )
                        *ptr++ = 0;
                limit = &curfile->fileptr[curfile->fsize];
                for (ptr = curfile->fileptr; ptr < limit; )
                        *ptr++ = 0;