1: #include    <signal.h>
   2: 
   3: system(s)
   4: char *s;
   5: {
   6:     int status, pid, w;
   7:     register int (*istat)(), (*qstat)();
   8: 
   9:     if ((pid = fork()) == 0) {
  10:         execl("/bin/sh", "sh", "-c", s, 0);
  11:         _exit(127);
  12:     }
  13:     istat = signal(SIGINT, SIG_IGN);
  14:     qstat = signal(SIGQUIT, SIG_IGN);
  15:     while ((w = wait(&status)) != pid && w != -1)
  16:         ;
  17:     if (w == -1)
  18:         status = -1;
  19:     signal(SIGINT, istat);
  20:     signal(SIGQUIT, qstat);
  21:     return(status);
  22: }
Last modified: 1979-01-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 455
Valid CSS Valid XHTML 1.0 Strict