Annotation of researchv10no/cmd/cref/put.c, revision 1.1

1.1     ! root        1: int    bct[4];
        !             2: int    optr[4];
        !             3: char   bsp[2048];
        !             4: 
        !             5: char   *obuf[4]        {bsp,
        !             6:                        bsp + 512,
        !             7:                        bsp + 1024,
        !             8:                        bsp + 1536
        !             9:                        };
        !            10: 
        !            11: int    nflush;
        !            12: 
        !            13: put(fil,string,n)
        !            14:        char    *string;
        !            15: {
        !            16:        extern  utmp;
        !            17:        int     i;
        !            18:        char    *o;
        !            19: 
        !            20: /*printf("%d %c %d\n",fil,*string,n);/*DEBUG*/
        !            21: 
        !            22:        string--;
        !            23: 
        !            24:        if((i = optr[fil] + n - 512) >= 0) {
        !            25:                n =- i;
        !            26:                o = &obuf[fil][optr[fil]] -1;
        !            27:                while(--n >= 0)
        !            28:                        *++o = *++string;
        !            29:                optr[fil] = 512;
        !            30:                flsh(fil);
        !            31:                n = i;
        !            32:        }
        !            33: 
        !            34:        o = &obuf[fil][optr[fil]] - 1;
        !            35:        optr[fil] =+ n;
        !            36: 
        !            37:        while(--n >= 0) {
        !            38:                *++o = *++string;
        !            39:        }
        !            40:        return(0);
        !            41: }
        !            42: 
        !            43: flsh(fil)
        !            44: {
        !            45:        extern  tp[],utmp;
        !            46: 
        !            47:        if(optr[fil] <= 0)      return(optr[fil]);
        !            48: 
        !            49:        nflush++;
        !            50:        if(write(tp[fil],obuf[fil],optr[fil]) != optr[fil])
        !            51:                return(-1);
        !            52:        optr[fil] = 0;
        !            53:        return(0);
        !            54: }
        !            55: 

unix.superglobalmegacorp.com

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