more: do not mess with "/dev/console" (!);

fill whole 1st screen (was "screen sans one line");
    fall back to cat if redirected or no ctty
less: fall back to cat if no ctty (was exiting)
resize: cosmetics
This commit is contained in:
Denis Vlasenko 2007-03-10 16:32:14 +00:00
parent 2b52b2797b
commit 4eb8b936cb
3 changed files with 43 additions and 47 deletions

View file

@ -1251,6 +1251,9 @@ int less_main(int argc, char **argv)
* is not a tty and turns into cat. This makes sense. */
if (!isatty(STDOUT_FILENO))
return bb_cat(argv);
kbd_fd = open(CURRENT_TTY, O_RDONLY);
if (kbd_fd < 0)
return bb_cat(argv);
if (!num_files) {
if (isatty(STDIN_FILENO)) {
@ -1261,8 +1264,6 @@ int less_main(int argc, char **argv)
} else
filename = xstrdup(files[0]);
kbd_fd = xopen(CURRENT_TTY, O_RDONLY);
get_terminal_width_height(kbd_fd, &width, &max_displayed_line);
/* 20: two tabstops + 4 */
if (width < 20 || max_displayed_line < 3)