summaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
authorEric Andersen1999-10-06 09:04:55 +0000
committerEric Andersen1999-10-06 09:04:55 +0000
commit9d3aba7b37b275350a9fe0887871da9ba73dcbd7 (patch)
treeef6575073c089aaedbce47b63d13836552b4e556 /util-linux/more.c
parentb09c6b5d4a204dc89bbab702509b148602027ecd (diff)
downloadbusybox-9d3aba7b37b275350a9fe0887871da9ba73dcbd7.zip
busybox-9d3aba7b37b275350a9fe0887871da9ba73dcbd7.tar.gz
more stuff
Diffstat (limited to 'util-linux/more.c')
-rw-r--r--util-linux/more.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index 2ea7092..6ac553e 100644
--- a/util-linux/more.c
+++ b/util-linux/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);