delete spurious debug abort()
[unix-history] / usr / src / lib / libcurses / newwin.c
index c182d73..acf3bbe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * allocate space for and set up defaults for a new window
  *
 /*
  * allocate space for and set up defaults for a new window
  *
- * %G% (Berkeley) %W
+ * %G% (Berkeley) @(#)newwin.c 1.6
  */
 
 # include      "curses.ext"
  */
 
 # include      "curses.ext"
@@ -47,6 +47,7 @@ int   num_lines, num_cols, begy, begx;
                else
                        for (sp = win->_y[i]; sp < win->_y[i] + nc; )
                                *sp++ = ' ';
                else
                        for (sp = win->_y[i]; sp < win->_y[i] + nc; )
                                *sp++ = ' ';
+       win->_nextp = win;
        return win;
 }
 
        return win;
 }
 
@@ -73,19 +74,28 @@ int         num_lines, num_cols, begy, begx; {
 # endif
        if (by < orig->_begy || bx < orig->_begx
            || by + nl > orig->_maxy + orig->_begy
 # endif
        if (by < orig->_begy || bx < orig->_begx
            || by + nl > orig->_maxy + orig->_begy
-           || bx + nc > orig->_maxx + orig->_begx)
+           || bx + nc > orig->_maxx + orig->_begx) {
+# ifdef        DEBUG
+               fprintf(stderr, "returning ERR (1)\n");
+               fprintf(stderr, "SUBWIN(begx = %d, begy = %d,maxx = %d, maxy = %d, nl = %d, nc = %d, by = %d, bx = %d)\n", orig->_begx,orig->_begy,orig->_maxx,orig->_maxy, nl, nc, by, bx);
+# endif
                return ERR;
                return ERR;
+       }
        if (nl == 0)
                nl = orig->_maxy + orig->_begy - by;
        if (nc == 0)
                nc = orig->_maxx + orig->_begx - bx;
        if (nl == 0)
                nl = orig->_maxy + orig->_begy - by;
        if (nc == 0)
                nc = orig->_maxx + orig->_begx - bx;
-       if ((win = makenew(nl, nc, by, bx)) == NULL)
+       if ((win = makenew(nl, nc, by, bx)) == NULL) {
+               fprintf(stderr, "returning ERR (2)\n");
                return ERR;
                return ERR;
+       }
        j = by - orig->_begy;
        k = bx - orig->_begx;
        for (i = 0; i < nl; i++)
                win->_y[i] = &orig->_y[j++][k];
        j = by - orig->_begy;
        k = bx - orig->_begx;
        for (i = 0; i < nl; i++)
                win->_y[i] = &orig->_y[j++][k];
-       win->_flags = _SUBWIN;
+       win->_nextp = orig->_nextp;
+       orig->_nextp = win;
+       win->_orig = orig;
        return win;
 }
 
        return win;
 }