|
|
1.1 root 1: /* @(#)system.c 4.1 (Berkeley) 12/21/80 */
2: #include <signal.h>
3:
4: system(s)
5: char *s;
6: {
7: int status, pid, w;
8: register int (*istat)(), (*qstat)();
9:
10: if((pid = fork()) == 0){
11: execl("/bin/sh", "sh", "-c", s, 0);
12: _exit(127);
13: } else if(pid < 0)
14: return(pid);
15: istat = signal(SIGINT, SIG_IGN);
16: qstat = signal(SIGQUIT, SIG_IGN);
17: while((w = wait(&status)) != pid && w != -1)
18: ;
19: if (w == -1)
20: status = -1;
21: signal(SIGINT, istat);
22: signal(SIGQUIT, qstat);
23: return(status);
24: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.