diff options
author | Boris Egorov | 2016-01-05 17:17:58 +0100 |
---|---|---|
committer | Karel Zak | 2016-01-06 12:22:07 +0100 |
commit | 43b4f7ea5f96f861787c30fdd6933daf472fcc02 (patch) | |
tree | ae4b3fab8219c501b5216fbfcca394cf74b1c406 /misc-utils/blkid.c | |
parent | mount.8: Add documentation of overlay mount options (diff) | |
download | kernel-qcow2-util-linux-43b4f7ea5f96f861787c30fdd6933daf472fcc02.tar.gz kernel-qcow2-util-linux-43b4f7ea5f96f861787c30fdd6933daf472fcc02.tar.xz kernel-qcow2-util-linux-43b4f7ea5f96f861787c30fdd6933daf472fcc02.zip |
lib/tty: Pass default width to get_terminal_width()
Almost any code calling get_terminal_width() checks returned width for
non-positive values and sets it to some default value (say, 80). So,
let's pass this default value directly to the function.
[kzak@redhat.com: - get_terminal_width() refactoring]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/blkid.c')
-rw-r--r-- | misc-utils/blkid.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index c0be45746..eca35aa88 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -154,9 +154,7 @@ static void pretty_print_line(const char *device, const char *fs_type, int len, w; if (term_width < 0) { - term_width = get_terminal_width(); - if (term_width <= 0) - term_width = 80; + term_width = get_terminal_width(80); } if (term_width > 80) { term_width -= 80; @@ -192,7 +190,7 @@ static void pretty_print_dev(blkid_dev dev) if (dev == NULL) { pretty_print_line("device", "fs_type", "label", "mount point", "UUID"); - for (len=get_terminal_width()-1; len > 0; len--) + for (len=get_terminal_width(0)-1; len > 0; len--) fputc('-', stdout); fputc('\n', stdout); return; |