|
|
1.1 root 1: /* read sequential formatted external */
2: #include "f2c.h"
3: #include "fio.h"
4: #include "fmt.h"
5:
6: xrd_SL(Void)
7: { int ch;
8: if(!f__curunit->uend)
9: while((ch=getc(f__cf))!='\n' && ch!=EOF);
10: f__cursor=f__recpos=0;
11: return(1);
12: }
13: x_getc(Void)
14: { int ch;
15: if(f__curunit->uend) return(EOF);
16: ch = getc(f__cf);
17: if(ch!=EOF && ch!='\n')
18: { f__recpos++;
19: return(ch);
20: }
21: if(ch=='\n')
22: { (void) ungetc(ch,f__cf);
23: return(ch);
24: }
25: if(f__curunit->uend || feof(f__cf))
26: { errno=0;
27: f__curunit->uend=1;
28: return(-1);
29: }
30: return(-1);
31: }
32: x_endp(Void)
33: {
34: (void) xrd_SL();
35: return(0);
36: }
37: x_rev(Void)
38: {
39: (void) xrd_SL();
40: return(0);
41: }
42: #ifdef KR_headers
43: integer s_rsfe(a) cilist *a; /* start */
44: #else
45: integer s_rsfe(cilist *a) /* start */
46: #endif
47: { int n;
48: if(!f__init) f_init();
49: if(n=c_sfe(a)) return(n);
50: f__reading=1;
51: f__sequential=1;
52: f__formatted=1;
53: f__external=1;
54: f__elist=a;
55: f__cursor=f__recpos=0;
56: f__scale=0;
57: f__fmtbuf=a->cifmt;
58: f__curunit= &f__units[a->ciunit];
59: f__cf=f__curunit->ufd;
60: if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
61: f__getn= x_getc;
62: f__doed= rd_ed;
63: f__doned= rd_ned;
64: fmt_bg();
65: f__doend=x_endp;
66: f__donewrec=xrd_SL;
67: f__dorevert=x_rev;
68: f__cblank=f__curunit->ublnk;
69: f__cplus=0;
70: if(f__curunit->uwrt && f__nowreading(f__curunit))
71: err(a->cierr,errno,"read start");
72: return(0);
73: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.