Annotation of 41BSD/lib/libI77/wsfe.c, revision 1.1.1.1

1.1       root        1: /*write sequential formatted external*/
                      2: #include "fio.h"
                      3: #include "fmt.h"
                      4: extern int x_putc(),w_ed(),w_ned();
                      5: extern int xw_end(),xw_rev(),x_wSL();
                      6: s_wsfe(a) cilist *a;   /*start*/
                      7: {      int n;
                      8:        if(!init) f_init();
                      9:        if(n=c_sfe(a)) return(n);
                     10:        reading=0;
                     11:        sequential=1;
                     12:        formatted=1;
                     13:        external=1;
                     14:        elist=a;
                     15:        cursor=recpos=0;
                     16:        nonl = 0;
                     17:        scale=0;
                     18:        fmtbuf=a->cifmt;
                     19:        curunit = &units[a->ciunit];
                     20:        cf=curunit->ufd;
                     21:        if(pars_f(fmtbuf)<0) err(a->cierr,100,"startio");
                     22:        putn= x_putc;
                     23:        doed= w_ed;
                     24:        doned= w_ned;
                     25:        doend=xw_end;
                     26:        dorevert=xw_rev;
                     27:        donewrec=x_wSL;
                     28:        fmt_bg();
                     29:        cplus=0;
                     30:        cblank=curunit->ublnk;
                     31:        if(!curunit->uwrt) (void) nowwriting(curunit);
                     32:        return(0);
                     33: }
                     34: x_putc(c)
                     35: {
                     36:        recpos++;
                     37:        putc(c,cf);
                     38: }
                     39: pr_put(c)
                     40: {      static flag new = 1;
                     41:        recpos++;
                     42:        if(c=='\n')
                     43:        {       new=1;
                     44:                putc(c,cf);
                     45:        }
                     46:        else if(new==1)
                     47:        {       new=0;
                     48:                if(c=='0') putc('\n',cf);
                     49:                else if(c=='1') putc('\f',cf);
                     50:        }
                     51:        else putc(c,cf);
                     52: }
                     53: x_wSL()
                     54: {
                     55:        (*putn)('\n');
                     56:        recpos=0;
                     57:        cursor = 0;
                     58:        return(1);
                     59: }
                     60: xw_end()
                     61: {
                     62:        if(nonl == 0)
                     63:                (*putn)('\n');
                     64:        return(0);
                     65: }
                     66: xw_rev()
                     67: {
                     68:        if(workdone) (*putn)('\n');
                     69:        return(workdone=0);
                     70: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.