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