diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-27 14:19:16 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-27 14:19:16 +0000 |
commit | a77947f5bb9ef38b0f1fc6a2a5b500fa6ade601e (patch) | |
tree | 3ad369f8468a397c6731ccd5c1631e1bc33612d6 /libbb | |
parent | be905d550c96da8c75d697842ba4169a62d05190 (diff) |
kill: fix bugs (kill -l output was horrible), fix style, constify data
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/u_signal_names.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c index b9afc6ff1..3f8c04c35 100644 --- a/libbb/u_signal_names.c +++ b/libbb/u_signal_names.c @@ -9,8 +9,8 @@ #include "libbb.h" -static struct signal_name { - char *name; +static const struct signal_name { + char name[5]; int number; } signals[] = { // SUSv3 says kill must support these, and specifies the numerical values, @@ -26,7 +26,7 @@ static struct signal_name { // Convert signal name to number. -int get_signum(char *name) +int get_signum(const char *name) { int i; @@ -42,18 +42,17 @@ int get_signum(char *name) // Convert signal number to name -char *get_signame(int number) +const char *get_signame(int number) { int i; static char buf[8]; - itoa_to_buf(number, buf, 8); for (i=0; i < sizeof(signals) / sizeof(struct signal_name); i++) { if (number == signals[i].number) { - sprintf("SIG%s", signals[i].name); - break; + return signals[i].name; } } + itoa_to_buf(number, buf, 8); return buf; } |