#include     <dos.h>
#include   <stdio.h>
#include <process.h>

extern unsigned _heaplen = 512;
extern unsigned _stklen  = 128;

void main(void)
  {
  int    check = 0;
  int    batok, retok;
  struct find_t ffblk;

  batok = _dos_findfirst("{rdm}.bat", _A_NORMAL, &ffblk);

  if(batok == 0)
    {
    check = system("{rdm}.bat");

    if (check == -1)
	 {
	 perror("Error from system spawn");
	 exit(1);
	 }
    }
  else
    {
    printf("\nNothing to do.  Run RDM.EXE.\n");
    exit(0);
    }

  retok = _dos_findfirst("rdm.exe", _A_NORMAL, &ffblk);

  if(retok == 0)
    {
    check = execl("rdm.exe", NULL);

    if (check == -1)
	 {
	 perror("Error from system execl");
	 exit(1);
	 }
    }
  else
    {
    printf("\nCan't find RDM.EXE to return.\n");
    exit(0);
    }
  return;
  }

