date and time created 83/05/31 00:19:54 by sam
[unix-history] / usr / src / lib / libcurses / scroll.c
CommitLineData
064c6fd5
KA
1# include "curses.ext"
2
3/*
4 * This routine scrolls the window up a line.
5 *
8da28f22 6 * %G% (Berkeley) @(#)scroll.c 1.2
064c6fd5
KA
7 */
8scroll(win)
9reg WINDOW *win; {
10
11 reg char *sp;
12 reg int i;
13 reg char *temp;
14
15 if (!win->_scroll)
16 return ERR;
17 temp = win->_y[0];
8da28f22 18 for (i = 0; i < win->_maxy - 2; i++)
064c6fd5
KA
19 win->_y[i] = win->_y[i+1];
20 for (sp = temp; sp - temp < win->_maxx; )
21 *sp++ = ' ';
22 win->_y[win->_maxy - 1] = temp;
23 win->_cury--;
24 if (win == curscr) {
25 putchar('\n');
26 if (!NONL)
27 win->_curx = 0;
28# ifdef DEBUG
29 fprintf(outf, "SCROLL: win == curscr\n");
30# endif
31 }
32# ifdef DEBUG
33 else
34 fprintf(outf, "SCROLL: win [0%o] != curscr [0%o]\n",win,curscr);
35# endif
36 return OK;
37}