mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Fix return code and don't output spurious newlines.
This commit is contained in:
parent
4ef40c02f4
commit
d6cde0bcf4
18
more.c
18
more.c
@ -164,6 +164,9 @@ extern int more_main(int argc, char **argv)
|
|||||||
lines = 0;
|
lines = 0;
|
||||||
page_height = terminal_height;
|
page_height = terminal_height;
|
||||||
please_display_more_prompt = 0;
|
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.
|
* allows the user to quit while in the middle of a file.
|
||||||
*/
|
*/
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
switch (input) {
|
/* increment by just one line if we are at
|
||||||
case 'q':
|
* the end of this line */
|
||||||
goto end;
|
if (input == '\n')
|
||||||
case '\n':
|
|
||||||
/* increment by just one line if we are at
|
|
||||||
* the end of this line*/
|
|
||||||
please_display_more_prompt = 1;
|
please_display_more_prompt = 1;
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Adjust the terminal height for any overlap, so that
|
/* Adjust the terminal height for any overlap, so that
|
||||||
* no lines get lost off the top. */
|
* no lines get lost off the top. */
|
||||||
if (len >= terminal_width) {
|
if (len >= terminal_width) {
|
||||||
@ -216,7 +214,7 @@ extern int more_main(int argc, char **argv)
|
|||||||
} while (--argc > 0);
|
} while (--argc > 0);
|
||||||
end:
|
end:
|
||||||
#ifdef BB_FEATURE_USE_TERMIOS
|
#ifdef BB_FEATURE_USE_TERMIOS
|
||||||
gotsig(0);
|
setTermSettings(fileno(cin), &initial_settings);
|
||||||
#endif
|
#endif
|
||||||
return(TRUE);
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,9 @@ extern int more_main(int argc, char **argv)
|
|||||||
lines = 0;
|
lines = 0;
|
||||||
page_height = terminal_height;
|
page_height = terminal_height;
|
||||||
please_display_more_prompt = 0;
|
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.
|
* allows the user to quit while in the middle of a file.
|
||||||
*/
|
*/
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
switch (input) {
|
/* increment by just one line if we are at
|
||||||
case 'q':
|
* the end of this line */
|
||||||
goto end;
|
if (input == '\n')
|
||||||
case '\n':
|
|
||||||
/* increment by just one line if we are at
|
|
||||||
* the end of this line*/
|
|
||||||
please_display_more_prompt = 1;
|
please_display_more_prompt = 1;
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Adjust the terminal height for any overlap, so that
|
/* Adjust the terminal height for any overlap, so that
|
||||||
* no lines get lost off the top. */
|
* no lines get lost off the top. */
|
||||||
if (len >= terminal_width) {
|
if (len >= terminal_width) {
|
||||||
@ -216,7 +214,7 @@ extern int more_main(int argc, char **argv)
|
|||||||
} while (--argc > 0);
|
} while (--argc > 0);
|
||||||
end:
|
end:
|
||||||
#ifdef BB_FEATURE_USE_TERMIOS
|
#ifdef BB_FEATURE_USE_TERMIOS
|
||||||
gotsig(0);
|
setTermSettings(fileno(cin), &initial_settings);
|
||||||
#endif
|
#endif
|
||||||
return(TRUE);
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user