summaryrefslogtreecommitdiffstats
path: root/lib/libcurses/lib_addch.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-12-14 23:15:36 +0000
committermillert <millert@openbsd.org>1997-12-14 23:15:36 +0000
commitd2ffe6bf7b0cd86fe399a2efc19fa1415cfaf318 (patch)
tree864ea84dbd1bce6237cf47ecad8ddbcf89531f33 /lib/libcurses/lib_addch.c
parentcheck the length of data in memcpy's (diff)
downloadwireguard-openbsd-d2ffe6bf7b0cd86fe399a2efc19fa1415cfaf318.tar.xz
wireguard-openbsd-d2ffe6bf7b0cd86fe399a2efc19fa1415cfaf318.zip
ncurses-4.1-971213
Diffstat (limited to 'lib/libcurses/lib_addch.c')
-rw-r--r--lib/libcurses/lib_addch.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libcurses/lib_addch.c b/lib/libcurses/lib_addch.c
index cd22cff9a38..3633c9178bb 100644
--- a/lib/libcurses/lib_addch.c
+++ b/lib/libcurses/lib_addch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_addch.c,v 1.3 1997/12/03 05:21:10 millert Exp $ */
+/* $OpenBSD: lib_addch.c,v 1.4 1997/12/14 23:15:46 millert Exp $ */
/***************************************************************************
@@ -31,7 +31,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_addch.c,v 1.36 1997/10/08 09:38:17 jtc Exp $")
+MODULE_ID("Id: lib_addch.c,v 1.37 1997/12/02 20:17:46 Alexander.V.Lukyanov Exp $")
int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
{
@@ -186,14 +186,11 @@ int waddch_nosync(WINDOW *win, const chtype ch)
int t;
const char *s;
- if (ch & A_ALTCHARSET)
+ if ((ch & A_ALTCHARSET)
+ || ((t = TextOf(ch)) > 127)
+ || ((s = unctrl(t))[1] == 0))
return waddch_literal(win, ch);
- t = TextOf(ch);
- s = unctrl(t);
- if (s[1] == 0) /* not a control char */
- return waddch_literal(win, ch);
-
x = win->_curx;
y = win->_cury;
@@ -249,7 +246,10 @@ int waddch_nosync(WINDOW *win, const chtype ch)
win->_flags &= ~_WRAPPED;
break;
default:
- return(waddstr(win, s));
+ while (*s)
+ if (waddch_literal(win, (*s++)|AttrOf(ch)) == ERR)
+ return ERR;
+ return(OK);
}
win->_curx = x;