summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/lib_kernel.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-12-02 06:40:24 +0000
committerache <ache@FreeBSD.org>1994-12-02 06:40:24 +0000
commitda3bc85e1374c51c5dced6baacf60288a5a3ea40 (patch)
tree0beef683196d6d2f76165d3756c20ac09c0ee20b /lib/libncurses/lib_kernel.c
parentd856190a55e1ac4bbc1e389083c70c3a9c37746e (diff)
downloadFreeBSD-src-da3bc85e1374c51c5dced6baacf60288a5a3ea40.zip
FreeBSD-src-da3bc85e1374c51c5dced6baacf60288a5a3ea40.tar.gz
Upgrade to version 1.8.6
Diffstat (limited to 'lib/libncurses/lib_kernel.c')
-rw-r--r--lib/libncurses/lib_kernel.c73
1 files changed, 61 insertions, 12 deletions
diff --git a/lib/libncurses/lib_kernel.c b/lib/libncurses/lib_kernel.c
index 40ccd2c..5fa1879 100644
--- a/lib/libncurses/lib_kernel.c
+++ b/lib/libncurses/lib_kernel.c
@@ -7,7 +7,6 @@
* lib_kernel.c
*
* Misc. low-level routines:
- * wattron()
* reset_prog_mode()
* reset_shell_mode()
* baudrate()
@@ -21,15 +20,41 @@
*/
#include "curses.priv.h"
-#include <nterm.h>
+#include "terminfo.h"
int wattron(WINDOW *win, chtype at)
{
- win->_attrs &= (unsigned long)0xffff00ff;
- win->_attrs |= at;
+ T(("wattron(%x,%s) current = %s", win, _traceattr(at), _traceattr(win->_attrs)));
+ if (PAIR_NUMBER(at) > 0x00) {
+ win->_attrs = (win->_attrs & ~A_COLOR) | at ;
+ T(("new attribute is %s", _traceattr(win->_attrs)));
+ } else {
+ win->_attrs |= at;
+ T(("new attribute is %s", _traceattr(win->_attrs)));
+ }
return OK;
}
+int wattroff(WINDOW *win, chtype at)
+{
+#define IGNORE_COLOR_OFF FALSE
+
+ T(("wattroff(%x,%s) current = %s", win, _traceattr(at), _traceattr(win->_attrs)));
+ if (IGNORE_COLOR_OFF == TRUE) {
+ if (PAIR_NUMBER(at) == 0xff) /* turn off color */
+ win->_attrs &= ~at;
+ else /* leave color alone */
+ win->_attrs &= ~(at|~A_COLOR);
+ } else {
+ if (PAIR_NUMBER(at) > 0x00) /* turn off color */
+ win->_attrs &= ~at;
+ else /* leave color alone */
+ win->_attrs &= ~(at|~A_COLOR);
+ }
+ T(("new attribute is %s", _traceattr(win->_attrs)));
+ return OK;
+}
+
#ifndef MYTINFO
int reset_prog_mode()
{
@@ -61,6 +86,8 @@ int reset_shell_mode()
int curs_set(int vis)
{
+int cursor = SP->_cursor;
+
T(("curs_set(%d)", vis));
if (vis < 0 || vis > 2)
@@ -69,20 +96,43 @@ int curs_set(int vis)
switch(vis) {
case 2:
if (cursor_visible)
- tputs(cursor_visible, 1, _outc);
+ putp(cursor_visible);
break;
case 1:
if (cursor_normal)
- tputs(cursor_normal, 1, _outc);
+ putp(cursor_normal);
break;
case 0:
if (cursor_invisible)
- tputs(cursor_invisible, 1, _outc);
+ putp(cursor_invisible);
break;
}
- return OK;
+ SP->_cursor = vis;
+ return cursor;
}
+int delay_output(int ms)
+{
+int speed;
+
+ T(("delay_output(%d) called", ms));
+
+ if (!no_pad_char && (speed = baudrate()) == ERR)
+ return(ERR);
+ else {
+ register int nullcount;
+
+ if (!no_pad_char)
+ for (nullcount = ms * 1000 / speed; nullcount > 0; nullcount--)
+ putc(*pad_char, SP->_ofp);
+ (void) fflush(SP->_ofp);
+ if (no_pad_char)
+ napms(ms);
+ }
+
+ return OK;
+}
+
/*
* erasechar()
*
@@ -208,10 +258,9 @@ int
baudrate()
{
int i, ret;
-#ifdef UNTRACE
- if (_tracing)
- _tracef("baudrate() called");
-#endif
+
+ T(("baudrate() called"));
+
#ifdef TERMIOS
ret = cfgetospeed(&cur_term->Nttyb);
#else
OpenPOWER on IntegriCloud