|
|
1.1 ! root 1: /* lfread.c - lfread */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <disk.h> ! 6: #include <lfile.h> ! 7: #include <dir.h> ! 8: ! 9: /*------------------------------------------------------------------------ ! 10: * lfread -- read from a previously opened disk file ! 11: *------------------------------------------------------------------------ ! 12: */ ! 13: lfread(devptr, buff, count) ! 14: struct devsw *devptr; ! 15: char *buff; ! 16: int count; ! 17: { ! 18: int done; ! 19: int ichar; ! 20: ! 21: if (count < 0) ! 22: return(SYSERR); ! 23: for (done=0 ; done < count ; done++) ! 24: if ( (ichar=lfgetc(devptr)) == SYSERR) ! 25: return(SYSERR); ! 26: else if (ichar == EOF ) { /* EOF before finished */ ! 27: if (done == 0) ! 28: return(EOF); ! 29: else ! 30: return(done); ! 31: } else ! 32: *buff++ = (char) ichar; ! 33: return(done); ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.