From: Mischa POSLAWSKY Date: Mon, 23 Sep 2019 18:03:14 +0000 (+0200) Subject: width option fallback to tput X-Git-Tag: v1.07~35 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/7353470c733658bd4645085180191f2bfd918ab5 width option fallback to tput Environment variable is not exported on some systems. --- diff --git a/barcat b/barcat index 2acdadd..804b3b0 100755 --- a/barcat +++ b/barcat @@ -101,7 +101,7 @@ GetOptions(\%opt, }, ) or exit 64; # EX_USAGE -$opt{width} ||= $ENV{COLUMNS} || 80; +$opt{width} ||= $ENV{COLUMNS} || qx(tput cols) || 80; $opt{color} //= -t *STDOUT; # enable on tty $opt{'graph-format'} //= '-'; $opt{trim} *= $opt{width} / 100 if $opt{trimpct};