Fixes for new filesdatabase structure

This commit is contained in:
Michiel Broek 2004-03-07 11:24:21 +00:00
parent cf922872da
commit ea5a8aa2a9
9 changed files with 22 additions and 10 deletions

View File

@ -55,6 +55,8 @@ v0.51.2 06-Mar-2004
mbsetup:
Added auto upgrade for the files database.
Changed menus 14, 7.n.6, 10.1 and 8.4.
Changed default charset for new mailgroups and message areas
to CP437.
examples:
Updated English, German, Spanish and Dutch macro files:

2
TODO
View File

@ -172,6 +172,8 @@ mbsetup:
N: Add global setup in menus 9.1 and 10.1 at least to change uplink
data.
N: When a message area is deleted, delete the rulesfile too.
X: Generate crossreference document:
File Areas <=> BBS groups
File Areas <=> Newfiles groups

View File

@ -325,15 +325,19 @@ int CheckTicGroup(char *Area, int SendUplink, faddr *f)
/*
* Create download database
*/
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), AreaNr);
sprintf(temp, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), AreaNr);
if ((fp = fopen(temp, "r+")) == NULL) {
Syslog('f', "Creating new %s", temp);
if ((fp = fopen(temp, "a+")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fdbhdr.hdrsize = sizeof(fdbhdr);
fdbhdr.recsize = sizeof(fdb);
fwrite(&fdbhdr, sizeof(fdbhdr), 1, fp);
fclose(fp);
}
} else {
fread(&fdbhdr, sizeof(fdbhdr), 1, fp);
fclose(fp);
}
chmod(temp, 0660);

View File

@ -79,7 +79,7 @@ void Delete(int UnDel, int Area, char *File)
die(MBERR_GENERAL);
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
sprintf(temp, "%s/fdb/file%d.data", getenv("MBSE_ROOT"), Area);
if ((fp = fopen(temp, "r+")) == NULL)
die(MBERR_GENERAL);

View File

@ -230,7 +230,7 @@ void Kill(void)
* we run into trouble later on.
*/
fseek(pFile, 0, SEEK_SET);
sprintf(sTemp, "%s/fdb/fdbtmp.data", getenv("MBSE_ROOT"));
sprintf(sTemp, "%s/fdb/filetmp.data", getenv("MBSE_ROOT"));
if ((pTemp = fopen(sTemp, "a+")) != NULL) {
fwrite(&fdbhdr, fdbhdr.hdrsize, 1, pTemp);

View File

@ -443,7 +443,7 @@ int CheckFDB(int Area, char *Path)
int rc = FALSE;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
sprintf(temp, "%s/fdb/file%d.data", getenv("MBSE_ROOT"), Area);
/*
* Open the file database, create new one if it doesn't excist.
@ -454,9 +454,13 @@ int CheckFDB(int Area, char *Path)
WriteError("$Can't create %s", temp);
rc = TRUE;
} else {
fdbhdr.hdrsize = sizeof(fdbhdr);
fdbhdr.recsize = sizeof(fdb);
fwrite(&fdbhdr, sizeof(fdbhdr), 1, fp);
fclose(fp);
}
} else {
fread(&fdbhdr, sizeof(fdbhdr), 1, fp);
fclose(fp);
}

View File

@ -580,8 +580,8 @@ void EditFilearea(void)
offset = areahdr.hdrsize + ((from - 1) * areahdr.recsize);
fseek(fil, offset, 0);
fwrite(&area, areahdr.recsize, 1, fil);
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), from);
sprintf(new, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), too);
sprintf(temp, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), from);
sprintf(new, "%s/fdb/file%ld.data", getenv("MBSE_ROOT"), too);
rename(temp, new);
/*

View File

@ -99,7 +99,7 @@ int CountMsgarea(void)
*/
memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Bad mail");
sprintf(msgs.Base, "/opt/mbse/var/mail/badmail");
sprintf(msgs.Base, "%s/var/mail/badmail", getenv("MBSE_ROOT"));
sprintf(msgs.QWKname, "BADMAIL");
sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE;
@ -122,7 +122,7 @@ int CountMsgarea(void)
*/
memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Dupe mail");
sprintf(msgs.Base, "/opt/mbse/var/mail/dupemail");
sprintf(msgs.Base, "%s/var/mail/dupemail", getenv("MBSE_ROOT"));
sprintf(msgs.QWKname, "DUPEMAIL");
sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE;
@ -294,7 +294,7 @@ void InitMsgRec(void)
msgs.Type = ECHOMAIL;
msgs.MsgKinds = PUBLIC;
msgs.UsrDelete = TRUE;
msgs.Charset = FTNC_LATIN_1;
msgs.Charset = FTNC_CP437;
msgs.MaxArticles = CFG.maxarticles;
strcpy(msgs.Origin, CFG.origin);
msgs.LinkSec.level = 1;

View File

@ -230,7 +230,7 @@ int AppendMGroup(void)
mgroup.StartDate = time(NULL);
mgroup.LinkSec.level = 1;
mgroup.LinkSec.flags = 1;
mgroup.Charset = FTNC_LATIN_1;
mgroup.Charset = FTNC_CP437;
fwrite(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
MGrpUpdated = 1;