home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d0xx / d084 / ed.lha / Ed / system.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-29  |  245 b   |  19 lines

  1. #define SHELL    "/bin/sh"
  2.  
  3. system(c)
  4. char *c; {
  5.     int pid, status;
  6.     
  7.     switch (pid = fork()) {
  8.     case -1:
  9.         return -1;
  10.     case 0:
  11.         execl(SHELL, "sh", "-c", c, (char *) 0);
  12.         exit(-1);
  13.     default:
  14.         while (wait(&status) != pid)
  15.             ;
  16.     }
  17.     return status;
  18. }
  19.