Annotation of 41BSD/lib/libcurses/clrtoeol.c, revision 1.1

1.1     ! root        1: # include      "curses.ext"
        !             2: 
        !             3: /*
        !             4:  *     This routine clears up to the end of line
        !             5:  */
        !             6: wclrtoeol(win)
        !             7: reg WINDOW     *win; {
        !             8: 
        !             9:        reg char        *sp, *end;
        !            10:        reg int         y, x;
        !            11:        reg char        *maxx;
        !            12:        reg int         minx;
        !            13: 
        !            14:        y = win->_cury;
        !            15:        x = win->_curx;
        !            16:        end = &win->_y[y][win->_maxx];
        !            17:        minx = _NOCHANGE;
        !            18:        maxx = &win->_y[y][x];
        !            19:        for (sp = maxx; sp < end; sp++)
        !            20:                if (*sp != ' ') {
        !            21:                        maxx = sp;
        !            22:                        if (minx == _NOCHANGE)
        !            23:                                minx = sp - win->_y[y];
        !            24:                        *sp = ' ';
        !            25:                }
        !            26:        /*
        !            27:         * update firstch and lastch for the line
        !            28:         */
        !            29: # ifdef DEBUG
        !            30:        fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]);
        !            31: # endif
        !            32:        if (minx != _NOCHANGE) {
        !            33:                if (win->_firstch[y] > minx || win->_firstch[y] == _NOCHANGE)
        !            34:                        win->_firstch[y] = minx;
        !            35:                if (win->_lastch[y] < maxx - win->_y[y])
        !            36:                        win->_lastch[y] = maxx - win->_y[y];
        !            37:        }
        !            38: 
        !            39:        return OK;
        !            40: }

unix.superglobalmegacorp.com

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