home *** CD-ROM | disk | FTP | other *** search
- /*╓────────────────────────────────────────────────────────────────────────┐
- ║ MAX2BFE - Converts Maximus CBCS 2.x userbase into BFE format │
- ║ Copyright 1993, Cairo Research Labs, All Rights Reserved. │
- ╙────────────────────────────────────────────────────────────────────────┘*/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <mem.h>
-
- #include "msgapi.h" // From the Squish API
- #include "mstruct.h" // From the Squish API
- #include "..\structs.h" // From the BFE/DevKit
-
- // One big main()! Sloppy, but does the job!
-
- void main(int argc, char *argv[])
- {
- long sec[13];
- FILE *in, *out, *cfg;
- struct _usr olduser;
- _USER newuser;
- char buf[100];
- int x;
- long usercount=0L;
-
- printf("\n\rMAX2BFE - Converts Maximus v2.0x USER.BBS structure to BFE format\n\r");
- printf("(C)opyright 1993, Cairo Research Labs, all rights reserved\n\r\n\r");
-
- if(argc != 2) {
- printf("USAGE: max2bfe <path/filename of USER.BBS file>\n\r\n\r");
- exit(99);
- }
-
- if((in = fopen(argv[1], "rb")) == NULL) {
- printf("■ ERROR: Unable to open USER.BBS file!\n\r\n\r");
- exit(99);
- }
-
- if((out = fopen("USER.BFE", "wb")) == NULL) {
- printf("■ ERROR: Unable to create USER.BFE file!\n\r\n\r");
- exit(98);
- }
-
- if((cfg = fopen("MAX2BFE.CTL", "rt")) == NULL) {
- printf("■ ERROR: Unable to open MAX2BFE.CFG file!\n\r\n\r");
- exit(97);
- }
-
- for(x=0; x<12; x++) {
- fgets(buf, 80, cfg);
- sec[x] = atol(buf);
- }
- fclose(cfg);
-
- do {
- fread(&olduser, 1, sizeof(struct _usr), in);
- if(feof(in)) break;
-
- memset(&newuser, '\0', sizeof(_USER));
-
- printf("Converting: %s \r", olduser.name);
-
- strcpy(newuser.name, olduser.name);
- strcpy(newuser.location, olduser.city);
- strcpy(newuser.password, olduser.pwd);
- newuser.security = sec[olduser.priv];
- fwrite(&newuser, 1, sizeof(_USER), out);
-
- usercount++;
-
- } while(!feof(in));
-
- printf("\rConverted %ld users \n\r", usercount);
-
- fclose(in);
- fclose(out);
-
- }
-
-