aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/kill.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-08-26 14:16:49 -0500
committerRob Landley <rob@landley.net>2018-08-26 14:16:49 -0500
commit009b55edc4bad5b46ace88f3c255bbff8671d137 (patch)
treef4f856ef871104e37a5d123aa3ec3d01246c9e10 /toys/posix/kill.c
parent1aaef2d2b72800a5c6bedae04941304ce8e153be (diff)
downloadtoybox-009b55edc4bad5b46ace88f3c255bbff8671d137.tar.gz
Convert more commands to the new option/GLOBALS code style.
Diffstat (limited to 'toys/posix/kill.c')
-rw-r--r--toys/posix/kill.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/toys/posix/kill.c b/toys/posix/kill.c
index 3fcd36a1..3ea86e09 100644
--- a/toys/posix/kill.c
+++ b/toys/posix/kill.c
@@ -44,8 +44,8 @@ config KILLALL5
#include "toys.h"
GLOBALS(
- char *signame;
- struct arg_list *olist;
+ char *s;
+ struct arg_list *o;
)
// But kill's flags are a subset of killall5's
@@ -74,12 +74,12 @@ void kill_main(void)
// signal must come before pids, so "kill -9 -1" isn't confusing.
- if (!TT.signame && *args && **args=='-') TT.signame=*(args++)+1;
- if (TT.signame) {
+ if (!TT.s && *args && **args=='-') TT.s = *(args++)+1;
+ if (TT.s) {
char *arg;
- int i = strtol(TT.signame, &arg, 10);
+ int i = strtol(TT.s, &arg, 10);
if (!*arg) arg = num_to_sig(i);
- else arg = TT.signame;
+ else arg = TT.s;
if (!arg || -1 == (signum = sig_to_num(arg)))
error_exit("Unknown signal '%s'", arg);
@@ -96,11 +96,10 @@ void kill_main(void)
if (toys.optflags & FLAG_o) {
struct arg_list *ptr;
- for (ptr = TT.olist; ptr; ptr = ptr->next) ocount++;
+ for (ptr = TT.o; ptr; ptr = ptr->next) ocount++;
olist = xmalloc(ocount*sizeof(long));
ocount = 0;
- for (ptr = TT.olist; ptr; ptr=ptr->next)
- olist[ocount++] = atolx(ptr->arg);
+ for (ptr = TT.o; ptr; ptr=ptr->next) olist[ocount++] = atolx(ptr->arg);
}
sid = getsid(pid = getpid());