aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-10 16:32:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-10 16:32:14 +0000
commit4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5 (patch)
tree8cb052205ab9f9e97233afe39ddb2c6253ab8d1a /miscutils
parent2b52b2797bae774656b3f79ed1939a08fbed7b0e (diff)
downloadbusybox-4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5.tar.gz
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
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/less.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 79732cc41..a7041552d 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -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)