#define NOCCARGC #include stdio.h #include clib.def extern int _fcbptr[], _chrpos[], _nextc[]; /* ** Position fd to 128-byte record indicated by ** "offset" relative to the point indicated by "base." ** ** BASE OFFSET-RELATIVE-TO ** 0 first record ** 1 current record ** 2 end of file (last record + 1) ** ** Returns NULL on success, else EOF. */ cseek(fd, offset, base) int fd, offset, base; { int oldrrn, *rrn; if(!_mode(fd) || isatty(fd) || fflush(fd)) return EOF; rrn = _fcbptr[fd] + RRNOFF; oldrrn = *rrn; switch (base) { case 2: _bdos(POSEND, _fcbptr[fd]); case 1: *rrn += offset; break; case 0: *rrn = offset; break; default: return (EOF); } if(_sector(fd, RDRND)) { *rrn = oldrrn; return EOF; } _chrpos[fd] = 0; _nextc[fd] = EOF; _clreof(fd); return (NULL); }