int f=1; void test(int a) {printf("%d\n", getpid()); f=0;}; int main(int ac, char **av) { int p1, p2; struct sigaction a; a.sa_handler = test; sigaction(SIGINT, &a, NULL); if(ac == 1) { p1=fork(); if((p2=fork()) > 0) execl(av[0], av[0], "1", NULL); } while(f); return 0; }