]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
kill: move magic numbers in beginning of the file
authorSami Kerola <kerolasa@iki.fi>
Sun, 9 Mar 2014 17:02:52 +0000 (12:02 -0500)
committerSami Kerola <kerolasa@iki.fi>
Sun, 30 Mar 2014 20:32:36 +0000 (21:32 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/kill.c

index 877c24e17d2435066353ce7848bcbf5c41f794d9..b95e03d4165e84de1df8b18fe0a0fa86827ae5d7 100644 (file)
 #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++)