1: /*	@(#)system.c	2.2	SCCS id keyword	*/
   2: #include    <whoami.h>
   3: #include    <signal.h>
   4: 
   5: #ifdef UCB_SHELL
   6: char    *getenv();
   7: #endif
   8: 
   9: system(s)
  10: char *s;
  11: {
  12:     int status, pid, w;
  13:     register int (*istat)(), (*qstat)();
  14: 
  15: #ifdef  VIRUS_VFORK
  16:     if ((pid = vfork()) == 0) {
  17: #else
  18:     if ((pid = fork()) == 0) {
  19: #endif
  20: #ifdef UCB_SHELL
  21:         char    *shell;
  22:         if (!(shell == getenv("SHELL")))
  23:             shell = UCB_SHELL;
  24:         execl(shell, shell, "-c", s, 0);
  25: #else
  26:         execl("/bin/sh", "sh", "-c", s, 0);
  27: #endif
  28:         _exit(127);
  29:     }
  30:     istat = signal(SIGINT, SIG_IGN);
  31:     qstat = signal(SIGQUIT, SIG_IGN);
  32:     while ((w = wait(&status)) != pid && w != -1)
  33:         ;
  34:     if (w == -1)
  35:         status = -1;
  36:     signal(SIGINT, istat);
  37:     signal(SIGQUIT, qstat);
  38:     return(status);
  39: }
Last modified: 1983-02-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 705
Valid CSS Valid XHTML 1.0 Strict