1 /* 2 * Copyright (c) 1981 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)insch.c 5.9 (Berkeley) 10/27/92"; 10 #endif /* not lint */ 11 12 #include <curses.h> 13 14 /* 15 * winsch -- 16 * Do an insert-char on the line, leaving (cury, curx) unchanged. 17 */ 18 int 19 winsch(win, ch) 20 register WINDOW *win; 21 int ch; 22 { 23 24 register __LDATA *end, *temp1, *temp2; 25 26 end = &win->lines[win->cury]->line[win->curx]; 27 temp1 = &win->lines[win->cury]->line[win->maxx - 1]; 28 temp2 = temp1 - 1; 29 while (temp1 > end) { 30 bcopy(temp2, temp1, sizeof(__LDATA)); 31 temp1--, temp2--; 32 } 33 temp1->ch = ch; 34 temp1->attr &= ~__STANDOUT; 35 __touchline(win, win->cury, win->curx, win->maxx - 1, 0); 36 if (win->cury == LINES - 1 && 37 (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || 38 win->lines[LINES -1]->line[COLS - 1].attr != 0)) 39 if (win->flags & __SCROLLOK) { 40 wrefresh(win); 41 scroll(win); 42 win->cury--; 43 } else 44 return (ERR); 45 return (OK); 46 } 47