It’s A Trap!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <signal.h>
#include <unistd.h>
#include <iostream>
 
void theShieldIsUp (int param) {
  raise(SIGABRT);
}
 
void ackbar (int param) {
  std::cout << "It's A Trap!" << std::endl;
  exit(1);
}
 
int main () {
  signal(SIGTERM, theShieldIsUp);
  signal(SIGABRT, ackbar);
  while(true)
    sleep(1);
  return 0;
}

This was really funny to me earlier when I jotted it down. It’s a signal trap that calls a function that raises a process abort signal. Get it? Yeah, not as good as it was when I was working on it…

Posted May 25th, 2007 - Permalink
Categories: C - C++ - Programming
You can leave a comment, or trackback from your own site.
 
Adjacent Posts
 
Comments