Changed to new line data structures (__LDATA and __LINE) and
[unix-history] / usr / src / lib / libcurses / insertln.c
CommitLineData
87c6fcf8 1/*
2f14f200
KB
2 * Copyright (c) 1981 Regents of the University of California.
3 * All rights reserved.
4 *
c07973a2 5 * %sccs.include.redist.c%
87c6fcf8
DF
6 */
7
8#ifndef lint
1c04a491 9static char sccsid[] = "@(#)insertln.c 5.11 (Berkeley) %G%";
aafbddec 10#endif /* not lint */
87c6fcf8 11
aafbddec 12#include <curses.h>
a2af4b61 13#include <string.h>
259c2c61
KA
14
15/*
aafbddec 16 * winsertln --
0c5c5188 17 * Do an insert-line on the window, leaving (cury, curx) unchanged.
259c2c61 18 */
aafbddec 19int
259c2c61 20winsertln(win)
aafbddec
KB
21 register WINDOW *win;
22{
259c2c61 23
1589e7d3 24 register int y, i;
0c5c5188 25 register char *end;
1c04a491 26 register __LINE *temp;
259c2c61 27
aafbddec
KB
28#ifdef DEBUG
29 __TRACE("insertln: (%0.2o)\n", win);
e3fd04f0 30#endif
0c5c5188
EA
31 if (win->orig == NULL)
32 temp = win->lines[win->maxy - 1];
33 for (y = win->maxy - 1; y > win->cury; --y) {
fa740e7a 34 win->lines[y]->flags &= ~__ISPASTEOL;
938b967a 35 win->lines[y - 1]->flags &= ~__ISPASTEOL;
0c5c5188
EA
36 if (win->orig == NULL)
37 win->lines[y] = win->lines[y - 1];
e3fd04f0 38 else
0c5c5188 39 bcopy(win->lines[y - 1]->line,
1c04a491 40 win->lines[y]->line, win->maxx * __LDATASIZE);
0c5c5188 41 touchline(win, y, 0, win->maxx - 1);
259c2c61 42 }
0c5c5188
EA
43 if (win->orig == NULL)
44 win->lines[y] = temp;
e3fd04f0 45 else
0c5c5188 46 temp = win->lines[y];
1c04a491
EA
47 for(i = 0; i < win->maxx; i++) {
48 temp->line[i].ch = ' ';
49 temp->line[i].attr = 0;
50 }
0c5c5188
EA
51 touchline(win, y, 0, win->maxx - 1);
52 if (win->orig == NULL)
aafbddec
KB
53 __id_subwins(win);
54 return (OK);
259c2c61 55}