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

@ -9,6 +9,8 @@
/* no options, no getopt */
#include "busybox.h"
#define ESC "\033"
int resize_main(int argc, char **argv);
int resize_main(int argc, char **argv)
{
@ -27,10 +29,10 @@ int resize_main(int argc, char **argv)
* get_cursor_pos [6n
* restore_cursor_pos 8
*/
printf("\0337\033[r\033[999;999H\033[6n");
scanf("\033[%hu;%huR", &w.ws_row, &w.ws_col);
printf(ESC"7" ESC"[r" ESC"[999;999H" ESC"[6n");
scanf(ESC"[%hu;%huR", &w.ws_row, &w.ws_col);
ret = ioctl(STDOUT_FILENO, TIOCSWINSZ, &w);
printf("\0338");
printf(ESC"8");
tcsetattr(STDOUT_FILENO, TCSANOW, &old);
if (ENABLE_FEATURE_RESIZE_PRINT)
printf("COLUMNS=%d;LINES=%d;export COLUMNS LINES;\n",