diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/appletlib.c | 2 | ||||
-rw-r--r-- | libbb/progress.c | 9 | ||||
-rw-r--r-- | libbb/xfuncs.c | 6 |
3 files changed, 8 insertions, 9 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 0f83eda..58bb2f1 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -623,7 +623,7 @@ static int busybox_main(char **argv) output_width = 80; if (ENABLE_FEATURE_AUTOWIDTH) { /* Obtain the terminal width */ - get_terminal_width_height(0, &output_width, NULL); + output_width = get_terminal_width(2); } dup2(1, 2); diff --git a/libbb/progress.c b/libbb/progress.c index 372feb0..6154dca 100644 --- a/libbb/progress.c +++ b/libbb/progress.c @@ -45,13 +45,6 @@ enum { STALLTIME = 5 }; -static unsigned int get_tty2_width(void) -{ - unsigned width; - get_terminal_width_height(2, &width, NULL); - return width; -} - void FAST_FUNC bb_progress_init(bb_progress_t *p, const char *curfile) { #if ENABLE_UNICODE_SUPPORT @@ -148,7 +141,7 @@ void FAST_FUNC bb_progress_update(bb_progress_t *p, unsigned ratio = 100 * beg_and_transferred / totalsize; fprintf(stderr, "%4u%%", ratio); - barlength = get_tty2_width() - 49; + barlength = get_terminal_width(2) - 49; if (barlength > 0) { /* god bless gcc for variable arrays :) */ char buf[barlength + 1]; diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 0c99696..206edb4 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -270,6 +270,12 @@ int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *heigh *width = wh_helper(win.ws_col, 80, "COLUMNS", &err); return err; } +int FAST_FUNC get_terminal_width(int fd) +{ + unsigned width; + get_terminal_width_height(fd, &width, NULL); + return width; +} int FAST_FUNC tcsetattr_stdin_TCSANOW(const struct termios *tp) { |