home *** CD-ROM | disk | FTP | other *** search
/ Doom Magazine 1 / Doom_magazine_01.bin / utils / rundoom / runner.cpp < prev    next >
C/C++ Source or Header  |  1994-03-16  |  843b  |  52 lines

  1. #include     <dos.h>
  2. #include   <stdio.h>
  3. #include <process.h>
  4.  
  5. extern unsigned _heaplen = 512;
  6. extern unsigned _stklen  = 128;
  7.  
  8. void main(void)
  9.   {
  10.   int    check = 0;
  11.   int    batok, retok;
  12.   struct find_t ffblk;
  13.  
  14.   batok = _dos_findfirst("{rdm}.bat", _A_NORMAL, &ffblk);
  15.  
  16.   if(batok == 0)
  17.     {
  18.     check = system("{rdm}.bat");
  19.  
  20.     if (check == -1)
  21.      {
  22.      perror("Error from system spawn");
  23.      exit(1);
  24.      }
  25.     }
  26.   else
  27.     {
  28.     printf("\nNothing to do.  Run RDM.EXE.\n");
  29.     exit(0);
  30.     }
  31.  
  32.   retok = _dos_findfirst("rdm.exe", _A_NORMAL, &ffblk);
  33.  
  34.   if(retok == 0)
  35.     {
  36.     check = execl("rdm.exe", NULL);
  37.  
  38.     if (check == -1)
  39.      {
  40.      perror("Error from system execl");
  41.      exit(1);
  42.      }
  43.     }
  44.   else
  45.     {
  46.     printf("\nCan't find RDM.EXE to return.\n");
  47.     exit(0);
  48.     }
  49.   return;
  50.   }
  51.  
  52.