[hackers] [ubase] Add initial version of killall5(8) || sin

From: <git_AT_suckless.org>
Date: Thu, 06 Mar 2014 13:13:57 +0100

commit a32345028e7ff5899f39836f9424102af07fea0e
Author: sin <sin_AT_2f30.org>
Date: Thu Mar 6 11:13:47 2014 +0000

    Add initial version of killall5(8)

diff --git a/Makefile b/Makefile
index dccfe4f..c139777 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -29,6 +29,7 @@ SRC = \
         halt.c \
         id.c \
         insmod.c \
+ killall5.c \
         lsmod.c \
         lsusb.c \
         mknod.c \
diff --git a/killall5.c b/killall5.c
new file mode 100644
index 0000000..acadbf3
--- /dev/null
+++ b/killall5.c
_AT_@ -0,0 +1,78 @@
+/* See LICENSE file for copyright and license details. */
+#include <dirent.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <unistd.h>
+#include "proc.h"
+#include "util.h"
+
+struct {
+ const char *name;
+ int sig;
+} sigs[] = {
+#define SIG(n) { #n, SIG##n }
+ SIG(ABRT), SIG(ALRM), SIG(BUS), SIG(CHLD), SIG(CONT), SIG(FPE), SIG(HUP),
+ SIG(ILL), SIG(INT), SIG(KILL), SIG(PIPE), SIG(QUIT), SIG(SEGV), SIG(STOP),
+ SIG(TERM), SIG(TSTP), SIG(TTIN), SIG(TTOU), SIG(USR1), SIG(USR2), SIG(URG),
+#undef SIG
+};
+
+static void
+usage(void)
+{
+ eprintf("usage: %s [-s signal]
", argv0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ DIR *dp;
+ struct dirent *entry;
+ char *end, *v;
+ int sig = SIGTERM;
+ pid_t pid;
+ size_t i;
+
+ ARGBEGIN {
+ case 's':
+ v = EARGF(usage());
+ sig = strtol(v, &end, 0);
+ if(*end == '
Received on Thu Mar 06 2014 - 13:13:57 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 06 2014 - 13:24:16 CET