D. Allen [CGL]) (03/21/89)
/* Compile and execute this file under a C shell on Ultrix 3.0. When the child shell prompt appears, type ^Z to stop the job, then type fg to start it again. Then type ^D to exit the shell. The parent process will *die* with a SIGTSTP exit signal. If you don't stop/start the job before you exit the child shell, or if you unmask either SIGCONT or SIGCHLD, the parent process will correctly return its child status. */ #include <sys/wait.h> #include <sys/signal.h> static union wait status; static int ret; static int pid; main() { sigblock( sigmask(SIGCONT) | sigmask(SIGCHLD) ); switch( (pid=fork()) ){ case -1: perror("vfork"); exit(1); case 0: execvp("/bin/sh", 0); perror("shell"); exit(1); default: ret = wait(&status); printf("wait returns %d\n", ret); } } -- -IAN! (Ian! D. Allen) IDAllen@watcgl.UWaterloo.CA IDAllen@watcgl.Waterloo.edu Computer Graphics Lab University of Waterloo Ontario, Canada