Annotation of researchv10dc/ncurses/screen/subwin.c, revision 1.1.1.1

1.1       root        1: # include      "curses.ext"
                      2: # include      <signal.h>
                      3: /*     @(#) subwin.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: WINDOW *
                     12: subwin(orig, num_lines, num_cols, begy, begx)
                     13: register WINDOW        *orig;
                     14: int    num_lines, num_cols, begy, begx;
                     15: {
                     16: 
                     17:        register int i;
                     18:        register WINDOW *win;
                     19:        register int by, bx, nlines, ncols;
                     20:        register int j, k;
                     21: 
                     22:        by = begy;
                     23:        bx = begx;
                     24:        nlines = num_lines;
                     25:        ncols = num_cols;
                     26: 
                     27:        /*
                     28:         * make sure window fits inside the original one
                     29:         */
                     30: # ifdef        DEBUG
                     31:        if(outf) fprintf(outf, "SUBWIN(%0.2o, %d, %d, %d, %d)\n", orig, nlines, ncols, by, bx);
                     32: # endif
                     33:        if (by < orig->_begy || bx < orig->_begx
                     34:            || by + nlines > orig->_begy + orig->_maxy
                     35:            || bx + ncols  > orig->_begx + orig->_maxx)
                     36:                return NULL;
                     37:        if (nlines == 0)
                     38:                nlines = orig->_maxy - orig->_begy - by;
                     39:        if (ncols == 0)
                     40:                ncols = orig->_maxx - orig->_begx - bx;
                     41:        if ((win = makenew(nlines, ncols, by, bx)) == NULL)
                     42:                return NULL;
                     43:        j = by - orig->_begy;
                     44:        k = bx - orig->_begx;
                     45:        for (i = 0; i < nlines; i++)
                     46:                win->_y[i] = &orig->_y[j++][k];
                     47:        win->_flags = _SUBWIN;
                     48:        return win;
                     49: }

unix.superglobalmegacorp.com

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