4 extern int rd_ed(),rd_ned(),y_getc(),y_putc(),y_err();
5 extern int y_rev(), y_rsk(), y_newrec();
6 extern int w_ed(),w_ned();
7 integer s_rdfe(a) cilist *a;
11 if(n=c_dfe(a))return(n);
13 if(curunit->uwrt && nowreading(curunit))
14 err(a->cierr,errno,"read start");
18 dorevert = donewrec = y_err;
21 err(a->cierr,100,"read start");
25 integer s_wdfe(a) cilist *a;
29 if(n=c_dfe(a)) return(n);
31 if(curunit->uwrt != 1 && nowwriting(curunit))
32 err(a->cierr,errno,"startwrt");
40 err(a->cierr,100,"startwrt");
59 cursor=scale=recpos=0;
60 if(a->ciunit>MXUNIT || a->ciunit<0)
61 err(a->cierr,101,"startchk");
62 curunit = &units[a->ciunit];
63 if(curunit->ufd==NULL && fk_open(DIR,FMT,a->ciunit))
64 err(a->cierr,104,"dfe");
66 if(!curunit->ufmt) err(a->cierr,102,"dfe")
67 if(!curunit->useek) err(a->cierr,104,"dfe")
69 (void) fseek(cf,(long)curunit->url * (a->cirec-1),SEEK_SET);
75 if(curunit->uend || curunit->url <= recpos
76 || curunit->url == 1) return 0;
79 } while(++recpos < curunit->url);
85 if(curunit->uend) return(-1);
86 if((ch=getc(cf))!=EOF)
89 if(curunit->url>=recpos ||
100 err(elist->cierr,errno,"readingd");
105 if(recpos <= curunit->url || curunit->url==1)
108 err(elist->cierr,110,"dout");
112 { /*what about work done?*/
113 if(curunit->url==1 || recpos==curunit->url)
115 while(recpos<curunit->url)
122 err(elist->cierr, 110, "dfe");
127 if(curunit->url == 1 || recpos == curunit->url) {
128 hiwater = recpos = cursor = 0;
134 hiwater = cursor = 0;