summaryrefslogtreecommitdiff
path: root/lib/libcurses/base/lib_insstr.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-06-19 03:54:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-06-19 03:54:00 +0000
commitd6e8f609245bfd13a1aee14a2347d3a3a6125319 (patch)
tree5633e2c339f330e0db835a1a8834519826c9f921 /lib/libcurses/base/lib_insstr.c
parente11e5df3fd5c0ef8be778b1ae185ee1842790d3e (diff)
ncurses-5.0-20000617
Diffstat (limited to 'lib/libcurses/base/lib_insstr.c')
-rw-r--r--lib/libcurses/base/lib_insstr.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/libcurses/base/lib_insstr.c b/lib/libcurses/base/lib_insstr.c
index db41e072158..69b1777f172 100644
--- a/lib/libcurses/base/lib_insstr.c
+++ b/lib/libcurses/base/lib_insstr.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_insstr.c,v 1.2 1999/03/14 03:10:32 millert Exp $ */
+/* $OpenBSD: lib_insstr.c,v 1.3 2000/06/19 03:53:42 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,8 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
/*
** lib_insstr.c
**
@@ -45,39 +43,41 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$From: lib_insstr.c,v 1.13 1999/03/14 00:27:21 tom Exp $")
+MODULE_ID("$From: lib_insstr.c,v 1.14 2000/04/29 21:16:41 tom Exp $")
-int winsnstr(WINDOW *win, const char *s, int n)
+int
+winsnstr(WINDOW *win, const char *s, int n)
{
-int code = ERR;
-short oy;
-short ox ;
-const unsigned char *str = (const unsigned char *)s;
-const unsigned char *cp;
+ int code = ERR;
+ NCURSES_SIZE_T oy;
+ NCURSES_SIZE_T ox;
+ const unsigned char *str = (const unsigned char *) s;
+ const unsigned char *cp;
- T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbuf(s), n));
+ T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbuf(s), n));
- if (win && str) {
- oy = win->_cury; ox = win->_curx;
- for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
+ 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));
+ _nc_waddch_nosync(win, (chtype) (*cp));
else if (is7bits(*cp) && iscntrl(*cp)) {
- winsch(win, ' ' + (chtype)(*cp));
- winsch(win, '^');
- win->_curx += 2;
+ winsch(win, ' ' + (chtype) (*cp));
+ winsch(win, '^');
+ win->_curx += 2;
} else {
- winsch(win, (chtype)(*cp));
- win->_curx++;
+ 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;
+ win->_curx = win->_maxx;
}
- returnCode(code);
+
+ win->_curx = ox;
+ win->_cury = oy;
+ _nc_synchook(win);
+ code = OK;
+ }
+ returnCode(code);
}