1*22120Smckusick #ifndef lint 2*22120Smckusick static char sccsid[] = "@(#)system.c 5.1 (Berkeley) 06/05/85"; 3*22120Smckusick #endif not lint 4*22120Smckusick 52035Swnj #include <signal.h> 62035Swnj 72035Swnj system(s) 82035Swnj char *s; 92035Swnj { 102035Swnj int status, pid, w; 112035Swnj register int (*istat)(), (*qstat)(); 122035Swnj 132035Swnj if ((pid = vfork()) == 0) { 142035Swnj execl("/bin/sh", "sh", "-c", s, 0); 152035Swnj _exit(127); 162035Swnj } 172035Swnj istat = signal(SIGINT, SIG_IGN); 182035Swnj qstat = signal(SIGQUIT, SIG_IGN); 192035Swnj while ((w = wait(&status)) != pid && w != -1) 202035Swnj ; 212035Swnj if (w == -1) 222035Swnj status = -1; 232035Swnj signal(SIGINT, istat); 242035Swnj signal(SIGQUIT, qstat); 252035Swnj return(status); 262035Swnj } 27