date and time created 83/03/23 15:01:28 by mckusick
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 24 Mar 1983 07:01:28 +0000 (23:01 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 24 Mar 1983 07:01:28 +0000 (23:01 -0800)
SCCS-vsn: games/trek/shell.c 4.1

usr/src/games/trek/shell.c [new file with mode: 0644]

diff --git a/usr/src/games/trek/shell.c b/usr/src/games/trek/shell.c
new file mode 100644 (file)
index 0000000..8bb17e9
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef lint
+static char sccsid[] = "@(#)shell.c    4.1     (Berkeley)      %G%";
+#endif not lint
+
+/*
+**  CALL THE SHELL
+*/
+
+shell()
+{
+       int             i;
+       register int    pid;
+       register int    sav2, sav3;
+
+       if (!(pid = fork()))
+       {
+               setuid(getuid());
+               nice(0);
+               execl("/bin/sh", "-", 0);
+               syserr("cannot execute /bin/sh");
+       }
+       sav2 = signal(2, 1);
+       sav3 = signal(3, 1);
+       while (wait(&i) != pid) ;
+       signal(2, sav2);
+       signal(3, sav3);
+}