diff options
author | Sami Kerola | 2014-03-09 18:02:52 +0100 |
---|---|---|
committer | Sami Kerola | 2014-03-30 22:32:36 +0200 |
commit | 6e1bffa886cb72c561f8fb14399042dafd45d1f7 (patch) | |
tree | 08ba05b283db5fadd820d5d766c00bdd595c9738 /misc-utils/kill.c | |
parent | kill: flip all comparions to be in smaller - greater order (diff) | |
download | kernel-qcow2-util-linux-6e1bffa886cb72c561f8fb14399042dafd45d1f7.tar.gz kernel-qcow2-util-linux-6e1bffa886cb72c561f8fb14399042dafd45d1f7.tar.xz kernel-qcow2-util-linux-6e1bffa886cb72c561f8fb14399042dafd45d1f7.zip |
kill: move magic numbers in beginning of the file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/kill.c')
-rw-r--r-- | misc-utils/kill.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/misc-utils/kill.c b/misc-utils/kill.c index 877c24e17..b95e03d41 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -57,6 +57,11 @@ #include "ttyutils.h" #include "xalloc.h" +enum { + KILL_FIELD_WIDTH = 11, + KILL_OUTPUT_WIDTH = 72 +}; + struct signv { const char *name; int val; @@ -388,15 +393,14 @@ static void printsig(int sig) printf("%d\n", sig); } -#define FIELD_WIDTH 11 static void pretty_print_signal(FILE *fp, size_t term_width, size_t *lpos, int signum, const char *name) { - if (term_width < (*lpos + FIELD_WIDTH)) { + if (term_width < (*lpos + KILL_FIELD_WIDTH)) { fputc('\n', fp); *lpos = 0; } - *lpos += FIELD_WIDTH; + *lpos += KILL_FIELD_WIDTH; fprintf(fp, "%2d %-8s", signum, name); } @@ -407,7 +411,7 @@ static void printsignals(FILE *fp, int pretty) if (!pretty) { for (n = 0; n < ARRAY_SIZE(sys_signame); n++) { lth = 1 + strlen(sys_signame[n].name); - if (72 < lpos + lth) { + if (KILL_OUTPUT_WIDTH < lpos + lth) { fputc('\n', fp); lpos = 0; } else if (lpos) @@ -424,7 +428,7 @@ static void printsignals(FILE *fp, int pretty) /* pretty print */ width = get_terminal_width(); if (width == 0) - width = 72; + width = KILL_OUTPUT_WIDTH; else width -= 1; for (n = 0; n < ARRAY_SIZE(sys_signame); n++) |