diff options
author | Karel Zak | 2012-05-15 11:58:20 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-15 11:58:20 +0200 |
commit | 7e9a9af14fef3ad555a287a367165e4a66b8482d (patch) | |
tree | 7c8faeec3718acc38cc4669a86abd398bd4b7939 /misc-utils | |
parent | blkid: use get_terminal_width() from ttyutils.h (diff) | |
download | kernel-qcow2-util-linux-7e9a9af14fef3ad555a287a367165e4a66b8482d.tar.gz kernel-qcow2-util-linux-7e9a9af14fef3ad555a287a367165e4a66b8482d.tar.xz kernel-qcow2-util-linux-7e9a9af14fef3ad555a287a367165e4a66b8482d.zip |
include/ttyutils: more robust get_terminal_width()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r-- | misc-utils/blkid.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index aec3528b4..5268aba1e 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -148,9 +148,11 @@ static void pretty_print_line(const char *device, const char *fs_type, static int term_width = -1; int len, w; - if (term_width < 0) + if (term_width < 0) { term_width = get_terminal_width(); - + if (term_width <= 0) + term_width = 80; + } if (term_width > 80) { term_width -= 80; w = term_width / 10; |