aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/base/lib_insstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/ncurses/base/lib_insstr.c')
-rw-r--r--contrib/ncurses/ncurses/base/lib_insstr.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/contrib/ncurses/ncurses/base/lib_insstr.c b/contrib/ncurses/ncurses/base/lib_insstr.c
index cba147318b8e..a2275f9457b6 100644
--- a/contrib/ncurses/ncurses/base/lib_insstr.c
+++ b/contrib/ncurses/ncurses/base/lib_insstr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,8 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
/*
** lib_insstr.c
**
@@ -43,39 +41,41 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insstr.c,v 1.13 1999/03/14 00:27:21 tom Exp $")
+MODULE_ID("$Id: 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);
}