delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/13/15:19:13

Date: Tue, 13 Apr 1999 15:19:08 -0400
Message-Id: <199904131919.PAA01578@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: Kbwms AT aol DOT com
CC: djgpp-workers AT delorie DOT com
In-reply-to: <673c7a04.2444f117@aol.com> (Kbwms@aol.com)
Subject: Re: LBInstDJ
References: <673c7a04 DOT 2444f117 AT aol DOT com>
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> That sounds exciting.  Why don't you post your program for all to
> admire?

Well, if you're that curious...

#include <stdio.h>
#include <string.h>
main(int argc, char **argv)
{
  int i;
  FILE *f = fopen("c:/boot.tmp", "w");
  if (f == 0)
  {
    perror("c:/boot.tmp");
    exit(1);
  }
  fprintf(f, "-P\n");
  for (i=1; argv[i]; i++)
  {
    strupr(argv[i]);
    fprintf(f, "-D%s\n", argv[i]);
  }
  fclose(f);
  system("cpp -Ic:/etc/rc @c:/boot.tmp c:/etc/rc/config.sys c:/config.sys");
  system("cpp -Ic:/etc/rc @c:/boot.tmp c:/etc/rc/autoexec.bat c:/autoexec.bat");
  f = fopen("c:/autoexec.bat", "a");
  fprintf(f, "echo Configuration: ");
  for (i=1; argv[i]; i++)
    fprintf(f, "%s ", argv[i]);
  fprintf(f, "\n");
  fclose(f);
  remove("c:/boot.tmp");
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019