xref: /original-bsd/lib/libcurses/scroll.c (revision f4a18198)
1 /*
2  * Copyright (c) 1981, 1993, 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)scroll.c	8.3 (Berkeley) 05/04/94";
10 #endif /* not lint */
11 
12 #include "curses.h"
13 
14 /*
15  * scroll --
16  *	Scroll the window up a line.
17  */
18 int
19 scroll(win)
20 	register WINDOW *win;
21 {
22 	register int oy, ox;
23 
24 #ifdef DEBUG
25 	__CTRACE("scroll: (%0.2o)\n", win);
26 #endif
27 
28 	if (!(win->flags & __SCROLLOK))
29 		return (ERR);
30 
31 	getyx(win, oy, ox);
32 	wmove(win, 0, 0);
33 	wdeleteln(win);
34 	wmove(win, oy, ox);
35 
36 	if (win == curscr) {
37 		putchar('\n');
38 		if (!NONL)
39 			win->curx = 0;
40 #ifdef DEBUG
41 		__CTRACE("scroll: win == curscr\n");
42 #endif
43 	}
44 	return (OK);
45 }
46