|
|
1.1 ! root 1: /* ! 2: * direct unformatted external i/o ! 3: */ ! 4: ! 5: #include "fio.h" ! 6: ! 7: char *due = "due"; ! 8: ! 9: s_rdue(a) cilist *a; ! 10: { ! 11: int n; ! 12: reading = YES; ! 13: if(n=c_due(a,READ)) return(n); ! 14: if(curunit->uwrt) nowreading(curunit); ! 15: return(OK); ! 16: } ! 17: ! 18: s_wdue(a) cilist *a; ! 19: { ! 20: int n; ! 21: reading = NO; ! 22: if(n=c_due(a,WRITE)) return(n); ! 23: curunit->uend = NO; ! 24: if(!curunit->uwrt) nowwriting(curunit); ! 25: return(OK); ! 26: } ! 27: ! 28: c_due(a,flag) cilist *a; ! 29: { int n; ! 30: lfname = NULL; ! 31: elist = NO; ! 32: sequential=formatted=NO; ! 33: recpos = reclen = 0; ! 34: external = YES; ! 35: errflag = a->cierr; ! 36: endflag = a->ciend; ! 37: lunit = a->ciunit; ! 38: if(not_legal(lunit)) err(errflag,101,due); ! 39: curunit = &units[lunit]; ! 40: if(!curunit->ufd && (n=fk_open(flag,DIR,UNF,lunit)) ) ! 41: err(errflag,n,due); ! 42: cf = curunit->ufd; ! 43: elist = YES; ! 44: lfname = curunit->ufnm; ! 45: if(curunit->ufmt) err(errflag,103,due) ! 46: if(!curunit->useek || !curunit->url) err(errflag,104,due) ! 47: fseek(cf,(long)(a->cirec-1)*curunit->url,0); ! 48: return(OK); ! 49: } ! 50: ! 51: e_rdue() ! 52: { ! 53: if(curunit->url==1 || recpos==curunit->url) return(OK); ! 54: fseek(cf,(long)(curunit->url-recpos),1); ! 55: if(ftell(cf)%curunit->url) err(errflag,119,due) ! 56: return(OK); ! 57: } ! 58: ! 59: e_wdue() ! 60: { ! 61: return(e_rdue()); ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.