Use -static when testing --gc-sections on native targets
[official-gcc.git] / libf2c / libI77 / rsfe.c
bloba79cd79f03c59c72efd014ecee53dc27512e691d
1 /* read sequential formatted external */
2 #include "f2c.h"
3 #include "fio.h"
4 #include "fmt.h"
6 xrd_SL(Void)
7 { int ch;
8 if(!f__curunit->uend)
9 while((ch=getc(f__cf))!='\n')
10 if (ch == EOF) {
11 f__curunit->uend = 1;
12 break;
14 f__cursor=f__recpos=0;
15 return(1);
17 x_getc(Void)
18 { int ch;
19 if(f__curunit->uend) return(EOF);
20 ch = getc(f__cf);
21 if(ch!=EOF && ch!='\n')
22 { f__recpos++;
23 return(ch);
25 if(ch=='\n')
26 { (void) ungetc(ch,f__cf);
27 return(ch);
29 if(f__curunit->uend || feof(f__cf))
30 { errno=0;
31 f__curunit->uend=1;
32 return(-1);
34 return(-1);
36 x_endp(Void)
38 xrd_SL();
39 return f__curunit->uend == 1 ? EOF : 0;
41 x_rev(Void)
43 (void) xrd_SL();
44 return(0);
46 #ifdef KR_headers
47 integer s_rsfe(a) cilist *a; /* start */
48 #else
49 integer s_rsfe(cilist *a) /* start */
50 #endif
51 { int n;
52 if(f__init != 1) f_init();
53 f__init = 3;
54 f__reading=1;
55 f__sequential=1;
56 f__formatted=1;
57 f__external=1;
58 if(n=c_sfe(a)) return(n);
59 f__elist=a;
60 f__cursor=f__recpos=0;
61 f__scale=0;
62 f__fmtbuf=a->cifmt;
63 f__curunit= &f__units[a->ciunit];
64 f__cf=f__curunit->ufd;
65 if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
66 f__getn= x_getc;
67 f__doed= rd_ed;
68 f__doned= rd_ned;
69 fmt_bg();
70 f__doend=x_endp;
71 f__donewrec=xrd_SL;
72 f__dorevert=x_rev;
73 f__cblank=f__curunit->ublnk;
74 f__cplus=0;
75 if(f__curunit->uwrt && f__nowreading(f__curunit))
76 err(a->cierr,errno,"read start");
77 if(f__curunit->uend)
78 err(f__elist->ciend,(EOF),"read start");
79 return(0);