xref: /csrg-svn/games/trek/shell.c (revision 21295)
1*21295Sdist /*
2*21295Sdist  * Copyright (c) 1980 Regents of the University of California.
3*21295Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21295Sdist  * specifies the terms and conditions for redistribution.
5*21295Sdist  */
6*21295Sdist 
711696Smckusick #ifndef lint
8*21295Sdist static char sccsid[] = "@(#)shell.c	5.1 (Berkeley) 05/30/85";
911696Smckusick #endif not lint
1011696Smckusick 
1111696Smckusick /*
1211696Smckusick **  CALL THE SHELL
1311696Smckusick */
1411696Smckusick 
1511696Smckusick shell()
1611696Smckusick {
1711696Smckusick 	int		i;
1811696Smckusick 	register int	pid;
1911696Smckusick 	register int	sav2, sav3;
2011696Smckusick 
2111696Smckusick 	if (!(pid = fork()))
2211696Smckusick 	{
2311696Smckusick 		setuid(getuid());
2411696Smckusick 		nice(0);
2512345Slayer 		execl("/bin/csh", "-", 0);
2612345Slayer 		syserr("cannot execute /bin/csh");
2711696Smckusick 	}
2811696Smckusick 	sav2 = signal(2, 1);
2911696Smckusick 	sav3 = signal(3, 1);
3011696Smckusick 	while (wait(&i) != pid) ;
3111696Smckusick 	signal(2, sav2);
3211696Smckusick 	signal(3, sav3);
3311696Smckusick }
34