1 #ifndef lint 2 static char sccsid[] = "@(#)system.c 5.1 (Berkeley) 06/05/85"; 3 #endif not lint 4 5 #include <signal.h> 6 7 system(s) 8 char *s; 9 { 10 int status, pid, w; 11 register int (*istat)(), (*qstat)(); 12 13 if ((pid = vfork()) == 0) { 14 execl("/bin/sh", "sh", "-c", s, 0); 15 _exit(127); 16 } 17 istat = signal(SIGINT, SIG_IGN); 18 qstat = signal(SIGQUIT, SIG_IGN); 19 while ((w = wait(&status)) != pid && w != -1) 20 ; 21 if (w == -1) 22 status = -1; 23 signal(SIGINT, istat); 24 signal(SIGQUIT, qstat); 25 return(status); 26 } 27