[PATCH 04/10] kill: move magic numbers in beginning of the file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 misc-utils/kill.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/misc-utils/kill.c b/misc-utils/kill.c
index 877c24e..b95e03d 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++)
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux