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