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[] = "@(#)insertln.c 5.6 (Berkeley) 08/23/92"; 10 #endif /* not lint */ 11 12 #include <curses.h> 13 #include <string.h> 14 15 /* 16 * winsertln -- 17 * Do an insert-line on the window, leaving (_cury,_curx) unchanged. 18 */ 19 int 20 winsertln(win) 21 register WINDOW *win; 22 { 23 24 register int y; 25 register char *end, *temp; 26 27 #ifdef DEBUG 28 __TRACE("insertln: (%0.2o)\n", win); 29 #endif 30 if (win->_orig == NULL) 31 temp = win->_y[win->_maxy - 1]; 32 for (y = win->_maxy - 1; y > win->_cury; --y) { 33 if (win->_orig == NULL) 34 win->_y[y] = win->_y[y - 1]; 35 else 36 bcopy(win->_y[y - 1], win->_y[y], win->_maxx); 37 touchline(win, y, 0, win->_maxx - 1); 38 } 39 if (win->_orig == NULL) 40 win->_y[y] = temp; 41 else 42 temp = win->_y[y]; 43 for (end = &temp[win->_maxx]; temp < end;) 44 *temp++ = ' '; 45 touchline(win, y, 0, win->_maxx - 1); 46 if (win->_orig == NULL) 47 __id_subwins(win); 48 return (OK); 49 } 50