dup(tty);
close(1);
dup(tty);
close(2);
dup(tty);
close(tty);
execlp("sh", "sh", "-c", s, (char*)0);
exit(127);
}
close(tty);
istat = signal(SIGINT, SIG_IGN);
qstat = signal(SIGQUIT, SIG_IGN);
while ((w = wait(&status)) != pid && w != -1)
;
if (w == -1)
status = -1;
signal(SIGINT, istat);
signal(SIGQUIT, qstat);
return status;
}
3.8.54 timeout.c
/* timeout: set time limit on a process */
#include <stdio.h>
#include <signal.h>
int pid; /* child process id */
char *progname;
main(argc, argv)
int argc;
char *argv[];
{