7 int system(const char *cmd)
11 struct sigaction sa, oldint, oldquit;
16 sa.sa_handler = SIG_IGN;
17 sigemptyset(&sa.sa_mask);
20 sigaction(SIGINT, &sa, &oldint);
21 sigaction(SIGQUIT, &sa, &oldquit);
22 sigaddset(&sa.sa_mask, SIGCHLD);
23 sigprocmask(SIG_BLOCK, &new, &old);
27 sigaction(SIGINT, &oldint, NULL);
28 sigaction(SIGQUIT, &oldquit, NULL);
29 sigprocmask(SIG_SETMASK, &old, NULL);
31 execl("/bin/sh", "sh", "-c", cmd, (char *)0);
36 while (waitpid(pid, &status, 0) == -1)
41 sigaction(SIGINT, &oldint, NULL);
42 sigaction(SIGQUIT, &oldquit, NULL);
43 sigprocmask(SIG_SETMASK, &old, NULL);