Fixed mbfile import problem with one description lines
This commit is contained in:
parent
e2f0391f80
commit
aa2cd9c5e5
@ -50,7 +50,7 @@ void ImportFiles(int Area)
|
||||
char *pwd, *temp, *temp2, *String, *token, *dest, *unarc;
|
||||
FILE *fbbs;
|
||||
int Append = FALSE, Files = 0, i, j = 0, k = 0, x, Doit;
|
||||
int Imported = 0, Errors = 0;
|
||||
int Imported = 0, Errors = 0, Present = FALSE;
|
||||
struct FILERecord fdb;
|
||||
struct stat statfile;
|
||||
|
||||
@ -66,7 +66,7 @@ void ImportFiles(int Area)
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
temp2 = calloc(PATH_MAX, sizeof(char));
|
||||
pwd = calloc(PATH_MAX, sizeof(char));
|
||||
String = calloc(256, sizeof(char));
|
||||
String = calloc(4096, sizeof(char));
|
||||
dest = calloc(PATH_MAX, sizeof(char));
|
||||
|
||||
getcwd(pwd, PATH_MAX);
|
||||
@ -92,13 +92,13 @@ void ImportFiles(int Area)
|
||||
}
|
||||
}
|
||||
|
||||
while (fgets(String, 255, fbbs) != NULL) {
|
||||
while (fgets(String, 4095, fbbs) != NULL) {
|
||||
|
||||
if ((String[0] != ' ') && (String[0] != 't')) {
|
||||
/*
|
||||
* New file entry, check if there has been a file that is not yet saved.
|
||||
*/
|
||||
if (Append) {
|
||||
if (Append && Present) {
|
||||
Doit = TRUE;
|
||||
if ((unarc = unpacker(temp)) == NULL) {
|
||||
Syslog('+', "Unknown archive format %s", temp);
|
||||
@ -147,6 +147,7 @@ void ImportFiles(int Area)
|
||||
Errors++;
|
||||
}
|
||||
Append = FALSE;
|
||||
Present = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -157,26 +158,30 @@ void ImportFiles(int Area)
|
||||
|
||||
Files++;
|
||||
memset(&fdb, 0, sizeof(fdb));
|
||||
Present = TRUE;
|
||||
|
||||
token = strtok(String, " \t");
|
||||
strcpy(fdb.LName, token);
|
||||
strncpy(fdb.LName, token, 80);
|
||||
|
||||
/*
|
||||
* Test filename against name on disk, first normal case,
|
||||
* then lowercase and finally uppercase.
|
||||
*/
|
||||
sprintf(temp,"%s/%s", pwd, fdb.LName);
|
||||
if (stat(temp,&statfile) != 0) {
|
||||
strcpy(fdb.LName, tl(token));
|
||||
strncpy(fdb.LName, tl(token), 80);
|
||||
sprintf(temp,"%s/%s", pwd, fdb.LName);
|
||||
if (stat(temp,&statfile) != 0) {
|
||||
strcpy(fdb.LName, tu(token));
|
||||
if (stat(temp,&statfile) != 0) {
|
||||
WriteError("Cannot locate file on disk! Skipping... -> %s\n",temp);
|
||||
WriteError("Can't find file on disk, skipping: %s\n",temp);
|
||||
Append = FALSE;
|
||||
Present = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Present) {
|
||||
/*
|
||||
* Create DOS 8.3 filename
|
||||
*/
|
||||
@ -229,6 +234,8 @@ void ImportFiles(int Area)
|
||||
fdb.Desc[j][k] = token[x];
|
||||
k++;
|
||||
}
|
||||
if (j == 25)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +246,8 @@ void ImportFiles(int Area)
|
||||
fdb.Crc32 = file_crc(temp, FALSE);
|
||||
strcpy(fdb.Uploader, CFG.sysop_name);
|
||||
fdb.UploadDate = time(NULL);
|
||||
} else {
|
||||
}
|
||||
} else if (Present) {
|
||||
/*
|
||||
* Add multiple description lines
|
||||
*/
|
||||
@ -272,6 +280,8 @@ void ImportFiles(int Area)
|
||||
fdb.Desc[j][k] = token[x];
|
||||
k++;
|
||||
}
|
||||
if (j == 25)
|
||||
break;
|
||||
} else {
|
||||
/*
|
||||
* Skip until + or | is found
|
||||
@ -280,7 +290,7 @@ void ImportFiles(int Area)
|
||||
Doit = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* End if new file entry found */
|
||||
} /* End of files.bbs */
|
||||
fclose(fbbs);
|
||||
|
||||
|
@ -187,7 +187,7 @@ int LoadTic(char *inb, char *tfn)
|
||||
Temp = calloc(PATH_MAX, sizeof(char));
|
||||
Buf = calloc(257, sizeof(char));
|
||||
|
||||
while ((fgets(Buf, 256, tfp)) != NULL) {
|
||||
while ((fgets(Buf, 255, tfp)) != NULL) {
|
||||
/*
|
||||
* Remove all garbage from the .TIC file.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user