BSD 4_3 release
[unix-history] / usr / src / usr.lib / libcurses / scroll.c
index 8aa2d58..41eae9e 100644 (file)
@@ -1,38 +1,42 @@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)scroll.c   5.1 (Berkeley) 6/7/85";
+#endif not lint
+
 # include      "curses.ext"
 
 /*
  *     This routine scrolls the window up a line.
  *
 # include      "curses.ext"
 
 /*
  *     This routine scrolls the window up a line.
  *
- * 6/1/83 (Berkeley) @(#)scroll.c      1.3
  */
 scroll(win)
  */
 scroll(win)
-reg WINDOW     *win; {
+register  WINDOW       *win;
+{
+       register int    oy, ox;
 
 
-       reg char        *sp;
-       reg int         i;
-       reg char        *temp;
+# ifdef DEBUG
+       fprintf(outf, "SCROLL(%0.2o)\n", win);
+# endif
 
        if (!win->_scroll)
                return ERR;
 
        if (!win->_scroll)
                return ERR;
-       temp = win->_y[0];
-       for (i = 1; i < win->_maxy; i++)
-               win->_y[i - 1] = win->_y[i];
-       for (sp = temp; sp < &temp[win->_maxx]; )
-               *sp++ = ' ';
-       win->_y[win->_maxy - 1] = temp;
-       win->_cury--;
+
+       getyx(win, oy, ox);
+       wmove(win, 0, 0);
+       wdeleteln(win);
+       wmove(win, oy, ox);
+
        if (win == curscr) {
        if (win == curscr) {
-               putchar('\n');
+               _putchar('\n');
                if (!NONL)
                        win->_curx = 0;
 # ifdef DEBUG
                fprintf(outf, "SCROLL: win == curscr\n");
 # endif
        }
                if (!NONL)
                        win->_curx = 0;
 # ifdef DEBUG
                fprintf(outf, "SCROLL: win == curscr\n");
 # endif
        }
-# ifdef DEBUG
-       else
-               fprintf(outf, "SCROLL: win [0%o] != curscr [0%o]\n",win,curscr);
-# endif
-       touchwin(win);
-       return OK;
 }
 }