| 1 |
/*write sequential formatted external*/ |
| 2 |
#include "f2c.h" |
| 3 |
#include "fio.h" |
| 4 |
#include "fmt.h" |
| 5 |
#ifdef __cplusplus |
| 6 |
extern "C" { |
| 7 |
#endif |
| 8 |
|
| 9 |
int |
| 10 |
x_wSL(Void) |
| 11 |
{ |
| 12 |
int n = f__putbuf('\n'); |
| 13 |
f__hiwater = f__recpos = f__cursor = 0; |
| 14 |
return(n == 0); |
| 15 |
} |
| 16 |
|
| 17 |
static int |
| 18 |
xw_end(Void) |
| 19 |
{ |
| 20 |
int n; |
| 21 |
|
| 22 |
if(f__nonl) { |
| 23 |
f__putbuf(n = 0); |
| 24 |
fflush(f__cf); |
| 25 |
} |
| 26 |
else |
| 27 |
n = f__putbuf('\n'); |
| 28 |
f__hiwater = f__recpos = f__cursor = 0; |
| 29 |
return n; |
| 30 |
} |
| 31 |
|
| 32 |
static int |
| 33 |
xw_rev(Void) |
| 34 |
{ |
| 35 |
int n = 0; |
| 36 |
if(f__workdone) { |
| 37 |
n = f__putbuf('\n'); |
| 38 |
f__workdone = 0; |
| 39 |
} |
| 40 |
f__hiwater = f__recpos = f__cursor = 0; |
| 41 |
return n; |
| 42 |
} |
| 43 |
|
| 44 |
#ifdef KR_headers |
| 45 |
integer s_wsfe(a) cilist *a; /*start*/ |
| 46 |
#else |
| 47 |
integer s_wsfe(cilist *a) /*start*/ |
| 48 |
#endif |
| 49 |
{ int n; |
| 50 |
if(!f__init) f_init(); |
| 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__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 |
} |
| 76 |
#ifdef __cplusplus |
| 77 |
} |
| 78 |
#endif |