aboutsummaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-04-12 20:51:01 +0000
committerMatt Kraai <kraai@debian.org>2001-04-12 20:51:01 +0000
commitd6cde0bcf43903c9f691ee7e745891f713419a9b (patch)
tree30a26d247d83e7d51b7eeee1e828f992a04c3060 /util-linux/more.c
parent4ef40c02f42fdc9131ae4de86499f8ccf584242d (diff)
downloadbusybox-w32-d6cde0bcf43903c9f691ee7e745891f713419a9b.tar.gz
busybox-w32-d6cde0bcf43903c9f691ee7e745891f713419a9b.tar.bz2
busybox-w32-d6cde0bcf43903c9f691ee7e745891f713419a9b.zip
Fix return code and don't output spurious newlines.
Diffstat (limited to 'util-linux/more.c')
-rw-r--r--util-linux/more.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index 732396f03..ffc79b179 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -164,6 +164,9 @@ extern int more_main(int argc, char **argv)
164 lines = 0; 164 lines = 0;
165 page_height = terminal_height; 165 page_height = terminal_height;
166 please_display_more_prompt = 0; 166 please_display_more_prompt = 0;
167
168 if (input == 'q')
169 goto end;
167 } 170 }
168 171
169 /* 172 /*
@@ -177,15 +180,10 @@ extern int more_main(int argc, char **argv)
177 * allows the user to quit while in the middle of a file. 180 * allows the user to quit while in the middle of a file.
178 */ 181 */
179 if (c == '\n') { 182 if (c == '\n') {
180 switch (input) { 183 /* increment by just one line if we are at
181 case 'q': 184 * the end of this line */
182 goto end; 185 if (input == '\n')
183 case '\n':
184 /* increment by just one line if we are at
185 * the end of this line*/
186 please_display_more_prompt = 1; 186 please_display_more_prompt = 1;
187 break;
188 }
189 /* Adjust the terminal height for any overlap, so that 187 /* Adjust the terminal height for any overlap, so that
190 * no lines get lost off the top. */ 188 * no lines get lost off the top. */
191 if (len >= terminal_width) { 189 if (len >= terminal_width) {
@@ -216,7 +214,7 @@ extern int more_main(int argc, char **argv)
216 } while (--argc > 0); 214 } while (--argc > 0);
217 end: 215 end:
218#ifdef BB_FEATURE_USE_TERMIOS 216#ifdef BB_FEATURE_USE_TERMIOS
219 gotsig(0); 217 setTermSettings(fileno(cin), &initial_settings);
220#endif 218#endif
221 return(TRUE); 219 return 0;
222} 220}