new stdio; renamed from doprnt.c. There was a trivial vfprintf.c
[unix-history] / usr / src / lib / libcurses / insch.c
CommitLineData
6e1c93d0 1/*
2f14f200
KB
2 * Copyright (c) 1981 Regents of the University of California.
3 * All rights reserved.
4 *
c07973a2 5 * %sccs.include.redist.c%
6e1c93d0
DF
6 */
7
8#ifndef lint
c07973a2 9static char sccsid[] = "@(#)insch.c 5.4 (Berkeley) %G%";
2f14f200 10#endif /* not lint */
6e1c93d0 11
aec27b08
KA
12# include "curses.ext"
13
14/*
15 * This routine performs an insert-char on the line, leaving
16 * (_cury,_curx) unchanged.
17 *
aec27b08
KA
18 */
19winsch(win, c)
20reg WINDOW *win;
21char c; {
22
23 reg char *temp1, *temp2;
24 reg char *end;
25
26 end = &win->_y[win->_cury][win->_curx];
27 temp1 = &win->_y[win->_cury][win->_maxx - 1];
28 temp2 = temp1 - 1;
29 while (temp1 > end)
30 *temp1-- = *temp2--;
31 *temp1 = c;
62fc2477 32 touchline(win, win->_cury, win->_curx, win->_maxx - 1);
aec27b08
KA
33 if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
34 if (win->_scroll) {
35 wrefresh(win);
36 scroll(win);
37 win->_cury--;
38 }
bfed68c6 39 else
aec27b08 40 return ERR;
aec27b08
KA
41 return OK;
42}