document distributed with 4.3BSD
[unix-history] / usr / src / lib / libcurses / touchwin.c
CommitLineData
87c6fcf8
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8static char sccsid[] = "@(#)touchwin.c 5.1 (Berkeley) %G%";
9#endif not lint
10
ce69801e
KA
11# include "curses.ext"
12
13/*
14 * make it look like the whole window has been changed.
15 *
ce69801e
KA
16 */
17touchwin(win)
ee79d1a2 18register WINDOW *win;
ce69801e 19{
ee79d1a2 20 register int y, maxy;
60d72089 21
ee79d1a2
JB
22# ifdef DEBUG
23 fprintf(outf, "TOUCHWIN(%0.2o)\n", win);
24# endif
25 maxy = win->_maxy;
26 for (y = 0; y < maxy; y++)
27 touchline(win, y, 0, win->_maxx - 1);
60d72089
KA
28}
29
30/*
ee79d1a2 31 * touch a given line
60d72089 32 */
ee79d1a2
JB
33touchline(win, y, sx, ex)
34register WINDOW *win;
35register int y, sx, ex;
36{
37# ifdef DEBUG
38 fprintf(outf, "TOUCHLINE(%0.2o, %d, %d, %d)\n", win, y, sx, ex);
39 fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
40# endif
41 sx += win->_ch_off;
42 ex += win->_ch_off;
43 if (win->_firstch[y] == _NOCHANGE) {
44 win->_firstch[y] = sx;
45 win->_lastch[y] = ex;
46 }
47 else {
48 if (win->_firstch[y] > sx)
49 win->_firstch[y] = sx;
50 if (win->_lastch[y] < ex)
51 win->_lastch[y] = ex;
ce69801e 52 }
ee79d1a2
JB
53# ifdef DEBUG
54 fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]);
55# endif
ce69801e 56}