source: trunk/minix/lib/curses/winsch.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 769 bytes
Line 
1#include <curses.h>
2#include "curspriv.h"
3
4/* Winsch() inserts character 'c' at the cursor position in
5 window 'win'. The cursor is advanced.
6*/
7
8int winsch(win, c)
9WINDOW *win;
10char c;
11{
12 int *temp1;
13 int *temp2;
14 int *end;
15 int x = win->_curx;
16 int y = win->_cury;
17 int maxx = win->_maxx;
18
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 */
Note: See TracBrowser for help on using the repository browser.