home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
-
- int main(int argn, char **argc) {
-
- FILE *fp;
- char *buf, *temp;
- int index, len[104];
-
- if (argn < 2) {
-
- fp = fopen("data\\strdat.war", "rb");
-
- if(!fp) {
- printf("Error opening data\\strdat.war\n");
- return(0);
- }
-
- buf = (char *)malloc(0x04e1);
-
- fseek(fp, 0x05e4, 0);
- fread(buf, 0x04e1, 1, fp);
-
- temp = buf;
- index = 0;
-
- while(index++ < 104) {
- printf("%s\n", temp);
- while(*temp) temp++;
- temp++;
- }
- }
-
- else {
-
- fp = fopen(argc[1], "rt");
-
- if(!fp) {
- printf("Error opening %s\n", argc[1]);
- return(0);
- }
-
- fseek(fp, 0, 2);
- if (ftell(fp) > 0x0549) {
- printf("Names too long in %s\n", argc[1]);
- return(0);
- }
- fseek(fp, 0, 0);
-
- buf = (char *)malloc(0x04e1);
- temp = buf;
-
- index = 0;
- while(index < 104) {
-
- if(feof(fp)) {
- printf("Not enough names in %s\n", argc[1]);
- free(buf);
- return(0);
- }
-
- if(index) len[index] = len[index-1];
- else len[index] = 0x03c1;
-
- fgets(temp, 80, fp);
- while(*temp != '\n') {
- temp++;
- len[index]++;
- }
- *temp++ = 0;
- len[index++]++;
- }
-
- fclose(fp);
- fp = fopen("data\\strdat.war", "r+b");
-
- if(!fp) {
- printf("Error opening data\\strdat.war\n");
- return(0);
- }
-
- fseek(fp, 0x0229, 0);
- fwrite(len, 206, 1, fp);
-
- fseek(fp, 0x05e4, 0);
- fwrite(buf, 0x04e1, 1, fp);
- fclose(fp);
- }
-
- return(1);
- }
-