#ifdef CONFIG_FEATURE_AUTOWIDTH
/* Obtain the terminal width. */
- get_terminal_width_height(0, &terminal_width, NULL);
+ get_terminal_width_height(fileno(stdout), &terminal_width, NULL);
/* Go one less... */
terminal_width--;
#endif
{
struct winsize win = { 0, 0, 0, 0 };
#ifdef CONFIG_FEATURE_AUTOWIDTH
- if (ioctl(0, TIOCGWINSZ, &win) != 0) {
+ if (ioctl(fd, TIOCGWINSZ, &win) != 0) {
win.ws_row = 24;
win.ws_col = 80;
}
int please_display_more_prompt = -1;
struct stat st;
FILE *file;
+ FILE *in_file = stdin;
int len, page_height;
argc--;
cin = fopen(CURRENT_TTY, "r");
if (!cin)
cin = bb_xfopen(CONSOLE_DEV, "r");
+ in_file = cin;
please_display_more_prompt = 0;
#ifdef CONFIG_FEATURE_USE_TERMIOS
getTermSettings(fileno(cin), &initial_settings);
if(please_display_more_prompt>0)
please_display_more_prompt = 0;
- get_terminal_width_height(0, &terminal_width, &terminal_height);
+ get_terminal_width_height(fileno(in_file), &terminal_width, &terminal_height);
if (terminal_height > 4)
terminal_height -= 2;
if (terminal_width > 0)