From a59df51f711a67d6631d03ffb34a2f1cee6f12ce Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Mon, 22 Dec 1980 00:51:01 -0800 Subject: [PATCH] date and time created 80/12/21 16:51:01 by wnj SCCS-vsn: lib/libc/stdlib/system.c 4.1 --- usr/src/lib/libc/stdlib/system.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 usr/src/lib/libc/stdlib/system.c diff --git a/usr/src/lib/libc/stdlib/system.c b/usr/src/lib/libc/stdlib/system.c new file mode 100644 index 0000000000..1000f0c28a --- /dev/null +++ b/usr/src/lib/libc/stdlib/system.c @@ -0,0 +1,23 @@ +/* @(#)system.c 4.1 (Berkeley) %G% */ +#include + +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); +} -- 2.20.1