Signal scanout after nodes edit

This commit is contained in:
Michiel Broek 2002-07-13 15:10:00 +00:00
parent e9562655ae
commit 55ed2dd121
2 changed files with 257 additions and 238 deletions

View File

@ -37,6 +37,7 @@ v0.35.03 06-Jul-2002
mbsetup:
Enabled setting of nodelist override settings in menu 7.x.3
After nodes setup edit the semafore scanout is set.
script:
The bbsdoor.sh and rundoor.sh scripts are now only installed

View File

@ -98,14 +98,15 @@ int CountNoderec(void)
int OpenNoderec(void)
{
FILE *fin, *fout;
char fnin[PATH_MAX], fnout[PATH_MAX];
char group[13];
long oldsize;
char *fnin, *fnout, group[13];
int i, old_fgroups, old_mgroups;
long oldfilegrp, oldmailgrp;
long oldsize, oldfilegrp, oldmailgrp;
fnin = calloc(PATH_MAX, sizeof(char));
fnout = calloc(PATH_MAX, sizeof(char));
sprintf(fnin, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
sprintf(fnout, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
if ((fin = fopen(fnin, "r")) != NULL) {
if ((fout = fopen(fnout, "w")) != NULL) {
NodeUpdated = 0;
@ -128,9 +129,7 @@ int OpenNoderec(void)
oldmailgrp = nodeshdr.mailgrp;
old_fgroups = oldfilegrp / 13;
old_mgroups = oldmailgrp / 13;
if ((oldsize != sizeof(nodes) ||
(CFG.tic_groups != old_fgroups) ||
(CFG.toss_groups != old_mgroups))) {
if ((oldsize != sizeof(nodes) || (CFG.tic_groups != old_fgroups) || (CFG.toss_groups != old_mgroups))) {
NodeUpdated = 1;
if (oldsize != sizeof(nodes))
Syslog('+', "Upgraded %s, format changed", fnin);
@ -146,9 +145,8 @@ int OpenNoderec(void)
fwrite(&nodeshdr, sizeof(nodeshdr), 1, fout);
/*
* The datarecord is filled with zero's before each
* read, so if the format changed, the new fields
* will be empty.
* The datarecord is filled with zero's before each read,
* so if the format changed, the new fields will be empty.
*/
memset(&nodes, 0, sizeof(nodes));
while (fread(&nodes, oldsize, 1, fin) == 1) {
@ -168,8 +166,7 @@ int OpenNoderec(void)
}
if (old_fgroups < CFG.tic_groups) {
/*
* The size increased, fill with
* blank records
* The size increased, fill with blank records
*/
memset(&group, 0, 13);
for (i = (old_fgroups + 1); i <= CFG.tic_groups; i++)
@ -192,10 +189,15 @@ int OpenNoderec(void)
fclose(fin);
fclose(fout);
free(fnin);
free(fnout);
return 0;
} else
return -1;
}
free(fnin);
free(fnout);
return -1;
}
@ -203,13 +205,14 @@ int OpenNoderec(void)
void CloseNoderec(int Force)
{
char fin[PATH_MAX], fout[PATH_MAX];
char *fin, *fout, group[13];
FILE *fi, *fo;
int i;
char group[13];
st_list *nod = NULL, *tmp;
unsigned long crc1, crc2;
fin = calloc(PATH_MAX, sizeof(char));
fout = calloc(PATH_MAX, sizeof(char));
sprintf(fin, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
sprintf(fout,"%s/etc/nodes.temp", getenv("MBSE_ROOT"));
@ -251,12 +254,18 @@ void CloseNoderec(int Force)
fclose(fo);
unlink(fout);
chmod(fin, 0640);
free(fin);
free(fout);
Syslog('+', "Updated \"nodes.data\"");
CreateSema((char *)"scanout");
return;
}
}
chmod(fin, 0640);
working(1, 0, 0);
free(fin);
free(fout);
unlink(fout);
}
@ -266,11 +275,12 @@ int AppendNoderec(void);
int AppendNoderec(void)
{
FILE *fil;
char ffile[PATH_MAX];
char group[13];
char *ffile, group[13];
int i;
ffile = calloc(PATH_MAX, sizeof(char));
sprintf(ffile, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) {
memset(&nodes, 0, sizeof(nodes));
/*
@ -291,8 +301,11 @@ int AppendNoderec(void)
fwrite(&group, 13, 1, fil);
fclose(fil);
NodeUpdated = 1;
free(ffile);
return 0;
} else
}
free(ffile);
return -1;
}
@ -300,13 +313,17 @@ int AppendNoderec(void)
int GroupInNode(char *Group, int Mail)
{
char temp[PATH_MAX], group[13];
char *temp, group[13];
FILE *no;
int i, groups, RetVal = 0;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((no = fopen(temp, "r")) == NULL)
if ((no = fopen(temp, "r")) == NULL) {
free(temp);
return 0;
}
free(temp);
fread(&nodeshdr, sizeof(nodeshdr), 1, no);
fseek(no, 0, SEEK_SET);
@ -354,6 +371,7 @@ int CheckAka(fidoaddr A)
errmsg((char *)"Error aka connected to %d message and/or %d tic areas", mcnt, tcnt);
return TRUE;
}
return FALSE;
}