date and time created 81/01/26 17:03:07 by arnold
authorKen Arnold <arnold@ucbvax.Berkeley.EDU>
Tue, 27 Jan 1981 09:03:07 +0000 (01:03 -0800)
committerKen Arnold <arnold@ucbvax.Berkeley.EDU>
Tue, 27 Jan 1981 09:03:07 +0000 (01:03 -0800)
SCCS-vsn: lib/libcurses/overwrite.c 1.1

usr/src/lib/libcurses/overwrite.c [new file with mode: 0644]

diff --git a/usr/src/lib/libcurses/overwrite.c b/usr/src/lib/libcurses/overwrite.c
new file mode 100644 (file)
index 0000000..af8fecb
--- /dev/null
@@ -0,0 +1,28 @@
+# include      "curses.h"
+
+# define       min(a,b)        (a < b ? a : b)
+
+/*
+ *     This routine writes win1 on win2 destructively.
+ *
+ * %G% (Berkeley) @(#)overwrite.c      1.1
+ */
+overwrite(win1, win2)
+reg WINDOW     *win1, *win2; {
+
+       reg int         x, y, minx, miny, starty;
+
+# ifdef DEBUG
+       fprintf(outf, "OVERWRITE(0%o, 0%o);\n", win1, win2);
+# endif
+       miny = min(win1->_maxy, win2->_maxy);
+       minx = min(win1->_maxx, win2->_maxx);
+# ifdef DEBUG
+       fprintf(outf, "OVERWRITE:\tminx = %d,  miny = %d\n", minx, miny);
+# endif
+       starty = win1->_begy - win2->_begy;
+       for (y = 0; y < miny; y++)
+               if (wmove(win2, y + starty, 0) != ERR)
+                       for (x = 0; x < minx; x++)
+                               waddch(win2, win1->_y[y][x]);
+}