BSD 3 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Thu, 27 Sep 1979 12:24:35 +0000 (04:24 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Thu, 27 Sep 1979 12:24:35 +0000 (04:24 -0800)
Work on file usr/src/libc/stdio/system.c

Synthesized-from: 3bsd

usr/src/libc/stdio/system.c [new file with mode: 0644]

diff --git a/usr/src/libc/stdio/system.c b/usr/src/libc/stdio/system.c
new file mode 100644 (file)
index 0000000..c8ed4ca
--- /dev/null
@@ -0,0 +1,22 @@
+#include       <signal.h>
+
+system(s)
+char *s;
+{
+       int status, pid, w;
+       register int (*istat)(), (*qstat)();
+
+       if ((pid = vfork()) == 0) {
+               execl("/bin/sh", "sh", "-c", s, 0);
+               _exit(127);
+       }
+       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);
+}