Annotation of researchv10dc/cmd/pascal/libpc/READ8.c, revision 1.1

1.1     ! root        1: /* Copyright (c) 1979 Regents of the University of California */
        !             2: 
        !             3: static char sccsid[] = "@(#)READ8.c 1.4 6/10/81";
        !             4: 
        !             5: #include "h00vars.h"
        !             6: 
        !             7: double
        !             8: READ8(curfile)
        !             9: 
        !            10:        register struct iorec   *curfile;
        !            11: {
        !            12:        double                  data;
        !            13:        int                     retval;
        !            14: 
        !            15:        if (curfile->funit & FWRITE) {
        !            16:                ERROR("%s: Attempt to read, but open for writing\n",
        !            17:                        curfile->pfname);
        !            18:                return;
        !            19:        }
        !            20:        UNSYNC(curfile);
        !            21:        retval = fscanf(curfile->fbuf, "%lf", &data);
        !            22:        if (retval == EOF) {
        !            23:                ERROR("%s: Tried to read past end of file\n", curfile->pfname);
        !            24:                return;
        !            25:        }
        !            26:        if (retval == 0) {
        !            27:                ERROR("%s: Bad data found on real read\n", curfile->pfname);
        !            28:                return;
        !            29:        }
        !            30:        curfile->funit &= ~EOLN;
        !            31:        curfile->funit |= SYNC;
        !            32:        return data;
        !            33: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.