making note of my changes.
[oweals/busybox.git] / more.c
diff --git a/more.c b/more.c
index 4693161282e7428d36d540f62cb563c554b81ed1..821427dda35b206a89c7f5b6f9ef7fbb3e56fc7b 100644 (file)
--- a/more.c
+++ b/more.c
@@ -2,10 +2,11 @@
  * Mini more implementation for busybox
  *
  *
- * Copyright (C) 1999 by Lineo, inc.
- * Blended by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
- * based on the original more implementation and code from the Debian 
- * boot-floppies team.
+ * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
+ *
+ * Latest version blended together by Erik Andersen <andersen@lineo.com>,
+ * based on the original more implementation by Bruce, and code from the 
+ * Debian boot-floppies team.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  */
 
-
-/* Turning this off makes things a bit smaller (and less pretty) */
-#define BB_FEATURE_USE_TERMIOS
-/* Turning this off makes things a bit smaller (and less pretty) */
-#define BB_FEATURE_AUTOWIDTH
-
-
-
 #include "internal.h"
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <sys/ioctl.h>
 
-static const char more_usage[] = "[file ...]";
+static const char more_usage[] = "more [file ...]\n";
 
 /* ED: sparc termios is broken: revert back to old termio handling. */
 #ifdef BB_FEATURE_USE_TERMIOS
@@ -68,7 +61,7 @@ static const char more_usage[] = "[file ...]";
 #define TERMINAL_HEIGHT        24
 
 
-#if defined BB_FEATURE_AUTOWIDTH && ! defined USE_OLD_TERMIO
+#if defined BB_FEATURE_AUTOWIDTH
 static int terminal_width = 0, terminal_height = 0;
 #else
 #define terminal_width TERMINAL_WIDTH
@@ -84,7 +77,7 @@ extern int more_main(int argc, char **argv)
     struct stat st;    
     FILE *file;
 #ifdef BB_FEATURE_AUTOWIDTH
-    struct winsize win;
+    struct winsize win = {0,0};
 #endif
 
     argc--;
@@ -121,7 +114,7 @@ extern int more_main(int argc, char **argv)
        stty(fileno(cin), &new_settings);
 
 #ifdef BB_FEATURE_AUTOWIDTH    
-       ioctl(STDOUT_FILENO, TIOCGWINSZ, &win);
+       ioctl(fileno(stdout), TIOCGWINSZ, &win);
        if (win.ws_row > 4) 
            terminal_height = win.ws_row - 2;
        if (win.ws_col > 0)