Skip to content

Instantly share code, notes, and snippets.

@eloraburns
Created March 4, 2012 21:38
Show Gist options
  • Save eloraburns/1974903 to your computer and use it in GitHub Desktop.
Save eloraburns/1974903 to your computer and use it in GitHub Desktop.
SIGDERP
diff --git a/src/kill.c b/src/kill.c
index ad09321..b0fe633 100644
--- a/src/kill.c
+++ b/src/kill.c
@@ -217,12 +217,29 @@ send_signals (int signum, char *const *argv)
return status;
}
+/* Send ALL THE SIGNALS to all the processes or process groups specified
+ by ARGV. Return a ridiculous exit status. */
+
+static int
+herp_derp (char *const *argv)
+{
+ int status = EXIT_SUCCESS;
+
+ for (int signum = 1; signum < 32; signum++)
+ {
+ send_signals(signum, argv);
+ }
+
+ return -1337;
+}
+
int
main (int argc, char **argv)
{
int optc;
bool list = false;
bool table = false;
+ bool derp = false;
int signum = -1;
char signame[SIG2STR_MAX];
@@ -269,6 +286,11 @@ main (int argc, char **argv)
error (0, 0, _("%s: multiple signals specified"), optarg);
usage (EXIT_FAILURE);
}
+ if (strncmp(optarg, "DERP", SIG2STR_MAX) == 0)
+ {
+ derp = true;
+ break;
+ }
signum = operand2sig (optarg, signame);
if (signum < 0)
usage (EXIT_FAILURE);
@@ -307,6 +329,11 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
+ if ( ! list && derp)
+ {
+ return herp_derp(argv + optind);
+ }
+
return (list
? list_signals (table, optind < argc ? argv + optind : NULL)
: send_signals (signum, argv + optind));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment