summaryrefslogtreecommitdiff
path: root/lib/libcurses
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcurses')
-rw-r--r--lib/libcurses/curses.h4
-rw-r--r--lib/libcurses/curses.priv.h8
-rw-r--r--lib/libcurses/lib_doupdate.c5
-rw-r--r--lib/libcurses/lib_endwin.c13
-rw-r--r--lib/libcurses/lib_mouse.c6
-rw-r--r--lib/libcurses/lib_mvcur.c18
-rw-r--r--lib/libcurses/lib_set_term.c32
7 files changed, 53 insertions, 33 deletions
diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h
index 9f2b76c3c97..6ff2b1fac4d 100644
--- a/lib/libcurses/curses.h
+++ b/lib/libcurses/curses.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: curses.h,v 1.11 1998/09/13 19:16:24 millert Exp $ */
+/* $OpenBSD: curses.h,v 1.12 1998/09/17 04:14:29 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 4
#define NCURSES_VERSION_MINOR 2
-#define NCURSES_VERSION_PATCH 980905
+#define NCURSES_VERSION_PATCH 980912
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
diff --git a/lib/libcurses/curses.priv.h b/lib/libcurses/curses.priv.h
index 1868afcf667..4c95727e76f 100644
--- a/lib/libcurses/curses.priv.h
+++ b/lib/libcurses/curses.priv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: curses.priv.h,v 1.8 1998/09/13 19:16:25 millert Exp $ */
+/* $OpenBSD: curses.priv.h,v 1.9 1998/09/17 04:14:30 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -35,7 +35,7 @@
/*
- * $From: curses.priv.h,v 1.109 1998/09/05 22:10:02 tom Exp $
+ * $From: curses.priv.h,v 1.110 1998/09/12 22:50:21 tom Exp $
*
* curses.priv.h
*
@@ -663,6 +663,10 @@ extern void _nc_synchook(WINDOW *win);
extern void _nc_update_screensize(void);
#endif
+#define NC_BUFFERED(flag) \
+ if ((SP->_setbuf == 0) != flag) \
+ _nc_set_buffer(SP->_ofp, flag)
+
/*
* On systems with a broken linker, define 'SP' as a function to force the
* linker to pull in the data-only module with 'SP'.
diff --git a/lib/libcurses/lib_doupdate.c b/lib/libcurses/lib_doupdate.c
index 1c1ee616eb2..e391e6766e5 100644
--- a/lib/libcurses/lib_doupdate.c
+++ b/lib/libcurses/lib_doupdate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_doupdate.c,v 1.9 1998/09/13 19:16:27 millert Exp $ */
+/* $OpenBSD: lib_doupdate.c,v 1.10 1998/09/17 04:14:30 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -77,7 +77,7 @@
#include <term.h>
-MODULE_ID("$From: lib_doupdate.c,v 1.103 1998/08/15 23:34:47 tom Exp $")
+MODULE_ID("$From: lib_doupdate.c,v 1.104 1998/09/12 22:50:39 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -521,6 +521,7 @@ struct tms before, after;
T(("coming back from shell mode"));
reset_prog_mode();
+ NC_BUFFERED(TRUE);
_nc_mvcur_resume();
_nc_screen_resume();
SP->_mouse_resume(SP);
diff --git a/lib/libcurses/lib_endwin.c b/lib/libcurses/lib_endwin.c
index d8a15194c0a..e6b9eb5a29b 100644
--- a/lib/libcurses/lib_endwin.c
+++ b/lib/libcurses/lib_endwin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_endwin.c,v 1.5 1998/07/23 21:18:43 millert Exp $ */
+/* $OpenBSD: lib_endwin.c,v 1.6 1998/09/17 04:14:30 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$From: lib_endwin.c,v 1.14 1998/02/11 12:13:54 tom Exp $")
+MODULE_ID("$From: lib_endwin.c,v 1.15 1998/09/12 22:50:25 tom Exp $")
int
endwin(void)
@@ -52,10 +52,11 @@ endwin(void)
T((T_CALLED("endwin()")));
if (SP) {
- SP->_endwin = TRUE;
- SP->_mouse_wrap(SP);
- _nc_screen_wrap();
- _nc_mvcur_wrap(); /* wrap up cursor addressing */
+ SP->_endwin = TRUE;
+ SP->_mouse_wrap(SP);
+ _nc_screen_wrap();
+ _nc_mvcur_wrap(); /* wrap up cursor addressing */
+ NC_BUFFERED(FALSE);
}
returnCode(reset_shell_mode());
diff --git a/lib/libcurses/lib_mouse.c b/lib/libcurses/lib_mouse.c
index 90cf5673239..ae2909174e3 100644
--- a/lib/libcurses/lib_mouse.c
+++ b/lib/libcurses/lib_mouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_mouse.c,v 1.6 1998/09/13 19:16:27 millert Exp $ */
+/* $OpenBSD: lib_mouse.c,v 1.7 1998/09/17 04:14:30 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -422,8 +422,8 @@ static bool _nc_mouse_parse(int runcount)
if (runcount == 1)
{
TR(MY_TRACE, ("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
- _tracemouse(prev),
- (long) (prev - events)));
+ _tracemouse(prev),
+ (long) (prev - events)));
return (prev->id >= 0)
? ((prev->bstate & eventmask) ? TRUE : FALSE)
: FALSE;
diff --git a/lib/libcurses/lib_mvcur.c b/lib/libcurses/lib_mvcur.c
index 25152108369..adb0da65e20 100644
--- a/lib/libcurses/lib_mvcur.c
+++ b/lib/libcurses/lib_mvcur.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_mvcur.c,v 1.10 1998/07/23 21:19:03 millert Exp $ */
+/* $OpenBSD: lib_mvcur.c,v 1.11 1998/09/17 04:14:31 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -155,7 +155,7 @@
#include <term.h>
#include <ctype.h>
-MODULE_ID("$From: lib_mvcur.c,v 1.50 1998/02/11 12:13:56 tom Exp $")
+MODULE_ID("$From: lib_mvcur.c,v 1.52 1998/09/12 23:03:26 tom Exp $")
#define STRLEN(s) (s != 0) ? strlen(s) : 0
@@ -952,17 +952,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
baudrate();
_nc_mvcur_init();
-#if HAVE_SETVBUF || HAVE_SETBUFFER
- /*
- * Undo the effects of our optimization hack, otherwise our interactive
- * prompts don't flush properly.
- */
-#if HAVE_SETVBUF
- (void) setvbuf(SP->_ofp, malloc(BUFSIZ), _IOLBF, BUFSIZ);
-#elif HAVE_SETBUFFER
- (void) setbuffer(SP->_ofp, malloc(BUFSIZ), BUFSIZ);
-#endif
-#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */
+ NC_BUFFERED(FALSE);
(void) puts("The mvcur tester. Type ? for help");
@@ -1059,7 +1049,7 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
}
else if (buf[0] == 'i')
{
- dump_init((char *)NULL, F_TERMINFO, S_TERMINFO, 70, 0);
+ dump_init((char *)NULL, F_TERMINFO, S_TERMINFO, 70, 0, FALSE);
dump_entry(&cur_term->type, 0, 0);
putchar('\n');
}
diff --git a/lib/libcurses/lib_set_term.c b/lib/libcurses/lib_set_term.c
index e64708d4b7f..10c913fc3ca 100644
--- a/lib/libcurses/lib_set_term.c
+++ b/lib/libcurses/lib_set_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_set_term.c,v 1.6 1998/07/23 21:19:22 millert Exp $ */
+/* $OpenBSD: lib_set_term.c,v 1.7 1998/09/17 04:14:31 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -46,7 +46,7 @@
#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_set_term.c,v 1.39 1998/05/30 23:44:18 Todd.Miller Exp $")
+MODULE_ID("$From: lib_set_term.c,v 1.40 1998/09/12 23:16:41 tom Exp $")
/*
* If the output file descriptor is connected to a tty (the typical case) it
@@ -76,6 +76,30 @@ MODULE_ID("$From: lib_set_term.c,v 1.39 1998/05/30 23:44:18 Todd.Miller Exp $")
* performed on the stream." (ISO 7.9.5.6.)
*
* Grrrr...
+ *
+ * On a lighter note, many implementations do in fact allow an application to
+ * reset the buffering after it has been written to. We try to do this because
+ * otherwise we leave stdout in buffered mode after endwin() is called. (This
+ * also happens with SVr4 curses).
+ *
+ * There are pros/cons:
+ *
+ * con:
+ * There is no guarantee that we can reestablish buffering once we've
+ * dropped it.
+ *
+ * We _may_ lose data if the implementation does not coordinate this with
+ * fflush.
+ *
+ * pro:
+ * An implementation is more likely to refuse to change the buffering than
+ * to do it in one of the ways mentioned above.
+ *
+ * The alternative is to have the application try to change buffering
+ * itself, which is certainly no improvement.
+ *
+ * Just in case it does not work well on a particular system, the calls to
+ * change buffering are all via the macro NC_BUFFERED.
*/
void _nc_set_buffer(FILE *ofp, bool buffered)
{
@@ -95,9 +119,9 @@ void _nc_set_buffer(FILE *ofp, bool buffered)
#if HAVE_SETVBUF
#ifdef SETVBUF_REVERSED /* pre-svr3? */
- (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IONBF);
+ (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF);
#else
- (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IONBF, buf_len);
+ (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len);
#endif
#elif HAVE_SETBUFFER
(void) setbuffer(ofp, buf_ptr, (int)buf_len);