X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=more.c;h=974149177ad19372fdc68d45f991471115807f2a;hb=36fe1a30b1958351de2b8065cb19d3d1b8ed1b33;hp=909ed286be15c61df793b42882fb5917fb88c6a0;hpb=e90f4045afbcdcae81c417fffa635b3a5ab9166b;p=oweals%2Fbusybox.git diff --git a/more.c b/more.c index 909ed286b..974149177 100644 --- a/more.c +++ b/more.c @@ -30,8 +30,15 @@ #include #include #include +#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 */