width option fallback to tput
[barcat.git] / barcat
diff --git a/barcat b/barcat
index 2acdaddfca5c4cf232a67cb35375742fcfaddea4..804b3b074b8c54ba005c61ffdd1ffb32c73b01a4 100755 (executable)
--- 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};