OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libf2c / libI77 / wsfe.c
1 /*write sequential formatted external*/
2 #include "config.h"
3 #include "f2c.h"
4 #include "fio.h"
5 #include "fmt.h"
6 extern int f__hiwater;
7
8  int
9 x_wSL(Void)
10 {
11         int n = f__putbuf('\n');
12         f__hiwater = f__recpos = f__cursor = 0;
13         return(n == 0);
14 }
15
16  static int
17 xw_end(Void)
18 {
19         int n;
20
21         if(f__nonl) {
22                 f__putbuf(n = 0);
23                 fflush(f__cf);
24                 }
25         else
26                 n = f__putbuf('\n');
27         f__hiwater = f__recpos = f__cursor = 0;
28         return n;
29 }
30
31  static int
32 xw_rev(Void)
33 {
34         int n = 0;
35         if(f__workdone) {
36                 n = f__putbuf('\n');
37                 f__workdone = 0;
38                 }
39         f__hiwater = f__recpos = f__cursor = 0;
40         return n;
41 }
42
43 #ifdef KR_headers
44 integer s_wsfe(a) cilist *a;    /*start*/
45 #else
46 integer s_wsfe(cilist *a)       /*start*/
47 #endif
48 {       int n;
49         if(f__init != 1) f_init();
50         f__init = 3;
51         f__reading=0;
52         f__sequential=1;
53         f__formatted=1;
54         f__external=1;
55         if(n=c_sfe(a)) return(n);
56         f__elist=a;
57         f__hiwater = f__cursor=f__recpos=0;
58         f__nonl = 0;
59         f__scale=0;
60         f__fmtbuf=a->cifmt;
61         f__curunit = &f__units[a->ciunit];
62         f__cf=f__curunit->ufd;
63         if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
64         f__putn= x_putc;
65         f__doed= w_ed;
66         f__doned= w_ned;
67         f__doend=xw_end;
68         f__dorevert=xw_rev;
69         f__donewrec=x_wSL;
70         fmt_bg();
71         f__cplus=0;
72         f__cblank=f__curunit->ublnk;
73         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
74                 err(a->cierr,errno,"write start");
75         return(0);
76 }