X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=more.c;h=732396f03341a918b974136b3911f1cb97b85c2b;hb=a283157c3832f151fa9f5abf5f18c56d05e5815d;hp=f8b17b34afac0821814da2954037e07345fdcf25;hpb=5723934f7c6f08769e0767eec4db0c88cdeda5c9;p=oweals%2Fbusybox.git diff --git a/more.c b/more.c index f8b17b34a..732396f03 100644 --- a/more.c +++ b/more.c @@ -91,7 +91,7 @@ extern int more_main(int argc, char **argv) #ifdef BB_FEATURE_USE_TERMIOS cin = fopen("/dev/tty", "r"); if (!cin) - cin = fopen("/dev/console", "r"); + cin = xfopen("/dev/console", "r"); getTermSettings(fileno(cin), &initial_settings); new_settings = initial_settings; new_settings.c_cc[VMIN] = 1; @@ -124,13 +124,13 @@ extern int more_main(int argc, char **argv) if (file != stdin) { #if _FILE_OFFSET_BITS == 64 len += printf("(%d%% of %lld bytes)", + (int) (100 * ((double) ftell(file) / + (double) st.st_size)), (long long)st.st_size); #else len += printf("(%d%% of %ld bytes)", + (int) (100 * ((double) ftell(file) / + (double) st.st_size)), (long)st.st_size); #endif - (int) (100 * - ((double) ftell(file) / - (double) st.st_size)), - st.st_size); } len += printf("%s", #ifdef BB_FEATURE_USE_TERMIOS @@ -154,12 +154,10 @@ extern int more_main(int argc, char **argv) #ifdef BB_FEATURE_USE_TERMIOS /* Erase the "More" message */ + putc('\r', stdout); while (--len >= 0) - putc('\b', stdout); - while (++len <= terminal_width) putc(' ', stdout); - while (--len >= 0) - putc('\b', stdout); + putc('\r', stdout); fflush(stdout); #endif len=0;