aboutsummaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-06 09:04:55 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-06 09:04:55 +0000
commit9d3aba7b37b275350a9fe0887871da9ba73dcbd7 (patch)
treeef6575073c089aaedbce47b63d13836552b4e556 /util-linux/more.c
parentb09c6b5d4a204dc89bbab702509b148602027ecd (diff)
downloadbusybox-w32-9d3aba7b37b275350a9fe0887871da9ba73dcbd7.tar.gz
busybox-w32-9d3aba7b37b275350a9fe0887871da9ba73dcbd7.tar.bz2
busybox-w32-9d3aba7b37b275350a9fe0887871da9ba73dcbd7.zip
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 2ea709278..6ac553e6b 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -25,12 +25,15 @@
25 25
26const char more_usage[] = "[file ...]"; 26const char more_usage[] = "[file ...]";
27 27
28 28//#define ERASE_STUFF
29 29
30extern int more_main(int argc, char **argv) 30extern int more_main(int argc, char **argv)
31{ 31{
32 int c, lines=0; 32 int c, lines=0;
33 int next_page=0, rows = 24, cols=79; 33 int next_page=0, rows = 24;
34#ifdef ERASE_STUFF
35 int cols=79;
36#endif
34 struct stat st; 37 struct stat st;
35 FILE *file = stdin; 38 FILE *file = stdin;
36 39
@@ -42,28 +45,30 @@ extern int more_main(int argc, char **argv)
42 argv++; 45 argv++;
43 46
44 while (argc-- > 0) { 47 while (argc-- > 0) {
45 file = fopen(*argv, "r"); 48 file = fopen(*argv, "r");
46 if (file == NULL) { 49 if (file == NULL) {
47 perror(*argv); 50 perror("Can't open file");
48 return(FALSE); 51 return(FALSE);
49 } 52 }
50 fstat(fileno(file), &st); 53 fstat(fileno(file), &st);
54 fprintf(stderr, "hi\n");
51 55
52 while ((c = getc(file)) != EOF) { 56 while ((c = getc(file)) != EOF) {
53 if ( next_page ) { 57 if ( next_page ) {
54 int len=0; 58 int len=0;
55 next_page = 0; 59 next_page = 0;
56 lines=0; 60 lines=0;
57 len = fprintf(stdout, "--More-- (%d%% of %ld bytes)\n", 61 len = fprintf(stdout, "--More-- (%d%% of %ld bytes)",
58 (int) (100*( (double) ftell(file) / (double) st.st_size )), 62 (int) (100*( (double) ftell(file) / (double) st.st_size )),
59 st.st_size); 63 st.st_size);
60 fflush(stdout); 64 fflush(stdout);
61 getc( stdin); 65 getc( stdin);
62#if 0 66#ifdef ERASE_STUFF
67 /* Try to erase the "More" message */
63 while(len-- > 0) 68 while(len-- > 0)
64 putc('\b', stdout); 69 putc('\b', stdout);
65 while(len++ < cols) 70 while(len++ < cols)
66 putc('8', stdout); 71 putc(' ', stdout);
67 while(len-- > 0) 72 while(len-- > 0)
68 putc('\b', stdout); 73 putc('\b', stdout);
69 fflush(stdout); 74 fflush(stdout);