Several mbsetup protections and checks added

This commit is contained in:
Michiel Broek 2003-01-31 21:49:29 +00:00
parent d95fc43626
commit 08542985ff
8 changed files with 606 additions and 526 deletions

View File

@ -92,7 +92,7 @@ m_tty.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/use
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h
m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_fgroup.h m_mgroup.h m_global.h
m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h

View File

@ -501,102 +501,105 @@ int EditFGrpRec(int Area)
void EditFGroup(void)
{
int records, i, o, x, y;
char pick[12];
FILE *fil;
char temp[PATH_MAX];
long offset;
int records, i, o, x, y;
char pick[12], temp[PATH_MAX];
FILE *fil;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountFGroup();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenFGroup() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountFGroup();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenFGroup() == -1) {
working(2, 0, 0);
return;
set_color(WHITE, BLACK);
mvprintw( 5, 4, "10.1 FILE GROUPS SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/fgroups.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&fgrouphdr, sizeof(fgrouphdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11 ) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(fgrouphdr) + (((o + i) - 1) * fgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&fgroup, fgrouphdr.recsize, 1, fil);
if (fgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, fgroup.Name, fgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 4, "10.1 FILE GROUPS SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/fgroups.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&fgrouphdr, sizeof(fgrouphdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11 ) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(fgrouphdr) + (((o + i) - 1) * fgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&fgroup, fgrouphdr.recsize, 1, fil);
if (fgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, fgroup.Name, fgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseFGroup(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendFGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditFGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
if (strncmp(pick, "-", 1) == 0) {
CloseFGroup(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
if (records < CFG.tic_groups) {
working(1, 0, 0);
if (AppendFGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add group, change global setting in menu 1.13.5");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o += 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o -= 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditFGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
}

View File

@ -44,6 +44,8 @@
#include "m_marea.h"
#include "m_ticarea.h"
#include "m_new.h"
#include "m_fgroup.h"
#include "m_mgroup.h"
#include "m_global.h"
@ -822,6 +824,8 @@ void e_flags(int Users)
void e_ticconf(void)
{
int temp;
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.13 EDIT FILEECHO PROCESSING");
@ -870,17 +874,29 @@ void e_ticconf(void)
case 1: E_INT( 7,18, CFG.tic_days, "Number of days to ^keep^ files on hold.")
case 2: E_STR( 8,18,20, CFG.hatchpasswd, "Enter the internal ^hatch^ password.")
case 3: E_INT( 9,18, CFG.drspace, "Enter the minimal ^free drivespace^ in KBytes.")
case 4: CFG.tic_systems = edit_int(10,18, CFG.tic_systems,
(char *)"Enter the maximum number of ^connected systems^ in the database.");
if ((OpenTicarea() == 0))
CloseTicarea(TRUE);
working(0, 0, 0);
case 4: temp = CFG.tic_systems;
temp = edit_int(10,18, temp, (char *)"Enter the maximum number of ^connected systems^ in the database.");
if (temp < CountNoderec()) {
errmsg("You have %d nodes defined", CountNoderec());
show_int(10,18, CFG.tic_systems);
} else {
CFG.tic_systems = temp;
if ((OpenTicarea() == 0))
CloseTicarea(TRUE);
working(0, 0, 0);
}
break;
case 5: CFG.tic_groups = edit_int(11,18, CFG.tic_groups,
(char *)"Enter the maximum number of ^fileecho groups^ in the database.");
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
case 5: temp = CFG.tic_groups;
temp = edit_int(11,18, temp, (char *)"Enter the maximum number of ^fileecho groups^ in the database.");
if (temp < CountFGroup()) {
errmsg("You have %d groups defined", CountFGroup());
show_int(11,18, CFG.tic_groups);
} else {
CFG.tic_groups = temp;
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
}
break;
case 6: E_INT( 12,18, CFG.tic_dupes, "Enter the maximum number of ^dupes^ in the dupe database.")
@ -954,6 +970,8 @@ void s_fidomailcfg(void)
void e_fidomailcfg(void)
{
int temp;
s_fidomailcfg();
for (;;) {
switch(select_menu(19)) {
@ -968,17 +986,29 @@ void e_fidomailcfg(void)
case 8: E_INT( 14,16, CFG.toss_old, "^Reject^ mail older then days, 0 means never reject.")
case 9: E_INT( 15,16, CFG.defmsgs, "The default maximum number of ^messages^ in each mail area.")
case 10:E_INT( 16,16, CFG.defdays, "The default maximum ^age in days^ in each mail area.")
case 11:CFG.toss_systems = edit_int(17,16, CFG.toss_systems,
(char *)"The maximum number of connected ^systems^ in the database.");
if ((OpenMsgarea() == 0))
CloseMsgarea(TRUE);
working(0, 0, 0);
case 11:temp = CFG.toss_systems;
temp = edit_int(17,16, temp, (char *)"The maximum number of connected ^systems^ in the database.");
if (temp < CountNoderec()) {
errmsg("You have %d nodes defined", CountNoderec());
show_int( 17,16, CFG.toss_systems);
} else {
CFG.toss_systems = temp;
if ((OpenMsgarea() == 0))
CloseMsgarea(TRUE);
working(0, 0, 0);
}
break;
case 12:CFG.toss_groups = edit_int(18,16, CFG.toss_groups,
(char *)"The maximum number of ^groups^ in the database.");
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
case 12:temp = CFG.toss_groups;
temp = edit_int(18,16, temp, (char *)"The maximum number of ^groups^ in the database.");
if (temp < CountMGroup()) {
errmsg("You have %d groups defined", CountMGroup());
show_int( 18,16, CFG.toss_groups);
} else {
CFG.toss_groups = temp;
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
}
break;
case 13:E_BOOL(12,58, CFG.addr4d, "Use ^4d^ addressing instead of ^5d^ addressing.")
case 14:E_INT( 13,58, CFG.new_split, "Gently ^split^ newfiles reports after n kilobytes (12..60).")
@ -1162,25 +1192,33 @@ void s_newfiles(void)
void e_newfiles(void)
{
s_newfiles();
for (;;) {
set_color(WHITE, BLACK);
show_int( 7,16, CFG.newdays);
show_sec( 8,16, CFG.security);
show_int( 9,16, CFG.new_groups);
int temp;
s_newfiles();
for (;;) {
set_color(WHITE, BLACK);
show_int( 7,16, CFG.newdays);
show_sec( 8,16, CFG.security);
show_int( 9,16, CFG.new_groups);
switch(select_menu(3)) {
case 0: return;
case 1: E_INT(7,16, CFG.newdays, "Add files younger than this in newfiles report.")
case 2: E_SEC(8,16, CFG.security, "1.14 NEWFILES REPORTS SECURITY", s_newfiles)
case 3: CFG.new_groups = edit_int( 9, 16, CFG.new_groups,
(char *)"The maximum of ^newfiles^ groups in the newfiles database");
switch(select_menu(3)) {
case 0: return;
case 1: E_INT(7,16, CFG.newdays, "Add files younger than this in newfiles report.")
case 2: E_SEC(8,16, CFG.security, "1.16 NEWFILES REPORTS SECURITY", s_newfiles)
case 3: temp = CFG.new_groups;
temp = edit_int( 9, 16, temp, (char *)"The maximum of ^newfiles^ groups in the newfiles database");
if (temp < CountNewfiles()) {
errmsg("You have %d newfiles reports defined", CountNewfiles());
show_int( 9,16, CFG.new_groups);
} else {
CFG.new_groups = temp;
if (OpenNewfiles() == 0)
CloseNewfiles(TRUE);
working(0, 0, 0);
break;
}
};
}
break;
}
}
}

View File

@ -1334,135 +1334,159 @@ int EditMsgRec(int Area)
void EditMsgarea(void)
{
int records, i, o, y;
char pick[12];
FILE *fil;
char temp[PATH_MAX];
long offset;
int from, too;
sysconnect System;
int records, rc, i, o, y, from, too;
char pick[12], temp[PATH_MAX];
FILE *fil;
long offset;
sysconnect System;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountMsgarea();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenMsgarea() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountMsgarea();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenMsgarea() == -1) {
working(2, 0, 0);
return;
set_color(WHITE, BLACK);
mvprintw( 5, 3, "9.2 MESSAGE AREA SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&msgshdr, sizeof(msgshdr), 1, fil);
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 10; i++) {
if ((o + i) <= records) {
offset = sizeof(msgshdr) + (((o + i) - 1) * (msgshdr.recsize + msgshdr.syssize));
fseek(fil, offset, 0);
fread(&msgs, msgshdr.recsize, 1, fil);
if (msgs.Active) {
set_color(CYAN, BLACK);
sprintf(temp, "%3d. %-8s %-23s %-40s", o + i, getmsgtype(msgs.Type), msgs.Tag, msgs.Name);
} else {
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d.", o+i);
}
mvprintw(y, 2, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 3, "9.2 MESSAGE AREA SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&msgshdr, sizeof(msgshdr), 1, fil);
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 10; i++) {
if ((o + i) <= records) {
offset = sizeof(msgshdr) + (((o + i) - 1) * (msgshdr.recsize + msgshdr.syssize));
fseek(fil, offset, 0);
fread(&msgs, msgshdr.recsize, 1, fil);
if (msgs.Active) {
set_color(CYAN, BLACK);
sprintf(temp, "%3d. %-8s %-23s %-40s", o + i, getmsgtype(msgs.Type), msgs.Tag, msgs.Name);
} else {
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d.", o+i);
}
mvprintw(y, 2, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_area(records, 10));
strcpy(pick, select_area(records, 10));
if (strncmp(pick, "-", 1) == 0) {
CloseMsgarea(MailForced);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendMsgarea() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "G", 1) == 0) {
MsgGlobal();
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 10) < records)
o = o + 10;
if (strncmp(pick, "P", 1) == 0)
if ((o - 10) >= 0)
o = o - 10;
if (strncmp(pick, "M", 1) == 0) {
from = too = 0;
mvprintw(LINES -3, 5, "From");
from = edit_int(LINES -3, 10, from, (char *)"Wich ^area^ you want to move");
mvprintw(LINES -3,15, "To");
too = edit_int(LINES -3, 18, too, (char *)"Too which ^area^ to move");
if ((LoadMsgRec(from, TRUE) == -1) || (!msgs.Active)) {
errmsg((char *)"The originating area is invalid");
fclose(tfil);
} else {
fclose(tfil);
if ((LoadMsgRec(too, TRUE) == -1) || (msgs.Active)) {
errmsg((char *)"The destination area is invalid");
fclose(tfil);
} else {
fclose(tfil);
LoadMsgRec(from, TRUE);
SaveMsgRec(too, TRUE);
LoadMsgRec(from, TRUE);
InitMsgRec();
fseek(tfil, 0, SEEK_SET);
memset(&System, 0, sizeof(sysconnect));
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
fwrite(&System, sizeof(sysconnect), 1, tfil);
}
SaveMsgRec(from, TRUE);
MsgUpdated = 1;
}
}
}
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMsgRec(atoi(pick));
o = ((atoi(pick) - 1) / 10) * 10;
}
if (strncmp(pick, "-", 1) == 0) {
CloseMsgarea(MailForced);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendMsgarea() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "G", 1) == 0) {
MsgGlobal();
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 10) < records)
o = o + 10;
if (strncmp(pick, "P", 1) == 0)
if ((o - 10) >= 0)
o = o - 10;
if (strncmp(pick, "M", 1) == 0) {
from = too = 0;
mvprintw(LINES -3, 5, "From");
from = edit_int(LINES -3, 10, from, (char *)"Wich ^area^ you want to move");
mvprintw(LINES -3,15, "To");
too = edit_int(LINES -3, 18, too, (char *)"Too which ^area^ to move");
rc = 0;
/*
* Check originating area
*/
if (from == 0) {
errmsg((char *)"The originating area cannot be zero");
rc = 1;
}
if (!rc && LoadMsgRec(from, TRUE) == -1) {
errmsg((char *)"The originating area does not exist");
rc = 1;
}
if (!rc)
fclose(tfil);
if (!rc && !msgs.Active) {
errmsg((char *)"The originating area is not in use");
rc = 1;
}
if (!rc && (too == 0)) {
errmsg((char *)"The destination area cannot be zero");
rc = 1;
}
if (!rc && LoadMsgRec(too, TRUE) == -1) {
errmsg((char *)"The destination area does not exist");
rc = 1;
}
if (!rc)
fclose(tfil);
if (!rc && (msgs.Active)) {
errmsg((char *)"The destination area is in use");
rc = 1;
}
if (!rc) {
LoadMsgRec(from, TRUE);
SaveMsgRec(too, TRUE);
LoadMsgRec(from, TRUE);
InitMsgRec();
fseek(tfil, 0, SEEK_SET);
memset(&System, 0, sizeof(sysconnect));
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
fwrite(&System, sizeof(sysconnect), 1, tfil);
}
SaveMsgRec(from, TRUE);
MsgUpdated = 1;
Syslog('+', "Moved message area %d to %d", from, too);
}
}
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMsgRec(atoi(pick));
o = ((atoi(pick) - 1) / 10) * 10;
}
}
}

View File

@ -435,102 +435,106 @@ int EditMGrpRec(int Area)
void EditMGroup(void)
{
int records, i, o, x, y;
char pick[12];
FILE *fil;
char temp[PATH_MAX];
long offset;
int records, i, o, x, y;
char pick[12], temp[PATH_MAX];
FILE *fil;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountMGroup();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenMGroup() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountMGroup();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenMGroup() == -1) {
working(2, 0, 0);
return;
set_color(WHITE, BLACK);
mvprintw( 5, 4, "9.1 MESSAGE GROUPS SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11 ) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(mgrouphdr) + (((o + i) - 1) * mgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&mgroup, mgrouphdr.recsize, 1, fil);
if (mgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, mgroup.Name, mgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 4, "9.1 MESSAGE GROUPS SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11 ) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(mgrouphdr) + (((o + i) - 1) * mgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&mgroup, mgrouphdr.recsize, 1, fil);
if (mgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, mgroup.Name, mgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseMGroup(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendMGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
if (strncmp(pick, "-", 1) == 0) {
CloseMGroup(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
if (records < CFG.toss_groups) {
working(1, 0, 0);
if (AppendMGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add group, change global setting in menu 1.14.12");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
}

View File

@ -436,99 +436,102 @@ int EditNewRec(int Area)
void EditNewfiles(void)
{
int records, i, o, x, y;
char pick[12];
FILE *fil;
char temp[PATH_MAX];
long offset;
int records, i, o, x, y;
char pick[12], temp[PATH_MAX];
FILE *fil;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountNewfiles();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenNewfiles() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
for (;;) {
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountNewfiles();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenNewfiles() == -1) {
working(2, 0, 0);
return;
set_color(WHITE, BLACK);
mvprintw( 5, 4, "12. NEWFILES REPORTS");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/newfiles.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&newfileshdr, sizeof(newfileshdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(newfileshdr) + (((o + i) - 1) * (newfileshdr.recsize + newfileshdr.grpsize));
fseek(fil, offset, 0);
fread(&newfiles, newfileshdr.recsize, 1, fil);
if (newfiles.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-32s", o + i, newfiles.Comment);
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
o = 0;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 4, "12. NEWFILES REPORTS");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/newfiles.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&newfileshdr, sizeof(newfileshdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(newfileshdr) + (((o + i) - 1) * (newfileshdr.recsize + newfileshdr.grpsize));
fseek(fil, offset, 0);
fread(&newfiles, newfileshdr.recsize, 1, fil);
if (newfiles.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-32s", o + i, newfiles.Comment);
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseNewfiles(FALSE);
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendNewfiles() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNewRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
if (strncmp(pick, "-", 1) == 0) {
CloseNewfiles(FALSE);
return;
}
if (strncmp(pick, "A", 1) == 0) {
if (records > CFG.new_groups) {
working(1, 0, 0);
if (AppendNewfiles() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add, change global setting in menu 1.16.3");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNewRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: Nodes Setup Program
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -55,7 +55,6 @@ int NodeUpdated = 0;
* Count nr of nodes records in the database.
* Creates the database if it doesn't exist.
*/
int CountNoderec(void);
int CountNoderec(void)
{
FILE *fil;
@ -1180,102 +1179,109 @@ int EditNodeRec(int Area)
void EditNodes(void)
{
int records, i, o, x, y;
char pick[12];
FILE *fil;
char temp[PATH_MAX];
long offset;
int records, i, o, x, y;
char pick[12], temp[PATH_MAX];
FILE *fil;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountNoderec();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenNoderec() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountNoderec();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenNoderec() == -1) {
working(2, 0, 0);
return;
set_color(WHITE, BLACK);
mvprintw( 5, 6, "7. NODES SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&nodeshdr, sizeof(nodeshdr), 1, fil);
x = 4;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(nodeshdr) + (((o + i) - 1) * (nodeshdr.recsize + nodeshdr.filegrp + nodeshdr.mailgrp));
fseek(fil, offset, 0);
fread(&nodes, nodeshdr.recsize, 1, fil);
if (strlen(nodes.Sysop))
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %s (%s)", o + i, nodes.Sysop, strtok(aka2str(nodes.Aka[0]), "@"));
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "7. NODES SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&nodeshdr, sizeof(nodeshdr), 1, fil);
x = 4;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(nodeshdr) + (((o + i) - 1) * (nodeshdr.recsize + nodeshdr.filegrp + nodeshdr.mailgrp));
fseek(fil, offset, 0);
fread(&nodes, nodeshdr.recsize, 1, fil);
if (strlen(nodes.Sysop))
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %s (%s)", o + i, nodes.Sysop, strtok(aka2str(nodes.Aka[0]), "@"));
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseNoderec(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendNoderec() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNodeRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
if (strncmp(pick, "-", 1) == 0) {
CloseNoderec(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
if ((records < CFG.toss_systems) && (records < CFG.tic_systems)) {
working(1, 0, 0);
if (AppendNoderec() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
if ((records + 1) > CFG.toss_systems) {
errmsg("Cannot add node, change global setting in menu 1.14.11");
} else {
errmsg("Cannot add node, change global setting in menu 1.13.4");
}
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNodeRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
}

View File

@ -1,13 +1,15 @@
#ifndef _NODE_H
#define _NODE_H
int OpenNoderec(void);
void CloseNoderec(int);
int GroupInNode(char *, int);
void EditNodes(void);
void InitNodes(void);
int node_doc(FILE *, FILE *, int);
fidoaddr PullUplink(char *);
/* $Id$ */
int CountNoderec(void);
int OpenNoderec(void);
void CloseNoderec(int);
int GroupInNode(char *, int);
void EditNodes(void);
void InitNodes(void);
int node_doc(FILE *, FILE *, int);
fidoaddr PullUplink(char *);
#endif