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: mbsetup:
Added auto upgrade for the files database. Added auto upgrade for the files database.
Changed menus 14, 7.n.6, 10.1 and 8.4. Changed menus 14, 7.n.6, 10.1 and 8.4.
Changed default charset for new mailgroups and message areas
to CP437.
examples: examples:
Updated English, German, Spanish and Dutch macro files: 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 N: Add global setup in menus 9.1 and 10.1 at least to change uplink
data. data.
N: When a message area is deleted, delete the rulesfile too.
X: Generate crossreference document: X: Generate crossreference document:
File Areas <=> BBS groups File Areas <=> BBS groups
File Areas <=> Newfiles groups File Areas <=> Newfiles groups

View File

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

View File

@ -79,7 +79,7 @@ void Delete(int UnDel, int Area, char *File)
die(MBERR_GENERAL); die(MBERR_GENERAL);
temp = calloc(PATH_MAX, sizeof(char)); 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) if ((fp = fopen(temp, "r+")) == NULL)
die(MBERR_GENERAL); die(MBERR_GENERAL);

View File

@ -230,7 +230,7 @@ void Kill(void)
* we run into trouble later on. * we run into trouble later on.
*/ */
fseek(pFile, 0, SEEK_SET); 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) { if ((pTemp = fopen(sTemp, "a+")) != NULL) {
fwrite(&fdbhdr, fdbhdr.hdrsize, 1, pTemp); fwrite(&fdbhdr, fdbhdr.hdrsize, 1, pTemp);

View File

@ -443,7 +443,7 @@ int CheckFDB(int Area, char *Path)
int rc = FALSE; int rc = FALSE;
temp = calloc(PATH_MAX, sizeof(char)); 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. * 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); WriteError("$Can't create %s", temp);
rc = TRUE; rc = TRUE;
} else { } else {
fdbhdr.hdrsize = sizeof(fdbhdr);
fdbhdr.recsize = sizeof(fdb);
fwrite(&fdbhdr, sizeof(fdbhdr), 1, fp);
fclose(fp); fclose(fp);
} }
} else { } else {
fread(&fdbhdr, sizeof(fdbhdr), 1, fp);
fclose(fp); fclose(fp);
} }

View File

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

View File

@ -99,7 +99,7 @@ int CountMsgarea(void)
*/ */
memset(&msgs, 0, sizeof(msgs)); memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Bad mail"); 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.QWKname, "BADMAIL");
sprintf(msgs.Group, "LOCAL"); sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE; msgs.Active = TRUE;
@ -122,7 +122,7 @@ int CountMsgarea(void)
*/ */
memset(&msgs, 0, sizeof(msgs)); memset(&msgs, 0, sizeof(msgs));
sprintf(msgs.Name, "Dupe mail"); 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.QWKname, "DUPEMAIL");
sprintf(msgs.Group, "LOCAL"); sprintf(msgs.Group, "LOCAL");
msgs.Active = TRUE; msgs.Active = TRUE;
@ -294,7 +294,7 @@ void InitMsgRec(void)
msgs.Type = ECHOMAIL; msgs.Type = ECHOMAIL;
msgs.MsgKinds = PUBLIC; msgs.MsgKinds = PUBLIC;
msgs.UsrDelete = TRUE; msgs.UsrDelete = TRUE;
msgs.Charset = FTNC_LATIN_1; msgs.Charset = FTNC_CP437;
msgs.MaxArticles = CFG.maxarticles; msgs.MaxArticles = CFG.maxarticles;
strcpy(msgs.Origin, CFG.origin); strcpy(msgs.Origin, CFG.origin);
msgs.LinkSec.level = 1; msgs.LinkSec.level = 1;

View File

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