home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / x / xhearts.zip / START_DI.C < prev    next >
C/C++ Source or Header  |  1992-01-07  |  439b  |  28 lines

  1. /*
  2.  * autostart - start up the distributor if it's not around.
  3.  */
  4.  
  5. #include "local.h"
  6. #include "defs.h"
  7. #include <string.h>
  8.  
  9. start_distributor ()
  10. {
  11.     int    pid;
  12.     char filename[1024];
  13.  
  14.     switch (pid = fork()) {
  15.     case 0:
  16.         (void) setpgrp (0, getpid());
  17.         sprintf(filename, "%s/%s", HEARTSLIB, HEARTS_DIST);
  18.         execl (filename, "hearts_dist", 0);
  19.         exit (1);
  20.     case -1:
  21.         perror ("fork");
  22.         exit (1);
  23.     default:
  24.         while (wait (0) != pid)
  25.             ;
  26.     }
  27. }
  28.