diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-11-26 04:02:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-11-26 04:02:03 +0000 |
commit | bda33b7e716d56bf1a9ecccb7e2543889f9ab1d3 (patch) | |
tree | 7bc4bcdf70ecc1d045693a309e96b304e1b49c33 /lib/libcurses/lib_instr.c | |
parent | cd15e61d557c4704743905eae7b88ae927cf0394 (diff) |
ncurses 4.1 + changes to work with our terminfo libs (instead of
the ncurses ones). Changes are #ifdef EXTERN_TERMINFO.
Post 4.1 patches will be applied in a separate commit.
Diffstat (limited to 'lib/libcurses/lib_instr.c')
-rw-r--r-- | lib/libcurses/lib_instr.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/libcurses/lib_instr.c b/lib/libcurses/lib_instr.c index e1ef5272fd9..d21de453a09 100644 --- a/lib/libcurses/lib_instr.c +++ b/lib/libcurses/lib_instr.c @@ -27,18 +27,30 @@ ** */ -#include "curses.priv.h" +#include <curses.priv.h> + +MODULE_ID("Id: lib_instr.c,v 1.6 1997/05/03 10:51:07 juergen Exp $") int winnstr(WINDOW *win, char *str, int n) { - int i; + int i, row, col; - T(("winnstr(%p,'%p',%d) called", win, str, n)); + T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n)); - for (i = 0; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++) - str[i] = win->_line[win->_cury].text[win->_curx + i] & A_CHARTEXT; - str[i] = '\0'; + getyx(win, row, col); - return(i); -} + if (n < 0) + n = win->_maxx - win->_curx + 1; + for (i = 0; i < n;) { + str[i++] = TextOf(win->_line[row].text[col]); + if (++col > win->_maxx) { + col = 0; + if (++row > win->_maxy) + break; + } + } + str[i] = '\0'; /* SVr4 does not seem to count the null */ + + returnCode(i); +} |