diff options
| author | Boris Egorov <egorov@linux.com> | 2016-01-05 22:17:58 +0600 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2016-01-06 12:22:07 +0100 |
| commit | 43b4f7ea5f96f861787c30fdd6933daf472fcc02 (patch) | |
| tree | ae4b3fab8219c501b5216fbfcca394cf74b1c406 /misc-utils/kill.c | |
| parent | 7054d8a6c76b05d3c68e583034a73163dc1f86dd (diff) | |
| download | util-linux-43b4f7ea5f96f861787c30fdd6933daf472fcc02.tar.gz | |
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/kill.c')
| -rw-r--r-- | misc-utils/kill.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/misc-utils/kill.c b/misc-utils/kill.c index 01730dbc53..92b2ae9cb3 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -218,11 +218,7 @@ static void print_all_signals(FILE *fp, int pretty) } /* pretty print */ - width = get_terminal_width(); - if (width == 0) - width = KILL_OUTPUT_WIDTH; - else - width -= 1; + width = get_terminal_width(KILL_OUTPUT_WIDTH + 1) - 1; for (n = 0; n < ARRAY_SIZE(sys_signame); n++) pretty_print_signal(fp, width, &lpos, sys_signame[n].val, sys_signame[n].name); |
