summaryrefslogtreecommitdiffhomepage
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
parent4ef40c02f42fdc9131ae4de86499f8ccf584242d (diff)
Fix return code and don't output spurious newlines.
-rw-r--r--more.c18
-rw-r--r--util-linux/more.c18
2 files changed, 16 insertions, 20 deletions
diff --git a/more.c b/more.c
index 732396f03..ffc79b179 100644
--- a/more.c
+++ b/more.c
@@ -164,6 +164,9 @@ extern int more_main(int argc, char **argv)
lines = 0;
page_height = terminal_height;
please_display_more_prompt = 0;
+
+ if (input == 'q')
+ goto end;
}
/*
@@ -177,15 +180,10 @@ extern int more_main(int argc, char **argv)
* allows the user to quit while in the middle of a file.
*/
if (c == '\n') {
- switch (input) {
- case 'q':
- goto end;
- case '\n':
- /* increment by just one line if we are at
- * the end of this line*/
+ /* increment by just one line if we are at
+ * the end of this line */
+ if (input == '\n')
please_display_more_prompt = 1;
- break;
- }
/* Adjust the terminal height for any overlap, so that
* no lines get lost off the top. */
if (len >= terminal_width) {
@@ -216,7 +214,7 @@ extern int more_main(int argc, char **argv)
} while (--argc > 0);
end:
#ifdef BB_FEATURE_USE_TERMIOS
- gotsig(0);
+ setTermSettings(fileno(cin), &initial_settings);
#endif
- return(TRUE);
+ return 0;
}
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)
lines = 0;
page_height = terminal_height;
please_display_more_prompt = 0;
+
+ if (input == 'q')
+ goto end;
}
/*
@@ -177,15 +180,10 @@ extern int more_main(int argc, char **argv)
* allows the user to quit while in the middle of a file.
*/
if (c == '\n') {
- switch (input) {
- case 'q':
- goto end;
- case '\n':
- /* increment by just one line if we are at
- * the end of this line*/
+ /* increment by just one line if we are at
+ * the end of this line */
+ if (input == '\n')
please_display_more_prompt = 1;
- break;
- }
/* Adjust the terminal height for any overlap, so that
* no lines get lost off the top. */
if (len >= terminal_width) {
@@ -216,7 +214,7 @@ extern int more_main(int argc, char **argv)
} while (--argc > 0);
end:
#ifdef BB_FEATURE_USE_TERMIOS
- gotsig(0);
+ setTermSettings(fileno(cin), &initial_settings);
#endif
- return(TRUE);
+ return 0;
}