|
|
1.1 ! root 1: #include "fio.h" ! 2: s_rdue(a) cilist *a; ! 3: { ! 4: int n; ! 5: if(n=c_due(a,READ)) return(n); ! 6: reading=1; ! 7: if(curunit->uwrt) nowreading(curunit); ! 8: return(0); ! 9: } ! 10: s_wdue(a) cilist *a; ! 11: { ! 12: int n; ! 13: if(n=c_due(a,WRITE)) return(n); ! 14: reading=0; ! 15: if(!curunit->uwrt) nowwriting(curunit); ! 16: return(0); ! 17: } ! 18: c_due(a,flag) cilist *a; ! 19: { ! 20: if(!init) f_init(); ! 21: if(a->ciunit>=MXUNIT || a->ciunit<0) ! 22: err(a->cierr,101,"startio"); ! 23: recpos=sequential=formatted=0; ! 24: external=1; ! 25: curunit = &units[a->ciunit]; ! 26: elist=a; ! 27: if(curunit->ufd==NULL && fk_open(flag,DIR,UNF,a->ciunit) ) err(a->cierr,104,"due"); ! 28: cf=curunit->ufd; ! 29: if(curunit->ufmt) err(a->cierr,102,"cdue") ! 30: if(!curunit->useek) err(a->cierr,104,"cdue") ! 31: if(curunit->ufd==NULL) err(a->cierr,114,"cdue") ! 32: fseek(cf,(long)(a->cirec-1)*curunit->url,0); ! 33: curunit->uend = 0; ! 34: return(0); ! 35: } ! 36: e_rdue() ! 37: { ! 38: if(curunit->url==1 || recpos==curunit->url) ! 39: return(0); ! 40: fseek(cf,(long)(curunit->url-recpos),1); ! 41: if(ftell(cf)%curunit->url) ! 42: err(elist->cierr,200,"syserr"); ! 43: return(0); ! 44: } ! 45: e_wdue() ! 46: { ! 47: return(e_rdue()); ! 48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.