summaryrefslogtreecommitdiff
path: root/lib/libcurses/lib_insstr.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-12-03 05:21:47 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-12-03 05:21:47 +0000
commit211326e37501ac01a66994a221020b75ab5f63f0 (patch)
tree6d6c7182f1034b1b04c98386a1c3ba44e8accd5f /lib/libcurses/lib_insstr.c
parent7c742f381e7808d0b12c17b534305751f3ebb0cb (diff)
Merge of ncurses-4.1-971129
Diffstat (limited to 'lib/libcurses/lib_insstr.c')
-rw-r--r--lib/libcurses/lib_insstr.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/lib/libcurses/lib_insstr.c b/lib/libcurses/lib_insstr.c
index c25071f76d5..de65b7bd457 100644
--- a/lib/libcurses/lib_insstr.c
+++ b/lib/libcurses/lib_insstr.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: lib_insstr.c,v 1.3 1997/12/03 05:21:21 millert Exp $ */
+
/***************************************************************************
* COPYRIGHT NOTICE *
@@ -31,33 +33,38 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("Id: lib_insstr.c,v 1.9 1997/02/15 16:09:53 tom Exp $")
+MODULE_ID("Id: lib_insstr.c,v 1.10 1997/09/20 15:02:34 juergen Exp $")
int winsnstr(WINDOW *win, const char *str, int n)
{
-short oy = win->_cury;
-short ox = win->_curx;
+int code = ERR;
+short oy;
+short ox ;
const char *cp;
- T((T_CALLED("winsstr(%p,%s,%d)"), win, _nc_visbuf(str), n));
-
- for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
- if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b')
- _nc_waddch_nosync(win, (chtype)(*cp));
- else if (is7bits(*cp) && iscntrl(*cp)) {
- winsch(win, ' ' + (chtype)(*cp));
- winsch(win, '^');
- win->_curx += 2;
- } else {
- winsch(win, (chtype)(*cp));
- win->_curx++;
- }
- if (win->_curx > win->_maxx)
- win->_curx = win->_maxx;
- }
+ T((T_CALLED("winsstr(%p,%s,%d)"), win, _nc_visbuf(str), n));
- win->_curx = ox;
- win->_cury = oy;
- _nc_synchook(win);
- returnCode(OK);
+ if (win && str) {
+ oy = win->_cury; ox = win->_curx;
+ for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
+ if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b')
+ _nc_waddch_nosync(win, (chtype)(*cp));
+ else if (is7bits(*cp) && iscntrl(*cp)) {
+ winsch(win, ' ' + (chtype)(*cp));
+ winsch(win, '^');
+ win->_curx += 2;
+ } else {
+ winsch(win, (chtype)(*cp));
+ win->_curx++;
+ }
+ if (win->_curx > win->_maxx)
+ win->_curx = win->_maxx;
+ }
+
+ win->_curx = ox;
+ win->_cury = oy;
+ _nc_synchook(win);
+ code = OK;
+ }
+ returnCode(code);
}