|
|
1.1 ! root 1: /* @(#)rsfe.c 1.2 */ ! 2: /* 3.0 SID # 1.2 */ ! 3: /* read sequential formatted external */ ! 4: #include "fio.h" ! 5: #include "fmt.h" ! 6: extern int x_getc(),rd_ed(),rd_ned(); ! 7: extern int x_endp(),x_rev(),xrd_SL(); ! 8: s_rsfe(a) cilist *a; /* start */ ! 9: { int n; ! 10: if(!init) f_init(); ! 11: if(n=c_sfe(a)) return(n); ! 12: reading=1; ! 13: sequential=1; ! 14: formatted=1; ! 15: external=1; ! 16: elist=a; ! 17: cursor=recpos=0; ! 18: scale=0; ! 19: fmtbuf=a->cifmt; ! 20: curunit= &units[a->ciunit]; ! 21: cf=curunit->ufd; ! 22: if(pars_f(fmtbuf)<0) err(a->cierr,100,"startio"); ! 23: getn= x_getc; ! 24: doed= rd_ed; ! 25: doned= rd_ned; ! 26: fmt_bg(); ! 27: doend=x_endp; ! 28: donewrec=xrd_SL; ! 29: dorevert=x_rev; ! 30: cblank=curunit->ublnk; ! 31: cplus=0; ! 32: if(curunit->uwrt) (void) nowreading(curunit); ! 33: return(0); ! 34: } ! 35: xrd_SL() ! 36: { int ch; ! 37: if(!curunit->uend) ! 38: while((ch=getc(cf))!='\n' && ch!=EOF); ! 39: cursor=recpos=0; ! 40: return(1); ! 41: } ! 42: x_getc() ! 43: { int ch; ! 44: if(curunit->uend) return(EOF); ! 45: ch = getc(cf); ! 46: if(ch!=EOF && ch!='\n') ! 47: { recpos++; ! 48: return(ch); ! 49: } ! 50: if(ch=='\n') ! 51: { (void) ungetc(ch,cf); ! 52: return(ch); ! 53: } ! 54: if(feof(cf)) ! 55: { errno=0; ! 56: curunit->uend=1; ! 57: return(-1); ! 58: } ! 59: return(-1); ! 60: } ! 61: x_endp() ! 62: { ! 63: (void) xrd_SL(); ! 64: return(0); ! 65: } ! 66: x_rev() ! 67: { ! 68: (void) xrd_SL(); ! 69: return(0); ! 70: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.