home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / txttools / ed.lzh / ED / SYSTEM.C < prev    next >
Text File  |  1991-08-16  |  245b  |  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.