1: /*
2: char id_wsfe[] = "@(#)wsfe.c 1.1";
3: *
4: * write sequential formatted external routines
5: */
6:
7: #include "fio.h"
8:
9: int pr_put(), x_putc(), x_wend(), x_wnew();
10: extern int w_ed(), w_ned(), x_tab();
11:
12: char wsfe[] = "write sfe";
13: ioflag new;
14:
15: s_wsfe(a) cilist *a; /*start*/
16: { int n;
17: reading = NO;
18: if(n=c_sfe(a,WRITE)) return(n);
19: if(!curunit->uwrt && ! nowwriting(curunit)) err(errflag, errno, wsfe)
20: curunit->uend = NO;
21: if (curunit->uprnt) putn = pr_put;
22: else putn = x_putc;
23: new = YES;
24: doed= w_ed;
25: doned= w_ned;
26: doend = x_wend;
27: dorevert = donewrec = x_wnew;
28: dotab = x_tab;
29: if(pars_f(fmtbuf)) err(errflag,F_ERFMT,wsfe)
30: fmt_bg();
31: return(OK);
32: }
33:
34: x_putc(c)
35: {
36: if(c=='\n') recpos = reclen = cursor = 0;
37: else recpos++;
38: if (c) putc(c,cf);
39: return(OK);
40: }
41:
42: pr_put(c)
43: {
44: if(c=='\n')
45: { new = YES;
46: recpos = reclen = cursor = 0;
47: }
48: else if(new)
49: { new = NO;
50: if(c=='0') c = '\n';
51: else if(c=='1') c = '\f';
52: else return(OK);
53: }
54: else recpos++;
55: if (c) putc(c,cf);
56: return(OK);
57: }
58:
59: x_wnew()
60: {
61: if(reclen>recpos) fseek(cf,(long)(reclen-recpos),1);
62: return((*putn)('\n'));
63: }
64:
65: x_wend(last) char last;
66: {
67: if(reclen>recpos) fseek(cf,(long)(reclen-recpos),1);
68: return((*putn)(last));
69: }
Defined functions
Defined variables
new
defined in line
13; used 4 times
wsfe
defined in line
12; used 2 times