From 9d3aba7b37b275350a9fe0887871da9ba73dcbd7 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 6 Oct 1999 09:04:55 +0000 Subject: more stuff --- more.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'more.c') diff --git a/more.c b/more.c index 2ea709278..6ac553e6b 100644 --- a/more.c +++ b/more.c @@ -25,12 +25,15 @@ const char more_usage[] = "[file ...]"; - +//#define ERASE_STUFF extern int more_main(int argc, char **argv) { int c, lines=0; - int next_page=0, rows = 24, cols=79; + int next_page=0, rows = 24; +#ifdef ERASE_STUFF + int cols=79; +#endif struct stat st; FILE *file = stdin; @@ -42,28 +45,30 @@ extern int more_main(int argc, char **argv) argv++; while (argc-- > 0) { - file = fopen(*argv, "r"); + file = fopen(*argv, "r"); if (file == NULL) { - perror(*argv); + perror("Can't open file"); return(FALSE); } fstat(fileno(file), &st); + fprintf(stderr, "hi\n"); while ((c = getc(file)) != EOF) { if ( next_page ) { int len=0; next_page = 0; lines=0; - len = fprintf(stdout, "--More-- (%d%% of %ld bytes)\n", + len = fprintf(stdout, "--More-- (%d%% of %ld bytes)", (int) (100*( (double) ftell(file) / (double) st.st_size )), st.st_size); fflush(stdout); getc( stdin); -#if 0 +#ifdef ERASE_STUFF + /* Try to erase the "More" message */ while(len-- > 0) putc('\b', stdout); while(len++ < cols) - putc('8', stdout); + putc(' ', stdout); while(len-- > 0) putc('\b', stdout); fflush(stdout); -- cgit v1.2.3