#include #include #include #include #include int main(int argc, char *argv[]) { pid_t pid; int ret_value; pid=getpid(); ret_value=(int)(pid%256); srand((unsigned) pid); sleep(rand()%5); if(atoi(*(argv+1))%2) { printf("Child %d is terminating with signal 0008\n", pid); kill(pid, 8); } else { printf("Child %d is terminating with exit(%04X)\n", pid, ret_value); exit(ret_value); } }