aboutsummaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-08 17:00:52 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-08 17:00:52 +0000
commitfbb39c83b69d6c4de943c0b7374000339635d13d (patch)
tree874ba86bb5753f4afd5a770308df9e555c78cf90 /util-linux/more.c
parent07e5297ca7707d2fd56ab2fa8e1ea0c9805035e3 (diff)
downloadbusybox-w32-fbb39c83b69d6c4de943c0b7374000339635d13d.tar.gz
busybox-w32-fbb39c83b69d6c4de943c0b7374000339635d13d.tar.bz2
busybox-w32-fbb39c83b69d6c4de943c0b7374000339635d13d.zip
Stuff
-Erik
Diffstat (limited to 'util-linux/more.c')
-rw-r--r--util-linux/more.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index bc3850510..ea5e22562 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -41,8 +41,7 @@ static const char more_usage[] = "[file ...]";
41/* ED: sparc termios is broken: revert back to old termio handling. */ 41/* ED: sparc termios is broken: revert back to old termio handling. */
42#ifdef BB_MORE_TERM 42#ifdef BB_MORE_TERM
43 43
44 44#if #cpu(sparc)
45#if defined (__sparc__)
46# define USE_OLD_TERMIO 45# define USE_OLD_TERMIO
47# include <termio.h> 46# include <termio.h>
48# include <sys/ioctl.h> 47# include <sys/ioctl.h>
@@ -69,13 +68,13 @@ extern int more_main(int argc, char **argv)
69 struct stat st; 68 struct stat st;
70 FILE *file; 69 FILE *file;
71 70
72 if ( strcmp(*argv,"--help")==0 || strcmp(*argv,"-h")==0 ) {
73 usage (more_usage);
74 }
75 argc--; 71 argc--;
76 argv++; 72 argv++;
77 73
78 while (argc >= 0) { 74 if ( argc > 0 && (strcmp(*argv,"--help")==0 || strcmp(*argv,"-h")==0) ) {
75 usage (more_usage);
76 }
77 do {
79 if (argc==0) { 78 if (argc==0) {
80 file = stdin; 79 file = stdin;
81 } 80 }
@@ -103,6 +102,9 @@ extern int more_main(int argc, char **argv)
103 stty(fileno(cin), &new_settings); 102 stty(fileno(cin), &new_settings);
104 103
105 (void) signal(SIGINT, gotsig); 104 (void) signal(SIGINT, gotsig);
105 (void) signal(SIGQUIT, gotsig);
106 (void) signal(SIGTERM, gotsig);
107
106 108
107#endif 109#endif
108 while ((c = getc(file)) != EOF) { 110 while ((c = getc(file)) != EOF) {
@@ -141,18 +143,17 @@ extern int more_main(int argc, char **argv)
141 } 143 }
142 if (input=='q') 144 if (input=='q')
143 goto end; 145 goto end;
144 if (input==' ' && c == '\n' ) 146 if (input=='\n' && c == '\n' )
145 next_page = 1; 147 next_page = 1;
146 if ( c == '\n' && ++lines == 24 ) 148 if ( c == ' ' && ++lines == 24 )
147 next_page = 1; 149 next_page = 1;
148 putc(c, stdout); 150 putc(c, stdout);
149 } 151 }
150 fclose(file); 152 fclose(file);
151 fflush(stdout); 153 fflush(stdout);
152 154
153 argc--;
154 argv++; 155 argv++;
155 } 156 } while (--argc > 0);
156end: 157end:
157#ifdef BB_MORE_TERM 158#ifdef BB_MORE_TERM
158 gotsig(0); 159 gotsig(0);