Dropped support for file areas on CDrom

This commit is contained in:
Michiel Broek
2005-08-11 21:05:15 +00:00
parent 5d5538e215
commit 0af2ea61a3
15 changed files with 158 additions and 195 deletions

View File

@@ -498,59 +498,56 @@ void CheckArea(long Area)
/*
* Check files in the directory against the database.
* This test is skipped for CD-rom.
*/
if (!area.CDrom) {
if ((dp = opendir(area.Path)) != NULL) {
while ((de = readdir(dp)) != NULL) {
if (de->d_name[0] != '.') {
Marker();
Found = FALSE;
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
if ((strcmp(fdb.LName, de->d_name) == 0) || (strcmp(fdb.Name, de->d_name) == 0)) {
if (!Found) {
Found = TRUE;
} else {
/*
* Record has been found before, so this must be
* a double record.
*/
Syslog('!', "Double file record area %ld file %s", Area, fdb.LName);
iErrors++;
fdb.Double = TRUE;
do_pack = TRUE;
if (mbsedb_LockFDB(fdb_area, 30)) {
fseek(fdb_area->fp, - fdbhdr.recsize, SEEK_CUR);
fwrite(&fdb, fdbhdr.recsize, 1, fdb_area->fp);
mbsedb_UnlockFDB(fdb_area);
}
if ((dp = opendir(area.Path)) != NULL) {
while ((de = readdir(dp)) != NULL) {
if (de->d_name[0] != '.') {
Marker();
Found = FALSE;
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
if ((strcmp(fdb.LName, de->d_name) == 0) || (strcmp(fdb.Name, de->d_name) == 0)) {
if (!Found) {
Found = TRUE;
} else {
/*
* Record has been found before, so this must be
* a double record.
*/
Syslog('!', "Double file record area %ld file %s", Area, fdb.LName);
iErrors++;
fdb.Double = TRUE;
do_pack = TRUE;
if (mbsedb_LockFDB(fdb_area, 30)) {
fseek(fdb_area->fp, - fdbhdr.recsize, SEEK_CUR);
fwrite(&fdb, fdbhdr.recsize, 1, fdb_area->fp);
mbsedb_UnlockFDB(fdb_area);
}
}
}
}
if ((!Found) && (strncmp(de->d_name, "files.bbs", 9)) &&
}
if ((!Found) && (strncmp(de->d_name, "files.bbs", 9)) &&
(strncmp(de->d_name, "files.bak", 9)) &&
(strncmp(de->d_name, "00index", 7)) &&
(strncmp(de->d_name, "header", 6)) &&
(strncmp(de->d_name, "index", 5)) &&
(strncmp(de->d_name, "readme", 6))) {
sprintf(fn, "%s/%s", area.Path, de->d_name);
if (stat(fn, &stb) == 0)
if (S_ISREG(stb.st_mode)) {
if (unlink(fn) == 0) {
Syslog('!', "%s not in fdb, deleted from disk", fn);
iErrors++;
} else {
WriteError("$%s not in fdb, cannot delete", fn);
}
sprintf(fn, "%s/%s", area.Path, de->d_name);
if (stat(fn, &stb) == 0)
if (S_ISREG(stb.st_mode)) {
if (unlink(fn) == 0) {
Syslog('!', "%s not in fdb, deleted from disk", fn);
iErrors++;
} else {
WriteError("$%s not in fdb, cannot delete", fn);
}
}
}
}
}
closedir(dp);
} else {
WriteError("Can't open %s", area.Path);
}
closedir(dp);
} else {
WriteError("Can't open %s", area.Path);
}
mbsedb_CloseFDB(fdb_area);

View File

@@ -69,12 +69,6 @@ void Delete(int UnDel, int Area, char *File)
printf("Area %d not available\n", Area);
die(MBERR_CONFIG_ERROR);
}
if (area.CDrom) {
WriteError("Can't %sdelete from CD-ROM", UnDel?"un":"");
if (!do_quiet)
printf("Can't %sdelete from CD-ROM\n", UnDel?"un":"");
die(MBERR_COMMANDLINE);
}
if ((fdb_area = mbsedb_OpenFDB(Area, 30)) == NULL)
die(MBERR_GENERAL);

View File

@@ -73,7 +73,7 @@ void ImportFiles(int Area)
if (LoadAreaRec(Area) == FALSE)
die(MBERR_INIT_ERROR);
if (area.Available && !area.CDrom) {
if (area.Available) {
temp = calloc(PATH_MAX, sizeof(char));
temp2 = calloc(PATH_MAX, sizeof(char));
pwd = calloc(PATH_MAX, sizeof(char));
@@ -446,11 +446,6 @@ void ImportFiles(int Area)
if (!do_quiet)
printf("Area not available\n");
}
if (area.CDrom) {
WriteError("Can't import on CD-ROM");
if (!do_quiet)
printf("Can't import on CD-ROM\n");
}
}
if (!do_quiet) {

View File

@@ -408,10 +408,7 @@ void ReqIndex(void)
/*
* Create files.bbs
*/
if (strlen(area.FilesBbs))
strcpy(temp, area.FilesBbs);
else
sprintf(temp, "%s/files.bbs", area.Path);
sprintf(temp, "%s/files.bbs", area.Path);
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
@@ -433,7 +430,7 @@ void ReqIndex(void)
/*
* Create 00index file.
*/
if (!area.CDrom && (strncmp(CFG.ftp_base, area.Path, strlen(CFG.ftp_base)) == 0)) {
if (strncmp(CFG.ftp_base, area.Path, strlen(CFG.ftp_base)) == 0) {
sprintf(temp, "%s/00index", area.Path);
if ((fp = fopen(temp, "w")) == NULL) {
@@ -593,7 +590,7 @@ void HtmlIndex(char *Lang)
/*
* Create index.html pages in each available download area.
*/
if (!area.CDrom && fm && (strncmp(CFG.ftp_base, area.Path, strlen(CFG.ftp_base)) == 0)) {
if (fm && (strncmp(CFG.ftp_base, area.Path, strlen(CFG.ftp_base)) == 0)) {
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
AreasHtml++;

View File

@@ -84,7 +84,7 @@ void Kill(void)
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
fread(&area, areahdr.recsize, 1, pAreas);
if ((area.Available) && (area.DLdays || area.FDdays) && (!area.CDrom)) {
if ((area.Available) && (area.DLdays || area.FDdays)) {
if (enoughspace(CFG.freespace) == 0)
die(MBERR_DISK_FULL);

View File

@@ -74,12 +74,6 @@ void Move(int From, int To, char *File)
printf("Area %d not available\n", From);
die(MBERR_COMMANDLINE);
}
if (area.CDrom) {
WriteError("Can't move from CD-ROM");
if (!do_quiet)
printf("Can't move from CD-ROM\n");
die(MBERR_COMMANDLINE);
}
if (CheckFDB(From, area.Path))
die(MBERR_GENERAL);
@@ -127,12 +121,6 @@ void Move(int From, int To, char *File)
printf("Area %d not available\n", To);
die(MBERR_GENERAL);
}
if (area.CDrom) {
WriteError("Can't move to CD-ROM");
if (!do_quiet)
printf("Can't move to CD-ROM\n");
die(MBERR_COMMANDLINE);
}
if (CheckFDB(To, area.Path))
die(MBERR_GENERAL);

View File

@@ -77,7 +77,7 @@ void PackFileBase(void)
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
fread(&area, areahdr.recsize, 1, pAreas);
if (area.Available && !area.CDrom) {
if (area.Available) {
if (enoughspace(CFG.freespace) == 0)
die(MBERR_DISK_FULL);

View File

@@ -68,12 +68,6 @@ void ReArc(int Area, char *File)
printf("Area %d not available\n", Area);
die(MBERR_CONFIG_ERROR);
}
if (area.CDrom) {
WriteError("Can't rearc on CD-ROM");
if (!do_quiet)
printf("Can't rearc on CD-ROM\n");
die(MBERR_COMMANDLINE);
}
if (strlen(area.Archiver) == 0) {
WriteError("No default archiver for area %d", Area);
if (!do_quiet)