Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses * Added new function dupwin.
details: https://anonhg.NetBSD.org/src/rev/76d8dd285ead
branches: trunk
changeset: 485143:76d8dd285ead
user: blymn <blymn%NetBSD.org@localhost>
date: Thu Apr 20 13:12:14 2000 +0000
description:
* Added new function dupwin.
* Fixed bug in copywin overwrite code.
diffstat:
lib/libcurses/copywin.c | 4 ++--
lib/libcurses/curses.3 | 7 +++++--
lib/libcurses/curses.h | 3 ++-
lib/libcurses/newwin.c | 22 ++++++++++++++++++++--
4 files changed, 29 insertions(+), 7 deletions(-)
diffs (99 lines):
diff -r ea998c191dbf -r 76d8dd285ead lib/libcurses/copywin.c
--- a/lib/libcurses/copywin.c Thu Apr 20 12:25:08 2000 +0000
+++ b/lib/libcurses/copywin.c Thu Apr 20 13:12:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: copywin.c,v 1.2 2000/04/18 22:15:55 jdc Exp $ */
+/* $NetBSD: copywin.c,v 1.3 2000/04/20 13:12:14 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@@ -91,7 +91,7 @@
&dstwin->lines[y - dstwin->begy]->line[startx - dstwin->begx],
&srcwin->lines[y - srcwin->begy]->line[startx - srcwin->begx],
(size_t) x * __LDATASIZE);
- __touchline(dstwin, y, (int) (startx - dstwin->begx),
+ __touchline(dstwin, y - dstwin->begy, (int) (startx - dstwin->begx),
(int) (endx - dstwin->begx), 0);
}
return (OK);
diff -r ea998c191dbf -r 76d8dd285ead lib/libcurses/curses.3
--- a/lib/libcurses/curses.3 Thu Apr 20 12:25:08 2000 +0000
+++ b/lib/libcurses/curses.3 Thu Apr 20 13:12:14 2000 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: curses.3,v 1.18 2000/04/18 12:23:01 blymn Exp $
+.\" $NetBSD: curses.3,v 1.19 2000/04/20 13:12:14 blymn Exp $
.\"
.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -119,7 +119,10 @@
.It delwin(win) delete
.Em win
.It derwin(win,lines,cols,begin_y,begin_x)\ create a subwindow
-relative to win.
+relative to
+.Em win.
+.It dupwin(win) duplicate
+.Em win
.It echo() set echo mode
.It endwin() end window modes
.It erase() erase
diff -r ea998c191dbf -r 76d8dd285ead lib/libcurses/curses.h
--- a/lib/libcurses/curses.h Thu Apr 20 12:25:08 2000 +0000
+++ b/lib/libcurses/curses.h Thu Apr 20 13:12:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.h,v 1.38 2000/04/18 12:23:01 blymn Exp $ */
+/* $NetBSD: curses.h,v 1.39 2000/04/20 13:12:14 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -496,6 +496,7 @@
int def_shell_mode(void);
int delwin(WINDOW *win);
WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int by, int bx);
+WINDOW *dupwin(WINDOW *win);
int echo(void);
int endwin(void);
int flash(void);
diff -r ea998c191dbf -r 76d8dd285ead lib/libcurses/newwin.c
--- a/lib/libcurses/newwin.c Thu Apr 20 12:25:08 2000 +0000
+++ b/lib/libcurses/newwin.c Thu Apr 20 13:12:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: newwin.c,v 1.21 2000/04/18 22:45:24 jdc Exp $ */
+/* $NetBSD: newwin.c,v 1.22 2000/04/20 13:12:14 blymn Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94";
#else
-__RCSID("$NetBSD: newwin.c,v 1.21 2000/04/18 22:45:24 jdc Exp $");
+__RCSID("$NetBSD: newwin.c,v 1.22 2000/04/20 13:12:14 blymn Exp $");
#endif
#endif /* not lint */
@@ -68,6 +68,24 @@
}
/*
+ * dupwin --
+ * Create a copy of the given window.
+ */
+WINDOW *
+dupwin(WINDOW *win)
+{
+ WINDOW *new_one;
+
+ if ((new_one =
+ newwin(win->maxy, win->maxx, win->begy, win->begx)) == NULL)
+ return NULL;
+
+ overwrite(win, new_one);
+ return new_one;
+}
+
+
+/*
* newwin --
* Allocate space for and set up defaults for a new window.
*/
Home |
Main Index |
Thread Index |
Old Index