. use library function to parse memory string
[minix3.git] / lib / curses / winsch.c
blobb7c943089a54ecb9235f9a2ccee67ab2f9e6176a
1 #include <curses.h>
2 #include "curspriv.h"
4 /* Winsch() inserts character 'c' at the cursor position in
5 window 'win'. The cursor is advanced.
6 */
8 int winsch(win, c)
9 WINDOW *win;
10 char c;
12 int *temp1;
13 int *temp2;
14 int *end;
15 int x = win->_curx;
16 int y = win->_cury;
17 int maxx = win->_maxx;
19 if ((c < ' ') && (c == '\n' || c == '\r' || c == '\t' || c == '\b'))
20 return(waddch(win, c));
21 end = &win->_line[y][x];
22 temp1 = &win->_line[y][maxx];
23 temp2 = temp1 - 1;
24 if (c < ' ') /* if CTRL-char make space for 2 */
25 temp2--;
26 while (temp1 > end) *temp1-- = *temp2--;
27 win->_maxchng[y] = maxx;
28 if ((win->_minchng[y] == _NO_CHANGE) || (win->_minchng[y] > x))
29 win->_minchng[y] = x;
30 return(waddch(win, c)); /* fixes CTRL-chars too */
31 } /* winsch */