1998-02-01 09:37:08 +08:00
|
|
|
/*write sequential formatted external*/
|
2001-07-08 02:51:58 +08:00
|
|
|
#include "config.h"
|
1998-02-01 09:37:08 +08:00
|
|
|
#include "f2c.h"
|
|
|
|
#include "fio.h"
|
|
|
|
#include "fmt.h"
|
|
|
|
extern int f__hiwater;
|
|
|
|
|
1998-05-19 19:01:52 +08:00
|
|
|
int
|
1998-02-01 09:37:08 +08:00
|
|
|
x_wSL(Void)
|
|
|
|
{
|
1998-05-19 18:52:03 +08:00
|
|
|
int n = f__putbuf('\n');
|
|
|
|
f__hiwater = f__recpos = f__cursor = 0;
|
|
|
|
return(n == 0);
|
1998-02-01 09:37:08 +08:00
|
|
|
}
|
1998-05-19 18:52:03 +08:00
|
|
|
|
|
|
|
static int
|
1998-02-01 09:37:08 +08:00
|
|
|
xw_end(Void)
|
|
|
|
{
|
1998-05-19 18:52:03 +08:00
|
|
|
int n;
|
|
|
|
|
|
|
|
if(f__nonl) {
|
|
|
|
f__putbuf(n = 0);
|
|
|
|
fflush(f__cf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
n = f__putbuf('\n');
|
1998-02-01 09:37:08 +08:00
|
|
|
f__hiwater = f__recpos = f__cursor = 0;
|
1998-05-19 18:52:03 +08:00
|
|
|
return n;
|
1998-02-01 09:37:08 +08:00
|
|
|
}
|
1998-05-19 18:52:03 +08:00
|
|
|
|
|
|
|
static int
|
1998-02-01 09:37:08 +08:00
|
|
|
xw_rev(Void)
|
|
|
|
{
|
1998-05-19 18:52:03 +08:00
|
|
|
int n = 0;
|
|
|
|
if(f__workdone) {
|
|
|
|
n = f__putbuf('\n');
|
|
|
|
f__workdone = 0;
|
|
|
|
}
|
1998-02-01 09:37:08 +08:00
|
|
|
f__hiwater = f__recpos = f__cursor = 0;
|
1998-05-19 18:52:03 +08:00
|
|
|
return n;
|
1998-02-01 09:37:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef KR_headers
|
|
|
|
integer s_wsfe(a) cilist *a; /*start*/
|
|
|
|
#else
|
|
|
|
integer s_wsfe(cilist *a) /*start*/
|
|
|
|
#endif
|
|
|
|
{ int n;
|
|
|
|
if(f__init != 1) f_init();
|
|
|
|
f__init = 3;
|
|
|
|
f__reading=0;
|
|
|
|
f__sequential=1;
|
|
|
|
f__formatted=1;
|
|
|
|
f__external=1;
|
1998-06-23 22:37:15 +08:00
|
|
|
if(n=c_sfe(a)) return(n);
|
1998-02-01 09:37:08 +08:00
|
|
|
f__elist=a;
|
|
|
|
f__hiwater = f__cursor=f__recpos=0;
|
|
|
|
f__nonl = 0;
|
|
|
|
f__scale=0;
|
|
|
|
f__fmtbuf=a->cifmt;
|
1998-07-01 18:30:22 +08:00
|
|
|
f__curunit = &f__units[a->ciunit];
|
1998-02-01 09:37:08 +08:00
|
|
|
f__cf=f__curunit->ufd;
|
|
|
|
if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
|
|
|
|
f__putn= x_putc;
|
|
|
|
f__doed= w_ed;
|
|
|
|
f__doned= w_ned;
|
|
|
|
f__doend=xw_end;
|
|
|
|
f__dorevert=xw_rev;
|
|
|
|
f__donewrec=x_wSL;
|
|
|
|
fmt_bg();
|
|
|
|
f__cplus=0;
|
|
|
|
f__cblank=f__curunit->ublnk;
|
|
|
|
if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
|
|
|
|
err(a->cierr,errno,"write start");
|
|
|
|
return(0);
|
|
|
|
}
|