if a short file, don't move to lower-left corner of the screen,
[unix-history] / usr / src / usr.bin / more / screen.c
index 504ee5a..d5a652a 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)screen.c   5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)screen.c   5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -211,18 +211,17 @@ get_term()
        /*
         * Get size of the screen.
         */
        /*
         * Get size of the screen.
         */
-       if (sc_height == -1)
 #ifdef TIOCGWINSZ
 #ifdef TIOCGWINSZ
-               if (ioctl(2, TIOCGWINSZ, &w) == 0 && w.ws_row > 0)
-                       sc_height = w.ws_row;
+       if (ioctl(2, TIOCGWINSZ, &w) == 0 && w.ws_row > 0)
+               sc_height = w.ws_row;
 #else
 #ifdef WIOCGETD
 #else
 #ifdef WIOCGETD
-               if (ioctl(2, WIOCGETD, &w) == 0 && w.uw_height > 0)
-                       sc_height = w.uw_height/w.uw_vs;
+       if (ioctl(2, WIOCGETD, &w) == 0 && w.uw_height > 0)
+               sc_height = w.uw_height/w.uw_vs;
 #endif
 #endif
 #endif
 #endif
-               else
-                       sc_height = tgetnum("li");
+       else
+               sc_height = tgetnum("li");
        hard = (sc_height < 0 || tgetflag("hc"));
        if (hard) {
                /* Oh no, this is a hardcopy terminal. */
        hard = (sc_height < 0 || tgetflag("hc"));
        if (hard) {
                /* Oh no, this is a hardcopy terminal. */
@@ -433,12 +432,15 @@ add_line()
        tputs(sc_addline, sc_height, putchr);
 }
 
        tputs(sc_addline, sc_height, putchr);
 }
 
-/*
- * Move cursor to lower left corner of screen.
- */
+int short_file;                                /* if file less than a screen */
 lower_left()
 {
 lower_left()
 {
-       tputs(sc_lower_left, 1, putchr);
+       if (short_file) {
+               putchr('\r');
+               flush();
+       }
+       else
+               tputs(sc_lower_left, 1, putchr);
 }
 
 /*
 }
 
 /*