/* Maximus CDROM Mount : Creates FILES.BBS files and CDAREAS.CTL from indexfile on CD-ROM from Walnut Creek CD-ROM. Usage : MAX [starting area] Example : MAX G: C:\MAX\CDAREAS MAX G: C:\MAX\CDAREAS 100 */ #include #include #include #include void main(int argc, char **argv) { FILE *dosindex; FILE *areasfile; FILE *filesbbsfile = NULL; char name[255]; char indexfname[80]; char filesbbsname[80]; char dirname[80]; char areadesc[80]; char areaname[15]; char buf[512]; char tmps[512]; long totdirs = 0; char *p, *r; printf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸\n"); printf("º ³\n"); printf("º ®®® Maximus CDROM Mount ¯¯¯ ³\n"); printf("º ³\n"); printf("º Creates Files.Bbs files and Hcdareas.Ctl from indexfiles on the ³\n"); printf("º CD-ROM from Walnut Creek CD-ROM. ³\n"); printf("º ³\n"); printf("º (C) Copyright 1993 Koos van den Hout / ³\n"); printf("º Van den Hout Creative Communications ³\n"); printf("º (C) copy right 1993 Walnut Creek CDROM ³\n"); printf("º This program is Freeware. Feel free to share the executable / ³\n"); printf("º source with anyone. Read MaxHmnt.Doc for license. ³\n"); printf("º ³\n"); printf("ÓÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\n\n"); if (argc < 3) { printf("Usage :\n\n"); printf("MAX [starting area number]\n\n"); printf("Example:\n"); printf("MAX G: C:\\MAX\\CDAREAS\n"); printf("MAX G: C:\\MAX\\CDAREAS 100\n\n"); printf("Read MAXHMNT.DOC for more info.\n"); exit(1); } strupr(argv[1]); strupr(argv[2]); if (argc == 4) { if (0 == (totdirs = atoi(argv[3]))) { fprintf(stderr, "''%s'' is not a starting area number\n", argv[3]); exit(1); } --totdirs; } strcpy(indexfname, argv[1]); strcat(indexfname, "\\_bbs\\dirs.txt"); if ((dosindex = fopen(indexfname, "rt")) == NULL) { printf("Can't open index file %s\n", indexfname); exit(1); } if ((areasfile = fopen("HCDAREAS.CTL", "wt")) == NULL) { printf("Can't write area file\n"); exit(1); } fprintf(areasfile, "% Areas file of Walnut Creek CDROM.\n"); fprintf(areasfile, "% Created by Max\n\n"); while (NULL != fgets(buf, 512, dosindex)) { buf[strlen(buf) - 1] = 0; if (0 == strlen(buf)) continue; if (0 == strncmp(buf, "---", 3)) break; p = strchr(buf, ' '); r = strchr(buf, '\t'); if (r && r < p) p = r; *p = 0; strcpy(dirname, buf); if (dirname[strlen(dirname) - 1] == '\\') dirname[strlen(dirname) - 1] = '\0'; *p = ' '; while (isspace(*p)) ++p; /* p now at description */ ++totdirs; strcpy(areadesc, p); sprintf(areaname, "HC%03li", totdirs); strupr(areaname); printf("[%03li] %s%s >> %s\n", totdirs, argv[1], dirname, areadesc); strcpy(filesbbsname, argv[2]); if (filesbbsname[strlen(filesbbsname) - 1] != '\\') strcat(filesbbsname, "\\"); sprintf(tmps, "HC%03li.BBS", totdirs); strcat(filesbbsname, tmps); sprintf(buf, "copy %s%s\\files.bbs %s", argv[1], dirname, filesbbsname); fprintf(stderr, "executing ``copy %s\\files.bbs %s''\n", dirname, filesbbsname); system(buf); fprintf(areasfile, "Area %s\n", areaname); fprintf(areasfile, " Access Disgrace/S\n"); fprintf(areasfile, " FileInfo %s\n", areadesc); fprintf(areasfile, " Download %s%s\n", argv[1], dirname); fprintf(areasfile, " FileList %s\n", filesbbsname); fprintf(areasfile, "End Area\n\n"); } fclose(filesbbsfile); fclose(areasfile); fclose(dosindex); }