Annotation of researchv10no/ncurses/screen/newpad.c, revision 1.1

1.1     ! root        1: # include      "curses.ext"
        !             2: # include      <signal.h>
        !             3: /*     @(#) newpad.c: 1.1 10/15/83     (1.17   3/16/83)        */
        !             4: 
        !             5: char   *calloc();
        !             6: char   *malloc();
        !             7: extern char    *getenv();
        !             8: 
        !             9: extern WINDOW  *makenew();
        !            10: 
        !            11: /*
        !            12:  * Like newwin, but makes a pad instead of a window.  A pad is not
        !            13:  * associated with part of the screen, so it can be bigger.
        !            14:  */
        !            15: WINDOW *
        !            16: newpad(nlines, ncols)
        !            17: register int   nlines;
        !            18: {
        !            19:        register WINDOW *win;
        !            20:        register chtype *sp;
        !            21:        register int i;
        !            22:        char *calloc();
        !            23: 
        !            24:        if ((win = makenew(nlines, ncols, 0, 0)) == NULL)
        !            25:                return NULL;
        !            26:        win->_flags |= _ISPAD;
        !            27:        for (i = 0; i < nlines; i++)
        !            28:                if ((win->_y[i] = (chtype *) calloc(ncols, sizeof (chtype))) == NULL) {
        !            29:                        register int j;
        !            30: 
        !            31:                        for (j = 0; j < i; j++)
        !            32:                                cfree((char *)win->_y[j]);
        !            33:                        cfree((char *)win->_firstch);
        !            34:                        cfree((char *)win->_lastch);
        !            35:                        cfree((char *)win->_y);
        !            36:                        cfree((char *)win);
        !            37:                        return NULL;
        !            38:                }
        !            39:                else
        !            40:                        for (sp = win->_y[i]; sp < win->_y[i] + ncols; )
        !            41:                                *sp++ = ' ';
        !            42:        return win;
        !            43: }

unix.superglobalmegacorp.com

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