Facebook
From Mungo Gibbon, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 267
  1. int f=1;
  2. void test(int a) {printf("%d\n", getpid()); f=0;};
  3. int main(int ac, char **av) {
  4. int p1, p2;
  5. struct sigaction a;
  6. a.sa_handler = test;
  7. sigaction(SIGINT, &a, NULL);
  8. if(ac == 1) {
  9. p1=fork();
  10. if((p2=fork()) > 0)
  11. execl(av[0], av[0], "1", NULL);
  12. }
  13. while(f);
  14. return 0;
  15. }