Mail Archives: djgpp-workers/1999/04/13/15:19:13
> 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 -