diff options
author | Dave Reisner <d@falconindy.com> | 2011-06-14 04:23:49 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-20 07:11:46 +0200 |
commit | 620cddfc13fb2b2c9f1086ab201db5db3e25be1f (patch) | |
tree | 71c145d9dbea2fd16a6cafc46053853a72667f29 /src/pacman/callback.c | |
parent | 0f26e3aa5b91ffc0a5bef9a0f0bb9d40ec198407 (diff) | |
download | pacman-620cddfc13fb2b2c9f1086ab201db5db3e25be1f.tar.gz pacman-620cddfc13fb2b2c9f1086ab201db5db3e25be1f.tar.xz |
pacman/util.c: support terminals with unknown width
Add detection for stdout being attached to a tty device. When this check
fails, return a default width of 0, which callers interpret to mean
"don't wrap". Conversely, when our term ioctl suceeds but returns 0, we
interpret this to mean a tty with an unknown width (e.g., a serial
console), in which case we default to a sane value of 80.
Signed-off-by: Dave Reisner <d@falconindy.com>
Diffstat (limited to 'src/pacman/callback.c')
-rw-r--r-- | src/pacman/callback.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 4ac3b56b..66b14cdd 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -355,7 +355,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, int len, wclen, wcwid, padwid; wchar_t *wcstr; - const int cols = getcols(0); + const int cols = getcols(); if(config->noprogressbar || cols == 0) { return; @@ -504,7 +504,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) const char *rate_label, *xfered_label; int file_percent = 0, total_percent = 0; - const int cols = getcols(0); + const int cols = getcols(); if(config->noprogressbar || cols == 0 || file_total == -1) { if(file_xfered == 0) { |