1: /* cfillbuf.c 1.6 83/05/13 */ 2: 3: #include <stdio.h> 4: #include "cpmio.h" 5: #include "cpmfio.h" 6: 7: c_fillbuf(fptr) 8: register C_FILE *fptr; 9: { 10: 11: int getnext(), nsect; 12: 13: if (++fptr->c_blk == 16) 14: if (fptr->c_dirp->blkcnt == (char) 0x80) { 15: /* find next extent (if it exists) */ 16: if (getnext(fptr) == NULL) 17: return (EOF); 18: } 19: else 20: return (EOF); 21: nsect = (fptr->c_seccnt>blksiz/seclth) ? blksiz/seclth : fptr->c_seccnt; 22: if (nsect == 0) 23: return (EOF); 24: fptr->c_seccnt -= nsect; 25: if (getblock(0xff & ((int)fptr->c_dirp->pointers[fptr->c_blk]), 26: fptr->c_base, nsect) == EOF) 27: return (EOF); 28: fptr->c_buf = fptr->c_base; 29: fptr->c_cnt = nsect*seclth -1; 30: return (*fptr->c_buf++&0xff); 31: }