/* PDCurses */12#include <curspriv.h>34/*man-start**************************************************************56scroll7------89### Synopsis1011int scroll(WINDOW *win);12int scrl(int n);13int wscrl(WINDOW *win, int n);1415### Description1617scroll() causes the window to scroll up one line. This involves18moving the lines in the window data strcture.1920With a positive n, scrl() and wscrl() scroll the window up n lines21(line i + n becomes i); otherwise they scroll the window down n22lines.2324For these functions to work, scrolling must be enabled via25scrollok(). Note also that scrolling is not allowed if the supplied26window is a pad.2728### Return Value2930All functions return OK on success and ERR on error.3132### Portability33X/Open ncurses NetBSD34scroll Y Y Y35scrl Y Y Y36wscrl Y Y Y3738**man-end****************************************************************/3940int wscrl(WINDOW *win, int n)41{42int i, l, dir, start, end;43chtype blank, *temp;4445/* Check if window scrolls. Valid for window AND pad */4647if (!win || !win->_scroll || !n)48return ERR;4950blank = win->_bkgd;5152if (n > 0)53{54start = win->_tmarg;55end = win->_bmarg;56dir = 1;57}58else59{60start = win->_bmarg;61end = win->_tmarg;62dir = -1;63}6465for (l = 0; l < (n * dir); l++)66{67temp = win->_y[start];6869/* re-arrange line pointers */7071for (i = start; i != end; i += dir)72win->_y[i] = win->_y[i + dir];7374win->_y[end] = temp;7576/* make a blank line */7778for (i = 0; i < win->_maxx; i++)79*temp++ = blank;80}8182touchline(win, win->_tmarg, win->_bmarg - win->_tmarg + 1);8384PDC_sync(win);85return OK;86}8788int scrl(int n)89{90PDC_LOG(("scrl() - called\n"));9192return wscrl(stdscr, n);93}9495int scroll(WINDOW *win)96{97PDC_LOG(("scroll() - called\n"));9899return wscrl(win, 1);100}101102103