Fix spelling errors.
[oweals/busybox.git] / more.c
diff --git a/more.c b/more.c
index 909ed286be15c61df793b42882fb5917fb88c6a0..974149177ad19372fdc68d45f991471115807f2a 100644 (file)
--- a/more.c
+++ b/more.c
 #include <fcntl.h>
 #include <signal.h>
 #include <sys/ioctl.h>
+#define BB_DECLARE_EXTERN
+#define bb_need_help
+#include "messages.c"
 
-static const char more_usage[] = "more [file ...]\n";
+static const char more_usage[] = "more [FILE ...]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nMore is a filter for viewing FILE one screenful at a time.\n"
+#endif
+       ;
 
 /* ED: sparc termios is broken: revert back to old termio handling. */
 #ifdef BB_FEATURE_USE_TERMIOS
@@ -48,6 +55,7 @@ static const char more_usage[] = "more [file ...]\n";
 #endif
 
 FILE *cin;
+
 struct termios initial_settings, new_settings;
 
 void gotsig(int sig)
@@ -65,7 +73,10 @@ void gotsig(int sig)
 
 
 #if defined BB_FEATURE_AUTOWIDTH
-static int terminal_width = 0, terminal_height = 0;
+#ifdef BB_FEATURE_USE_TERMIOS
+static int terminal_width = TERMINAL_WIDTH;
+#endif
+static int terminal_height = TERMINAL_HEIGHT;
 #else
 #define terminal_width TERMINAL_WIDTH
 #define terminal_height        TERMINAL_HEIGHT
@@ -80,7 +91,7 @@ extern int more_main(int argc, char **argv)
        struct stat st;
        FILE *file;
 
-#ifdef BB_FEATURE_AUTOWIDTH
+#if defined BB_FEATURE_AUTOWIDTH && defined BB_FEATURE_USE_TERMIOS
        struct winsize win = { 0, 0 };
 #endif
 
@@ -88,7 +99,7 @@ extern int more_main(int argc, char **argv)
        argv++;
 
        if (argc > 0
-               && (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0)) {
+               && (strcmp(*argv, dash_dash_help) == 0 || strcmp(*argv, "-h") == 0)) {
                usage(more_usage);
        }
        do {
@@ -151,7 +162,11 @@ extern int more_main(int argc, char **argv)
                                        );
 
                                fflush(stdout);
+#ifdef BB_FEATURE_USE_TERMIOS
                                input = getc(cin);
+#else
+                               input = getc(stdin);
+#endif
 
 #ifdef BB_FEATURE_USE_TERMIOS
                                /* Erase the "More" message */