/****************************************************************************
- * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000,2001 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 *
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insstr.c,v 1.14 2000/04/29 21:16:41 tom Exp $")
+MODULE_ID("$Id: lib_insstr.c,v 1.20 2002/09/28 16:22:34 tom Exp $")
-int
+NCURSES_EXPORT(int)
winsnstr(WINDOW *win, const char *s, int n)
{
int code = ERR;
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_visbufn(s,n), n));
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)) {
+ if (*cp == '\n' || *cp == '\r' || *cp == '\t' || *cp == '\b') {
+ NCURSES_CH_T wch;
+ SetChar2(wch, *cp);
+ _nc_waddch_nosync(win, wch);
+ } else if (is7bits(*cp) && iscntrl(*cp)) {
winsch(win, ' ' + (chtype) (*cp));
- winsch(win, '^');
+ winsch(win, (chtype) '^');
win->_curx += 2;
} else {
winsch(win, (chtype) (*cp));