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.6 (Berkeley) 09/14/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 char *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 *temp1-- = *temp2--; 31 *temp1 = ch; 32 touchline(win, win->cury, win->curx, win->maxx - 1); 33 if (win->cury == LINES - 1 && 34 win->lines[LINES - 1]->line[COLS - 1] != ' ') 35 if (win->flags & __SCROLLOK) { 36 wrefresh(win); 37 scroll(win); 38 win->cury--; 39 } else 40 return (ERR); 41 return (OK); 42 } 43