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