diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-10 16:32:14 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-10 16:32:14 +0000 |
commit | 4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5 (patch) | |
tree | 8cb052205ab9f9e97233afe39ddb2c6253ab8d1a /miscutils/less.c | |
parent | 2b52b2797bae774656b3f79ed1939a08fbed7b0e (diff) | |
download | busybox-w32-4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5.tar.gz busybox-w32-4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5.tar.bz2 busybox-w32-4eb8b936cb0aeb27c3e12f9a93fc43aa1e9668f5.zip |
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/less.c')
-rw-r--r-- | miscutils/less.c | 5 |
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) | |||
1251 | * is not a tty and turns into cat. This makes sense. */ | 1251 | * is not a tty and turns into cat. This makes sense. */ |
1252 | if (!isatty(STDOUT_FILENO)) | 1252 | if (!isatty(STDOUT_FILENO)) |
1253 | return bb_cat(argv); | 1253 | return bb_cat(argv); |
1254 | kbd_fd = open(CURRENT_TTY, O_RDONLY); | ||
1255 | if (kbd_fd < 0) | ||
1256 | return bb_cat(argv); | ||
1254 | 1257 | ||
1255 | if (!num_files) { | 1258 | if (!num_files) { |
1256 | if (isatty(STDIN_FILENO)) { | 1259 | if (isatty(STDIN_FILENO)) { |
@@ -1261,8 +1264,6 @@ int less_main(int argc, char **argv) | |||
1261 | } else | 1264 | } else |
1262 | filename = xstrdup(files[0]); | 1265 | filename = xstrdup(files[0]); |
1263 | 1266 | ||
1264 | kbd_fd = xopen(CURRENT_TTY, O_RDONLY); | ||
1265 | |||
1266 | get_terminal_width_height(kbd_fd, &width, &max_displayed_line); | 1267 | get_terminal_width_height(kbd_fd, &width, &max_displayed_line); |
1267 | /* 20: two tabstops + 4 */ | 1268 | /* 20: two tabstops + 4 */ |
1268 | if (width < 20 || max_displayed_line < 3) | 1269 | if (width < 20 || max_displayed_line < 3) |