Annotation of 3BSD/libI77/wsfe.c, revision 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,WRITE)) return(n);
        !            10:        reading=0;
        !            11:        sequential=1;
        !            12:        formatted=1;
        !            13:        external=1;
        !            14:        elist=a;
        !            15:        cursor=recpos=0;
        !            16:        scale=0;
        !            17:        fmtbuf=a->cifmt;
        !            18:        curunit = &units[a->ciunit];
        !            19:        cf=curunit->ufd;
        !            20:        if(pars_f(fmtbuf)<0) err(a->cierr,100,"startio");
        !            21:        putn= x_putc;
        !            22:        doed= w_ed;
        !            23:        doned= w_ned;
        !            24:        doend=xw_end;
        !            25:        dorevert=xw_rev;
        !            26:        donewrec=x_wSL;
        !            27:        fmt_bg();
        !            28:        cplus=0;
        !            29:        cblank=curunit->ublnk;
        !            30:        if(!curunit->uwrt) nowwriting(curunit);
        !            31:        return(0);
        !            32: }
        !            33: x_putc(c)
        !            34: {
        !            35:        recpos++;
        !            36:        putc(c,cf);
        !            37: }
        !            38: pr_put(c)
        !            39: {      static flag new = 1;
        !            40:        recpos++;
        !            41:        if(c=='\n')
        !            42:        {       new=1;
        !            43:                putc(c,cf);
        !            44:        }
        !            45:        else if(new==1)
        !            46:        {       new=0;
        !            47:                if(c=='0') putc('\n',cf);
        !            48:                else if(c=='1') putc('\f',cf);
        !            49:        }
        !            50:        else putc(c,cf);
        !            51: }
        !            52: x_wSL()
        !            53: {
        !            54:        (*putn)('\n');
        !            55:        recpos=0;
        !            56:        cursor = 0;
        !            57:        return(1);
        !            58: }
        !            59: xw_end()
        !            60: {
        !            61:        (*putn)('\n');
        !            62:        return(0);
        !            63: }
        !            64: xw_rev()
        !            65: {
        !            66:        if(workdone) (*putn)('\n');
        !            67:        return(workdone=0);
        !            68: }

unix.superglobalmegacorp.com

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