xref: /original-bsd/lib/libcurses/scroll.c (revision f8557398)
1c0fde213Sdist /*
2*f8557398Sbostic  * Copyright (c) 1981, 1993, 1994
3fc5797f4Sbostic  *	The Regents of the University of California.  All rights reserved.
40c41a22eSbostic  *
5784468bbSbostic  * %sccs.include.redist.c%
6c0fde213Sdist  */
7c0fde213Sdist 
8c0fde213Sdist #ifndef lint
9*f8557398Sbostic static char sccsid[] = "@(#)scroll.c	8.3 (Berkeley) 05/04/94";
100c41a22eSbostic #endif /* not lint */
11c0fde213Sdist 
12*f8557398Sbostic #include "curses.h"
13535cc3b8Sarnold 
14535cc3b8Sarnold /*
1595ea2671Sbostic  * scroll --
1695ea2671Sbostic  *	Scroll the window up a line.
17535cc3b8Sarnold  */
1895ea2671Sbostic int
scroll(win)19535cc3b8Sarnold scroll(win)
20e7d23d7cSbloom 	register WINDOW *win;
21e7d23d7cSbloom {
22e7d23d7cSbloom 	register int oy, ox;
23535cc3b8Sarnold 
24e7d23d7cSbloom #ifdef DEBUG
25cf7cc3f4Sbostic 	__CTRACE("scroll: (%0.2o)\n", win);
26e7d23d7cSbloom #endif
27535cc3b8Sarnold 
28bcc2d588Selan 	if (!(win->flags & __SCROLLOK))
292989bfcaSbostic 		return (ERR);
30e7d23d7cSbloom 
31e7d23d7cSbloom 	getyx(win, oy, ox);
32e7d23d7cSbloom 	wmove(win, 0, 0);
33e7d23d7cSbloom 	wdeleteln(win);
34e7d23d7cSbloom 	wmove(win, oy, ox);
35e7d23d7cSbloom 
36535cc3b8Sarnold 	if (win == curscr) {
3795ea2671Sbostic 		putchar('\n');
38df6f83faSbostic 		if (!NONL)
39bcc2d588Selan 			win->curx = 0;
40535cc3b8Sarnold #ifdef DEBUG
41cf7cc3f4Sbostic 		__CTRACE("scroll: win == curscr\n");
42535cc3b8Sarnold #endif
43535cc3b8Sarnold 	}
442989bfcaSbostic 	return (OK);
45535cc3b8Sarnold }
46