updated mbsetup to initialize databases

This commit is contained in:
Michiel Broek 2001-10-19 21:10:43 +00:00
parent c5500c65fe
commit 307e1240c9
41 changed files with 616 additions and 303 deletions

View File

@ -4137,6 +4137,9 @@ v0.33.18 27-Jul-2001
Added setup items for the menu Display colors. Added setup items for the menu Display colors.
Added a no suid switch to the menu for doors. Added a no suid switch to the menu for doors.
Added setup for *.msg directory in menu 1.3. Added setup for *.msg directory in menu 1.3.
When changing the number of newfiles groups, the newfiles
reports database is converted on the fly.
All path variables now have a length of PATH_MAX.
mbcico: mbcico:
Renamed sendfile function in zmsend.c to sendzfile to prevent a Renamed sendfile function in zmsend.c to sendzfile to prevent a

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_fido.c * File ..................: setup/m_fido.c
* Purpose ...............: Setup Fidonet structure. * Purpose ...............: Setup Fidonet structure.
* Last modification date : 13-Jul-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -53,12 +53,13 @@ int FidoUpdated = 0;
int CountFidonet(void) int CountFidonet(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/fidonet.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
fidonethdr.hdrsize = sizeof(fidonethdr); fidonethdr.hdrsize = sizeof(fidonethdr);
fidonethdr.recsize = sizeof(fidonet); fidonethdr.recsize = sizeof(fidonet);
fwrite(&fidonethdr, sizeof(fidonethdr), 1, fil); fwrite(&fidonethdr, sizeof(fidonethdr), 1, fil);
@ -108,10 +109,11 @@ int CountFidonet(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenFidonet(void);
int OpenFidonet(void) int OpenFidonet(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/fidonet.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
@ -125,9 +127,10 @@ int OpenFidonet(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = fidonethdr.recsize; oldsize = fidonethdr.recsize;
if (oldsize != sizeof(fidonet)) if (oldsize != sizeof(fidonet)) {
FidoUpdated = 1; FidoUpdated = 1;
else Syslog('+', "Updated %s, format changed");
} else
FidoUpdated = 0; FidoUpdated = 0;
fidonethdr.hdrsize = sizeof(fidonethdr); fidonethdr.hdrsize = sizeof(fidonethdr);
fidonethdr.recsize = sizeof(fidonet); fidonethdr.recsize = sizeof(fidonet);
@ -155,9 +158,10 @@ int OpenFidonet(void)
void CloseFidonet(void) void CloseFidonet(int);
void CloseFidonet(int force)
{ {
char fin[81], fout[81], temp[10]; char fin[PATH_MAX], fout[PATH_MAX], temp[10];
FILE *fi, *fo; FILE *fi, *fo;
st_list *fid = NULL, *tmp; st_list *fid = NULL, *tmp;
@ -165,7 +169,7 @@ void CloseFidonet(void)
sprintf(fout,"%s/etc/fidonet.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/fidonet.temp", getenv("MBSE_ROOT"));
if (FidoUpdated == 1) { if (FidoUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -203,7 +207,7 @@ void CloseFidonet(void)
int AppendFidonet(void) int AppendFidonet(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/fidonet.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/fidonet.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -224,7 +228,7 @@ int AppendFidonet(void)
int EditFidoRec(int Area) int EditFidoRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81], *temp; char mfile[PATH_MAX], *temp;
long offset; long offset;
int i, j = 0; int i, j = 0;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -375,7 +379,7 @@ void EditFidonet(void)
int records, i, x, y; int records, i, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -434,7 +438,7 @@ void EditFidonet(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseFidonet(); CloseFidonet(FALSE);
return; return;
} }
@ -455,9 +459,18 @@ void EditFidonet(void)
void InitFidonetdb(void)
{
CountFidonet();
OpenFidonet();
CloseFidonet(TRUE);
}
void gold_akamatch(FILE *fp) void gold_akamatch(FILE *fp)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *fido; FILE *fido;
faddr *want; faddr *want;
int i; int i;
@ -510,7 +523,7 @@ void gold_akamatch(FILE *fp)
int fido_doc(FILE *fp, FILE *toc, int page) int fido_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *fido; FILE *fido;
int i, j; int i, j;

View File

@ -4,6 +4,7 @@
int CountFidonet(void); int CountFidonet(void);
void EditFidonet(void); void EditFidonet(void);
void InitFidonetdb(void);
void gold_akamatch(FILE *); void gold_akamatch(FILE *);
int fido_doc(FILE *, FILE *, int); int fido_doc(FILE *, FILE *, int);

View File

@ -40,6 +40,7 @@
#include "m_node.h" #include "m_node.h"
#include "m_marea.h" #include "m_marea.h"
#include "m_ticarea.h" #include "m_ticarea.h"
#include "m_new.h"
#include "m_global.h" #include "m_global.h"
@ -1082,7 +1083,12 @@ void e_newfiles(void)
case 1: E_PTH(7,16,64, CFG.ftp_base, "The ^FTP home^ directory to strip of the real directory") case 1: E_PTH(7,16,64, CFG.ftp_base, "The ^FTP home^ directory to strip of the real directory")
case 2: E_INT(8,16, CFG.newdays, "Add files younger than this in newfiles report.") case 2: E_INT(8,16, CFG.newdays, "Add files younger than this in newfiles report.")
case 3: E_SEC(9,16, CFG.security, "1.14 NEWFILES REPORTS SECURITY", s_newfiles) case 3: E_SEC(9,16, CFG.security, "1.14 NEWFILES REPORTS SECURITY", s_newfiles)
case 4: E_INT(10,16, CFG.new_groups, "The maximum of ^newfiles^ groups in the newfiles database") case 4: CFG.new_groups = edit_int(10, 16, CFG.new_groups,
(char *)"The maximum of ^newfiles^ groups in the newfiles database");
if (OpenNewfiles() == 0)
CloseNewfiles(TRUE);
working(0, 0, 0);
break;
} }
}; };
} }

View File

@ -2,10 +2,10 @@
* *
* File ..................: m_hatch.c * File ..................: m_hatch.c
* Purpose ...............: Hatch Setup * Purpose ...............: Hatch Setup
* Last modification date : 18-Mar-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -63,12 +63,13 @@ char *Month[] = {(char *)"1", (char *)"2", (char *)"3", (char *)"4",
int CountHatch(void) int CountHatch(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/hatch.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/hatch.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
hatchhdr.hdrsize = sizeof(hatchhdr); hatchhdr.hdrsize = sizeof(hatchhdr);
hatchhdr.recsize = sizeof(hatch); hatchhdr.recsize = sizeof(hatch);
hatchhdr.lastupd = time(NULL); hatchhdr.lastupd = time(NULL);
@ -94,10 +95,11 @@ int CountHatch(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenHatch(void);
int OpenHatch(void) int OpenHatch(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
int FieldPatch = FALSE; int FieldPatch = FALSE;
@ -114,6 +116,7 @@ int OpenHatch(void)
oldsize = hatchhdr.recsize; oldsize = hatchhdr.recsize;
if (oldsize != sizeof(hatch)) { if (oldsize != sizeof(hatch)) {
HatchUpdated = 1; HatchUpdated = 1;
Syslog('+', "Updated %s, format changed", fnin);
if ((oldsize + 8) == sizeof(hatch)) { if ((oldsize + 8) == sizeof(hatch)) {
FieldPatch = TRUE; FieldPatch = TRUE;
Syslog('?', "Hatch: performing FieldPatch"); Syslog('?', "Hatch: performing FieldPatch");
@ -149,9 +152,10 @@ int OpenHatch(void)
void CloseHatch(void) void CloseHatch(int);
void CloseHatch(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *hat = NULL, *tmp; st_list *hat = NULL, *tmp;
@ -159,7 +163,7 @@ void CloseHatch(void)
sprintf(fout,"%s/etc/hatch.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/hatch.temp", getenv("MBSE_ROOT"));
if (HatchUpdated == 1) { if (HatchUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -194,7 +198,7 @@ void CloseHatch(void)
int AppendHatch(void) int AppendHatch(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int i; int i;
sprintf(ffile, "%s/etc/hatch.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
@ -324,7 +328,7 @@ void EditDays(void)
int EditHatchRec(int Area) int EditHatchRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
static char *tmp = NULL; static char *tmp = NULL;
long offset; long offset;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -450,7 +454,7 @@ void EditHatch(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -513,7 +517,7 @@ void EditHatch(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseHatch(); CloseHatch(FALSE);
return; return;
} }
@ -542,9 +546,18 @@ void EditHatch(void)
void InitHatch(void)
{
CountHatch();
OpenHatch();
CloseHatch(TRUE);
}
int tic_hatch_doc(FILE *fp, FILE *toc, int page) int tic_hatch_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81], *tmp = NULL; char temp[PATH_MAX], *tmp = NULL;
FILE *no; FILE *no;
int i, j, All; int i, j, All;

View File

@ -4,6 +4,7 @@
int CountHatch(void); int CountHatch(void);
void EditHatch(void); void EditHatch(void);
void InitHatch(void);
int tic_hatch_doc(FILE *, FILE *, int); int tic_hatch_doc(FILE *, FILE *, int);
#endif #endif

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_language.c * File ..................: setup/m_language.c
* Purpose ...............: Setup Languages. * Purpose ...............: Setup Languages.
* Last modification date : 25-Jul-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -53,12 +53,13 @@ int LangUpdated = 0;
int CountLanguage(void) int CountLanguage(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/language.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/language.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
langhdr.hdrsize = sizeof(langhdr); langhdr.hdrsize = sizeof(langhdr);
langhdr.recsize = sizeof(lang); langhdr.recsize = sizeof(lang);
fwrite(&langhdr, sizeof(langhdr), 1, fil); fwrite(&langhdr, sizeof(langhdr), 1, fil);
@ -106,6 +107,16 @@ int CountLanguage(void)
lang.Available = TRUE; lang.Available = TRUE;
fwrite(&lang, sizeof(lang), 1, fil); fwrite(&lang, sizeof(lang), 1, fil);
memset(&lang, 0, sizeof(lang));
sprintf(lang.Name, "Galego");
sprintf(lang.LangKey, "G");
sprintf(lang.MenuPath, "%s/galego/menus", getenv("MBSE_ROOT"));
sprintf(lang.TextPath, "%s/galego/txtfiles", getenv("MBSE_ROOT"));
sprintf(lang.MacroPath, "%s/galego/macro", getenv("MBSE_ROOT"));
sprintf(lang.Filename, "galego.lang");
lang.Available = TRUE;
fwrite(&lang, sizeof(lang), 1, fil);
fclose(fil); fclose(fil);
return 2; return 2;
} else } else
@ -127,10 +138,11 @@ int CountLanguage(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenLanguage(void);
int OpenLanguage(void) int OpenLanguage(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/language.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/language.data", getenv("MBSE_ROOT"));
@ -144,9 +156,10 @@ int OpenLanguage(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = langhdr.recsize; oldsize = langhdr.recsize;
if (oldsize != sizeof(lang)) if (oldsize != sizeof(lang)) {
LangUpdated = 1; LangUpdated = 1;
else Syslog('+', "Updated %s, format changed", fnin);
} else
LangUpdated = 0; LangUpdated = 0;
langhdr.hdrsize = sizeof(langhdr); langhdr.hdrsize = sizeof(langhdr);
langhdr.recsize = sizeof(lang); langhdr.recsize = sizeof(lang);
@ -174,9 +187,10 @@ int OpenLanguage(void)
void CloseLanguage(void) void CloseLanguage(int);
void CloseLanguage(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *lan = NULL, *tmp; st_list *lan = NULL, *tmp;
@ -184,7 +198,7 @@ void CloseLanguage(void)
sprintf(fout,"%s/etc/language.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/language.temp", getenv("MBSE_ROOT"));
if (LangUpdated == 1) { if (LangUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -219,7 +233,7 @@ void CloseLanguage(void)
int AppendLanguage(void) int AppendLanguage(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/language.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/language.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -260,7 +274,7 @@ void s_lang(void)
int EditLangRec(int Area) int EditLangRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -343,7 +357,7 @@ void EditLanguage(void)
int records, i, x; int records, i, x;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -397,7 +411,7 @@ void EditLanguage(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseLanguage(); CloseLanguage(FALSE);
return; return;
} }
@ -418,13 +432,22 @@ void EditLanguage(void)
void InitLanguage(void)
{
CountLanguage();
OpenLanguage();
CloseLanguage(TRUE);
}
int PickLanguage(char *nr) int PickLanguage(char *nr)
{ {
int Lang = '\0'; int Lang = '\0';
int records, i, x; int records, i, x;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
@ -485,7 +508,7 @@ int PickLanguage(char *nr)
int bbs_lang_doc(FILE *fp, FILE *toc, int page) int bbs_lang_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountLanguage(void); int CountLanguage(void);
void EditLanguage(void); void EditLanguage(void);
void InitLanguage(void);
int PickLanguage(char *); int PickLanguage(char *);
int bbs_lang_doc(FILE *, FILE *, int); int bbs_lang_doc(FILE *, FILE *, int);

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_limits.c * File ..................: setup/m_limits.c
* Purpose ...............: Setup Limits. * Purpose ...............: Setup Limits.
* Last modification date : 30-Sep-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -53,12 +53,13 @@ int LimUpdated = 0;
int CountLimits(void) int CountLimits(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/limits.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/limits.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
LIMIThdr.hdrsize = sizeof(LIMIThdr); LIMIThdr.hdrsize = sizeof(LIMIThdr);
LIMIThdr.recsize = sizeof(LIMIT); LIMIThdr.recsize = sizeof(LIMIT);
fwrite(&LIMIThdr, sizeof(LIMIThdr), 1, fil); fwrite(&LIMIThdr, sizeof(LIMIThdr), 1, fil);
@ -147,10 +148,11 @@ int CountLimits(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenLimits(void);
int OpenLimits(void) int OpenLimits(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/limits.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/limits.data", getenv("MBSE_ROOT"));
@ -164,9 +166,10 @@ int OpenLimits(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = LIMIThdr.recsize; oldsize = LIMIThdr.recsize;
if (oldsize != sizeof(LIMIT)) if (oldsize != sizeof(LIMIT)) {
LimUpdated = 1; LimUpdated = 1;
else Syslog('+', "Updated %s, format changed");
} else
LimUpdated = 0; LimUpdated = 0;
LIMIThdr.hdrsize = sizeof(LIMIThdr); LIMIThdr.hdrsize = sizeof(LIMIThdr);
LIMIThdr.recsize = sizeof(LIMIT); LIMIThdr.recsize = sizeof(LIMIT);
@ -194,9 +197,10 @@ int OpenLimits(void)
void CloseLimits(void) void CloseLimits(int);
void CloseLimits(int force)
{ {
char fin[81], fout[81], temp[20]; char fin[PATH_MAX], fout[PATH_MAX], temp[20];
FILE *fi, *fo; FILE *fi, *fo;
st_list *lim = NULL, *tmp; st_list *lim = NULL, *tmp;
@ -204,7 +208,7 @@ void CloseLimits(void)
sprintf(fout,"%s/etc/limits.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/limits.temp", getenv("MBSE_ROOT"));
if (LimUpdated == 1) { if (LimUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -241,7 +245,7 @@ void CloseLimits(void)
int AppendLimits(void) int AppendLimits(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/limits.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/limits.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -262,7 +266,7 @@ int AppendLimits(void)
int EditLimRec(int Area) int EditLimRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -351,7 +355,7 @@ void EditLimits(void)
int records, i, x, y; int records, i, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -409,7 +413,7 @@ void EditLimits(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseLimits(); CloseLimits(FALSE);
return; return;
} }
@ -430,13 +434,22 @@ void EditLimits(void)
void InitLimits(void)
{
CountLimits();
OpenLimits();
CloseLimits(TRUE);
}
char *PickLimits(int nr) char *PickLimits(int nr)
{ {
static char Lim[21] = ""; static char Lim[21] = "";
int records, i, x, y; int records, i, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
@ -502,7 +515,7 @@ char *PickLimits(int nr)
int bbs_limits_doc(FILE *fp, FILE *toc, int page) int bbs_limits_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT"));
@ -531,7 +544,7 @@ int bbs_limits_doc(FILE *fp, FILE *toc, int page)
int limit_users_doc(FILE *fp, FILE *toc, int page) int limit_users_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no, *us; FILE *no, *us;
int line = 0, j; int line = 0, j;

View File

@ -4,6 +4,7 @@
int CountLimits(void); int CountLimits(void);
void EditLimits(void); void EditLimits(void);
void InitLimits(void);
char *PickLimits(int); char *PickLimits(int);
int bbs_limits_doc(FILE *, FILE *, int); int bbs_limits_doc(FILE *, FILE *, int);
int limit_users_doc(FILE *, FILE *, int); int limit_users_doc(FILE *, FILE *, int);

View File

@ -2,10 +2,10 @@
* *
* File ..................: setup/m_magic.c * File ..................: setup/m_magic.c
* Purpose ...............: Edit Magics * Purpose ...............: Edit Magics
* Last modification date : 18-Mar-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -54,12 +54,13 @@ int MagicUpdated = 0;
int CountMagics(void) int CountMagics(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/magic.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/magic.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
magichdr.hdrsize = sizeof(magichdr); magichdr.hdrsize = sizeof(magichdr);
magichdr.recsize = sizeof(magic); magichdr.recsize = sizeof(magic);
fwrite(&magichdr, sizeof(magichdr), 1, fil); fwrite(&magichdr, sizeof(magichdr), 1, fil);
@ -84,10 +85,11 @@ int CountMagics(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenMagics(void);
int OpenMagics(void) int OpenMagics(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
int FieldPatch = FALSE; int FieldPatch = FALSE;
@ -104,6 +106,7 @@ int OpenMagics(void)
oldsize = magichdr.recsize; oldsize = magichdr.recsize;
if (oldsize != sizeof(magic)) { if (oldsize != sizeof(magic)) {
MagicUpdated = 1; MagicUpdated = 1;
Syslog('+', "Updated %s, format changed", fnin);
if ((oldsize + 16) == sizeof(magic)) { if ((oldsize + 16) == sizeof(magic)) {
FieldPatch = TRUE; FieldPatch = TRUE;
Syslog('?', "Magic: performing FieldPatch"); Syslog('?', "Magic: performing FieldPatch");
@ -140,9 +143,10 @@ int OpenMagics(void)
void CloseMagics(void) void CloseMagics(int);
void CloseMagics(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *mag = NULL, *tmp; st_list *mag = NULL, *tmp;
@ -150,7 +154,7 @@ void CloseMagics(void)
sprintf(fout,"%s/etc/magic.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/magic.temp", getenv("MBSE_ROOT"));
if (MagicUpdated == 1) { if (MagicUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -185,7 +189,7 @@ void CloseMagics(void)
int AppendMagics(void) int AppendMagics(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/magic.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/magic.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -277,7 +281,7 @@ void FieldsM(void)
int EditMagicRec(int Area) int EditMagicRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j, choices; int j, choices;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -384,7 +388,7 @@ void EditMagics(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -447,7 +451,7 @@ void EditMagics(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseMagics(); CloseMagics(FALSE);
return; return;
} }
@ -476,9 +480,18 @@ void EditMagics(void)
void InitMagics(void)
{
CountMagics();
OpenMagics();
CloseMagics(TRUE);
}
int tic_magic_doc(FILE *fp, FILE *toc, int page) int tic_magic_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountMagics(void); int CountMagics(void);
void EditMagics(void); void EditMagics(void);
void InitMagics(void);
int tic_magic_doc(FILE *, FILE *, int); int tic_magic_doc(FILE *, FILE *, int);

View File

@ -1,8 +1,8 @@
/***************************************************************************** /*****************************************************************************
* *
* File ..................: m_mail.c * File ..................: m_marea.c
* Purpose ...............: Mail Setup Program * Purpose ...............: Message Areas Setup
* Last modification date : 22-Jan-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -57,13 +57,13 @@ FILE *tfil = NULL;
int CountMsgarea(void) int CountMsgarea(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created mareas.data"); Syslog('+', "Created new %s", ffile);
msgshdr.hdrsize = sizeof(msgshdr); msgshdr.hdrsize = sizeof(msgshdr);
msgshdr.recsize = sizeof(msgs); msgshdr.recsize = sizeof(msgs);
msgshdr.syssize = CFG.toss_systems * sizeof(sysconnect); msgshdr.syssize = CFG.toss_systems * sizeof(sysconnect);
@ -92,10 +92,11 @@ int CountMsgarea(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenMsgarea(void);
int OpenMsgarea(void) int OpenMsgarea(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize, oldsys; long oldsize, oldsys;
struct _sysconnect syscon; struct _sysconnect syscon;
int i, oldsystems; int i, oldsystems;
@ -104,7 +105,6 @@ int OpenMsgarea(void)
sprintf(fnout, "%s/etc/mareas.temp", getenv("MBSE_ROOT")); sprintf(fnout, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
if ((fin = fopen(fnin, "r")) != NULL) { if ((fin = fopen(fnin, "r")) != NULL) {
if ((fout = fopen(fnout, "w")) != NULL) { if ((fout = fopen(fnout, "w")) != NULL) {
Syslog('+', "Opened \"mareas.data\"");
MsgUpdated = 0; MsgUpdated = 0;
fread(&msgshdr, sizeof(msgshdr), 1, fin); fread(&msgshdr, sizeof(msgshdr), 1, fin);
fseek(fin, 0, SEEK_SET); fseek(fin, 0, SEEK_SET);
@ -113,6 +113,7 @@ int OpenMsgarea(void)
msgshdr.hdrsize = sizeof(msgshdr); msgshdr.hdrsize = sizeof(msgshdr);
msgshdr.lastupd = time(NULL); msgshdr.lastupd = time(NULL);
MsgUpdated = 1; MsgUpdated = 1;
Syslog('+', "Updated %s, format changed", fnin);
} }
/* /*
@ -125,7 +126,7 @@ int OpenMsgarea(void)
oldsystems = oldsys / sizeof(syscon); oldsystems = oldsys / sizeof(syscon);
if ((oldsize != sizeof(msgs)) || (CFG.toss_systems != oldsystems)) { if ((oldsize != sizeof(msgs)) || (CFG.toss_systems != oldsystems)) {
MsgUpdated = 1; MsgUpdated = 1;
Syslog('+', "\"mareas.data\" nr of systems is changed"); Syslog('+', "Updated %s, nr of systems is changed to %d", fnin, CFG.toss_systems);
} }
msgshdr.hdrsize = sizeof(msgshdr); msgshdr.hdrsize = sizeof(msgshdr);
msgshdr.recsize = sizeof(msgs); msgshdr.recsize = sizeof(msgs);
@ -169,9 +170,6 @@ int OpenMsgarea(void)
fclose(fin); fclose(fin);
fclose(fout); fclose(fout);
Syslog('+', "Opended \"mareas.data\"");
if (MsgUpdated)
Syslog('+', "Updated \"mareas.data\" data format");
return 0; return 0;
} else } else
return -1; return -1;
@ -183,7 +181,7 @@ int OpenMsgarea(void)
void CloseMsgarea(int Force) void CloseMsgarea(int Force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
sprintf(fin, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(fin, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
sprintf(fout,"%s/etc/mareas.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/mareas.temp", getenv("MBSE_ROOT"));
@ -199,7 +197,6 @@ void CloseMsgarea(int Force)
} }
working(1, 0, 0); working(1, 0, 0);
unlink(fout); unlink(fout);
Syslog('+', "No update of \"mareas.data\"");
} }
@ -227,7 +224,7 @@ int AppendMsgarea(void);
int AppendMsgarea() int AppendMsgarea()
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
struct _sysconnect syscon; struct _sysconnect syscon;
int i; int i;
@ -433,7 +430,7 @@ long LoadMsgRec(int, int);
long LoadMsgRec(int Area, int work) long LoadMsgRec(int Area, int work)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
sysconnect System; sysconnect System;
int i; int i;
@ -484,7 +481,7 @@ int SaveMsgRec(int Area, int work)
int i; int i;
FILE *fil; FILE *fil;
long offset; long offset;
char mfile[81]; char mfile[PATH_MAX];
sysconnect System; sysconnect System;
if (work) if (work)
@ -543,7 +540,7 @@ void MsgGlobal(void);
void MsgGlobal(void) void MsgGlobal(void)
{ {
gr_list *mgr = NULL, *tmp; gr_list *mgr = NULL, *tmp;
char *p, mfile[128]; char *p, mfile[PATH_MAX];
FILE *fil; FILE *fil;
fidoaddr a1, a2; fidoaddr a1, a2;
int menu = 0, marea, Areas, akan = 0, Found; int menu = 0, marea, Areas, akan = 0, Found;
@ -1021,7 +1018,7 @@ void EditMsgarea(void)
int records, i, o, y; int records, i, o, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
int from, too; int from, too;
sysconnect System; sysconnect System;
@ -1148,12 +1145,21 @@ void EditMsgarea(void)
void InitMsgarea(void)
{
CountMsgarea();
OpenMsgarea();
CloseMsgarea(TRUE);
}
char *PickMsgarea(char *shdr) char *PickMsgarea(char *shdr)
{ {
int records, i, o = 0, x, y; int records, i, o = 0, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
static char Buf[81]; static char Buf[81];
@ -1246,7 +1252,7 @@ int GroupInMarea(char *Group)
{ {
int Area = 0, RetVal = 0, systems; int Area = 0, RetVal = 0, systems;
FILE *no; FILE *no;
char temp[128]; char temp[PATH_MAX];
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((no = fopen(temp, "r")) == NULL) if ((no = fopen(temp, "r")) == NULL)
@ -1278,7 +1284,7 @@ int NodeInMarea(fidoaddr A)
{ {
int i, Area = 0, RetVal = 0, systems; int i, Area = 0, RetVal = 0, systems;
FILE *no; FILE *no;
char temp[128]; char temp[PATH_MAX];
sysconnect S; sysconnect S;
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
@ -1314,7 +1320,7 @@ void gold_areas(FILE *fp)
FILE *no; FILE *no;
int i = 0; int i = 0;
temp = calloc(128, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((no = fopen(temp, "r")) == NULL) if ((no = fopen(temp, "r")) == NULL)
return; return;
@ -1362,7 +1368,7 @@ void gold_areas(FILE *fp)
int mail_area_doc(FILE *fp, FILE *toc, int page) int mail_area_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81], status[5]; char temp[PATH_MAX], status[5];
FILE *no; FILE *no;
int i = 0, j, systems, First = TRUE; int i = 0, j, systems, First = TRUE;
sysconnect System; sysconnect System;

View File

@ -8,6 +8,7 @@ int GroupInMarea(char *);
int NodeInMarea(fidoaddr); int NodeInMarea(fidoaddr);
int CountMsgarea(void); int CountMsgarea(void);
void EditMsgarea(void); void EditMsgarea(void);
void InitMsgarea(void);
void gold_areas(FILE *); void gold_areas(FILE *);
int mail_area_doc(FILE *, FILE *, int); int mail_area_doc(FILE *, FILE *, int);
char *PickMsgarea(char *); char *PickMsgarea(char *);

View File

@ -2,7 +2,7 @@
* *
* File ..................: mbsetup/m_menu.c * File ..................: mbsetup/m_menu.c
* Purpose ...............: Edit BBS menus * Purpose ...............: Edit BBS menus
* Last modification date : 17-Oct-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -264,7 +264,7 @@ void Edit_A_Menu(void)
void EditMenu(char *); void EditMenu(char *);
void EditMenu(char *Name) void EditMenu(char *Name)
{ {
char mtemp[81], temp[161]; char mtemp[PATH_MAX], temp[PATH_MAX];
FILE *fil, *tmp; FILE *fil, *tmp;
int records = 0, i, o, y; int records = 0, i, o, y;
char pick[12]; char pick[12];
@ -538,7 +538,7 @@ void EditMenus(void)
int bbs_menu_doc(FILE *fp, FILE *toc, int page) int bbs_menu_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no, *mn; FILE *no, *mn;
DIR *dp; DIR *dp;
struct dirent *de; struct dirent *de;

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_mgroups.c * File ..................: setup/m_mgroups.c
* Purpose ...............: Setup MGroups. * Purpose ...............: Setup MGroups.
* Last modification date : 12-Jun-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -55,12 +55,13 @@ int MGrpUpdated = 0;
int CountMGroup(void) int CountMGroup(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
mgrouphdr.hdrsize = sizeof(mgrouphdr); mgrouphdr.hdrsize = sizeof(mgrouphdr);
mgrouphdr.recsize = sizeof(mgroup); mgrouphdr.recsize = sizeof(mgroup);
fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fil); fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
@ -87,10 +88,11 @@ int CountMGroup(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenMGroup(void);
int OpenMGroup(void) int OpenMGroup(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
@ -119,6 +121,9 @@ int OpenMGroup(void)
mgrouphdr.recsize = sizeof(mgroup); mgrouphdr.recsize = sizeof(mgroup);
fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fout); fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fout);
if (MGrpUpdated)
Syslog('+', "Updated %s, format changed", fnin);
/* /*
* The datarecord is filled with zero's before each * The datarecord is filled with zero's before each
* read, so if the format changed, the new fields * read, so if the format changed, the new fields
@ -141,9 +146,10 @@ int OpenMGroup(void)
void CloseMGroup(void) void CloseMGroup(int);
void CloseMGroup(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *mgr = NULL, *tmp; st_list *mgr = NULL, *tmp;
@ -151,7 +157,7 @@ void CloseMGroup(void)
sprintf(fout,"%s/etc/mgroups.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
if (MGrpUpdated == 1) { if (MGrpUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -186,7 +192,7 @@ void CloseMGroup(void)
int AppendMGroup(void) int AppendMGroup(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/mgroups.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -339,7 +345,7 @@ void EditMGroup(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -402,7 +408,7 @@ void EditMGroup(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseMGroup(); CloseMGroup(FALSE);
return; return;
} }
@ -431,13 +437,22 @@ void EditMGroup(void)
void InitMGroup(void)
{
CountMGroup();
OpenMGroup();
CloseMGroup(TRUE);
}
char *PickMGroup(char *shdr) char *PickMGroup(char *shdr)
{ {
static char MGrp[21] = ""; static char MGrp[21] = "";
int records, i, o = 0, y, x; int records, i, o = 0, y, x;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
@ -523,7 +538,7 @@ char *PickMGroup(char *shdr)
int mail_group_doc(FILE *fp, FILE *toc, int page) int mail_group_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountMGroup(void); int CountMGroup(void);
void EditMGroup(void); void EditMGroup(void);
void InitMGroup(void);
char *PickMGroup(char *); char *PickMGroup(char *);
int mail_group_doc(FILE *, FILE *, int); int mail_group_doc(FILE *, FILE *, int);

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_modem.c * File ..................: setup/m_modem.c
* Purpose ...............: Setup Modem structure. * Purpose ...............: Setup Modem structure.
* Last modification date : 24-Jun-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -53,12 +53,13 @@ int ModemUpdated = 0;
int CountModem(void) int CountModem(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/modem.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/modem.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
modemhdr.hdrsize = sizeof(modemhdr); modemhdr.hdrsize = sizeof(modemhdr);
modemhdr.recsize = sizeof(modem); modemhdr.recsize = sizeof(modem);
fwrite(&modemhdr, sizeof(modemhdr), 1, fil); fwrite(&modemhdr, sizeof(modemhdr), 1, fil);
@ -72,22 +73,26 @@ int CountModem(void)
sprintf(modem.init[1], "AT &F &C1 &D2 X4 W2 B0 M0 \\\\V1 \\\\G0 &K3 S37=0\\r"); sprintf(modem.init[1], "AT &F &C1 &D2 X4 W2 B0 M0 \\\\V1 \\\\G0 &K3 S37=0\\r");
sprintf(modem.ok, "OK"); sprintf(modem.ok, "OK");
sprintf(modem.dial, "ATDT\\T\\r"); sprintf(modem.dial, "ATDT\\T\\r");
sprintf(modem.connect[0], "CONNECT 33600"); sprintf(modem.connect[0], "CONNECT 56000");
sprintf(modem.connect[1], "CONNECT 31200"); sprintf(modem.connect[1], "CONNECT 48000");
sprintf(modem.connect[2], "CONNECT 28800"); sprintf(modem.connect[2], "CONNECT 44000");
sprintf(modem.connect[3], "CONNECT 26400"); sprintf(modem.connect[3], "CONNECT 41333");
sprintf(modem.connect[4], "CONNECT 24000"); sprintf(modem.connect[4], "CONNECT 38000");
sprintf(modem.connect[5], "CONNECT 21600"); sprintf(modem.connect[5], "CONNECT 33600");
sprintf(modem.connect[6], "CONNECT 19200"); sprintf(modem.connect[6], "CONNECT 31200");
sprintf(modem.connect[7], "CONNECT 16800"); sprintf(modem.connect[7], "CONNECT 28800");
sprintf(modem.connect[8], "CONNECT 14400"); sprintf(modem.connect[8], "CONNECT 26400");
sprintf(modem.connect[9], "CONNECT 12000"); sprintf(modem.connect[9], "CONNECT 24000");
sprintf(modem.connect[10], "CONNECT 9600"); sprintf(modem.connect[10], "CONNECT 21600");
sprintf(modem.connect[11], "CONNECT 7200"); sprintf(modem.connect[11], "CONNECT 19200");
sprintf(modem.connect[12], "CONNECT 4800"); sprintf(modem.connect[12], "CONNECT 16800");
sprintf(modem.connect[13], "CONNECT 2400"); sprintf(modem.connect[13], "CONNECT 14400");
sprintf(modem.connect[14], "CONNECT 1200"); sprintf(modem.connect[14], "CONNECT 12000");
sprintf(modem.connect[15], "CONNECT 300"); sprintf(modem.connect[15], "CONNECT 9600");
sprintf(modem.connect[16], "CONNECT 7200");
sprintf(modem.connect[17], "CONNECT 4800");
sprintf(modem.connect[18], "CONNECT 2400");
sprintf(modem.connect[19], "CONNECT");
sprintf(modem.reset, "AT&F&C1&D2X4W2B0M0&K3\\r"); sprintf(modem.reset, "AT&F&C1&D2X4W2B0M0&K3\\r");
sprintf(modem.error[0], "BUSY"); sprintf(modem.error[0], "BUSY");
sprintf(modem.error[1], "NO CARRIER"); sprintf(modem.error[1], "NO CARRIER");
@ -160,10 +165,11 @@ int CountModem(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenModem(void);
int OpenModem(void) int OpenModem(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/modem.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/modem.data", getenv("MBSE_ROOT"));
@ -177,9 +183,10 @@ int OpenModem(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = modemhdr.recsize; oldsize = modemhdr.recsize;
if (oldsize != sizeof(modem)) if (oldsize != sizeof(modem)) {
ModemUpdated = 1; ModemUpdated = 1;
else Syslog('+', "Updated %s, format changed", fnin);
} else
ModemUpdated = 0; ModemUpdated = 0;
modemhdr.hdrsize = sizeof(modemhdr); modemhdr.hdrsize = sizeof(modemhdr);
modemhdr.recsize = sizeof(modem); modemhdr.recsize = sizeof(modem);
@ -207,9 +214,10 @@ int OpenModem(void)
void CloseModem(void) void CloseModem(int);
void CloseModem(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *mdm = NULL, *tmp; st_list *mdm = NULL, *tmp;
@ -217,7 +225,7 @@ void CloseModem(void)
sprintf(fout,"%s/etc/modem.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/modem.temp", getenv("MBSE_ROOT"));
if (ModemUpdated == 1) { if (ModemUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -252,7 +260,7 @@ void CloseModem(void)
int AppendModem(void) int AppendModem(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/modem.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/modem.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -260,22 +268,26 @@ int AppendModem(void)
sprintf(modem.init[0], "ATZ\\r"); sprintf(modem.init[0], "ATZ\\r");
sprintf(modem.ok, "OK"); sprintf(modem.ok, "OK");
sprintf(modem.dial, "ATDT\\T\\r"); sprintf(modem.dial, "ATDT\\T\\r");
sprintf(modem.connect[0], "CONNECT 33600"); sprintf(modem.connect[0], "CONNECT 56000");
sprintf(modem.connect[1], "CONNECT 31200"); sprintf(modem.connect[1], "CONNECT 48000");
sprintf(modem.connect[2], "CONNECT 28800"); sprintf(modem.connect[2], "CONNECT 44000");
sprintf(modem.connect[3], "CONNECT 26400"); sprintf(modem.connect[3], "CONNECT 41333");
sprintf(modem.connect[4], "CONNECT 24000"); sprintf(modem.connect[4], "CONNECT 38000");
sprintf(modem.connect[5], "CONNECT 21600"); sprintf(modem.connect[5], "CONNECT 33600");
sprintf(modem.connect[6], "CONNECT 19200"); sprintf(modem.connect[6], "CONNECT 31200");
sprintf(modem.connect[7], "CONNECT 16800"); sprintf(modem.connect[7], "CONNECT 28800");
sprintf(modem.connect[8], "CONNECT 14400"); sprintf(modem.connect[8], "CONNECT 26400");
sprintf(modem.connect[9], "CONNECT 12000"); sprintf(modem.connect[9], "CONNECT 24000");
sprintf(modem.connect[10], "CONNECT 9600"); sprintf(modem.connect[10], "CONNECT 21600");
sprintf(modem.connect[11], "CONNECT 7200"); sprintf(modem.connect[11], "CONNECT 19200");
sprintf(modem.connect[12], "CONNECT 4800"); sprintf(modem.connect[12], "CONNECT 16800");
sprintf(modem.connect[13], "CONNECT 2400"); sprintf(modem.connect[13], "CONNECT 14400");
sprintf(modem.connect[14], "CONNECT 1200"); sprintf(modem.connect[14], "CONNECT 12000");
sprintf(modem.connect[15], "CONNECT 300"); sprintf(modem.connect[15], "CONNECT 9600");
sprintf(modem.connect[16], "CONNECT 7200");
sprintf(modem.connect[17], "CONNECT 4800");
sprintf(modem.connect[18], "CONNECT 2400");
sprintf(modem.connect[19], "CONNECT");
sprintf(modem.error[0], "BUSY"); sprintf(modem.error[0], "BUSY");
sprintf(modem.error[1], "NO CARRIER"); sprintf(modem.error[1], "NO CARRIER");
sprintf(modem.error[2], "NO DIALTONE"); sprintf(modem.error[2], "NO DIALTONE");
@ -387,7 +399,7 @@ void EditError(void)
int EditModemRec(int Area) int EditModemRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -493,7 +505,7 @@ void EditModem(void)
int records, i, x, y; int records, i, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -552,7 +564,7 @@ void EditModem(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseModem(); CloseModem(FALSE);
return; return;
} }
@ -573,12 +585,21 @@ void EditModem(void)
void InitModem(void)
{
CountModem();
OpenModem();
CloseModem(TRUE);
}
char *PickModem(char *shdr) char *PickModem(char *shdr)
{ {
int records, i, o = 0, x, y; int records, i, o = 0, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
static char buf[31]; static char buf[31];
@ -667,7 +688,7 @@ char *PickModem(char *shdr)
int modem_doc(FILE *fp, FILE *toc, int page) int modem_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *mdm; FILE *mdm;
int i, j; int i, j;

View File

@ -4,6 +4,7 @@
int CountModem(void); int CountModem(void);
void EditModem(void); void EditModem(void);
void InitModem(void);
char *PickModem(char *); char *PickModem(char *);
int modem_doc(FILE *, FILE *, int); int modem_doc(FILE *, FILE *, int);

View File

@ -2,10 +2,10 @@
* *
* File ..................: m_fnewfiles.c * File ..................: m_fnewfiles.c
* Purpose ...............: Newfiles Setup * Purpose ...............: Newfiles Setup
* Last modification date : 29-Oct-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -56,12 +56,13 @@ int NewUpdated = 0;
int CountNewfiles(void) int CountNewfiles(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/newfiles.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/newfiles.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
newfileshdr.hdrsize = sizeof(newfileshdr); newfileshdr.hdrsize = sizeof(newfileshdr);
newfileshdr.recsize = sizeof(newfiles); newfileshdr.recsize = sizeof(newfiles);
newfileshdr.grpsize = CFG.new_groups * 13; newfileshdr.grpsize = CFG.new_groups * 13;
@ -90,7 +91,7 @@ int CountNewfiles(void)
int OpenNewfiles(void) int OpenNewfiles(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
int i, old_groups; int i, old_groups;
long oldgroup; long oldgroup;
@ -113,6 +114,11 @@ int OpenNewfiles(void)
NewUpdated = 1; NewUpdated = 1;
else else
NewUpdated = 0; NewUpdated = 0;
if (oldsize != sizeof(newfiles))
Syslog('+', "Updated %s, format changed", fnin);
else if (CFG.new_groups != old_groups)
Syslog('+', "Updated %s, nr of groups now %d", fnin, CFG.new_groups);
newfileshdr.hdrsize = sizeof(newfileshdr); newfileshdr.hdrsize = sizeof(newfileshdr);
newfileshdr.recsize = sizeof(newfiles); newfileshdr.recsize = sizeof(newfiles);
newfileshdr.grpsize = CFG.new_groups * 13; newfileshdr.grpsize = CFG.new_groups * 13;
@ -156,9 +162,9 @@ int OpenNewfiles(void)
void CloseNewfiles(void) void CloseNewfiles(int force)
{ {
char fin[81], fout[81], group[13]; char fin[PATH_MAX], fout[PATH_MAX], group[13];
FILE *fi, *fo; FILE *fi, *fo;
st_list *new = NULL, *tmp; st_list *new = NULL, *tmp;
int i; int i;
@ -167,7 +173,7 @@ void CloseNewfiles(void)
sprintf(fout,"%s/etc/newfiles.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/newfiles.temp", getenv("MBSE_ROOT"));
if (NewUpdated == 1) { if (NewUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -208,7 +214,7 @@ void CloseNewfiles(void)
int AppendNewfiles(void) int AppendNewfiles(void)
{ {
FILE *fil; FILE *fil;
char ffile[81], group[13]; char ffile[PATH_MAX], group[13];
int i; int i;
sprintf(ffile, "%s/etc/newfiles.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/newfiles.temp", getenv("MBSE_ROOT"));
@ -260,7 +266,7 @@ void NewScreen(void)
int EditNewRec(int Area) int EditNewRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81], temp1[2]; char mfile[PATH_MAX], temp1[2];
long offset; long offset;
unsigned long crc, crc1; unsigned long crc, crc1;
gr_list *fgr = NULL, *tmp; gr_list *fgr = NULL, *tmp;
@ -303,7 +309,6 @@ int EditNewRec(int Area)
for (i = 0; i < groups; i++) { for (i = 0; i < groups; i++) {
fread(&group, sizeof(group), 1, fil); fread(&group, sizeof(group), 1, fil);
if (strlen(group)) { if (strlen(group)) {
Syslog('+', "New group %s", group);
for (tmp = fgr; tmp; tmp = tmp->next) for (tmp = fgr; tmp; tmp = tmp->next)
if (!strcmp(tmp->group, group)) if (!strcmp(tmp->group, group))
tmp->tagged = TRUE; tmp->tagged = TRUE;
@ -360,7 +365,6 @@ int EditNewRec(int Area)
sprintf(group, "%s", tmp->group); sprintf(group, "%s", tmp->group);
fwrite(&group, 13, 1, fil); fwrite(&group, 13, 1, fil);
} }
Syslog('+', "Written %d out of %d entries", i, groups);
memset(&group, 0, 13); memset(&group, 0, 13);
for (j = i; j < groups; j++) for (j = i; j < groups; j++)
@ -406,7 +410,7 @@ void EditNewfiles(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -469,7 +473,7 @@ void EditNewfiles(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseNewfiles(); CloseNewfiles(FALSE);
return; return;
} }
@ -498,9 +502,18 @@ void EditNewfiles(void)
void InitNewfiles(void)
{
CountNewfiles();
OpenNewfiles();
CloseNewfiles(TRUE);
}
int new_doc(FILE *fp, FILE *toc, int page) int new_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81], group[13]; char temp[PATH_MAX], group[13];
FILE *no; FILE *no;
int groups, i, j; int groups, i, j;

View File

@ -3,7 +3,10 @@
int CountNewfiles(void); int CountNewfiles(void);
int OpenNewfiles(void);
void CloseNewfiles(int);
void EditNewfiles(void); void EditNewfiles(void);
void InitNewfiles(void);
int new_doc(FILE *, FILE *, int); int new_doc(FILE *, FILE *, int);
#endif #endif

View File

@ -2,10 +2,10 @@
* *
* File ..................: setup/m_ngroups.c * File ..................: setup/m_ngroups.c
* Purpose ...............: Setup NGroups. * Purpose ...............: Setup NGroups.
* Last modification date : 28-Aug-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -53,12 +53,13 @@ int NGrpUpdated = 0;
int CountNGroup(void) int CountNGroup(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/ngroups.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/ngroups.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
ngrouphdr.hdrsize = sizeof(ngrouphdr); ngrouphdr.hdrsize = sizeof(ngrouphdr);
ngrouphdr.recsize = sizeof(ngroup); ngrouphdr.recsize = sizeof(ngroup);
fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fil); fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fil);
@ -85,10 +86,11 @@ int CountNGroup(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenNGroup(void);
int OpenNGroup(void) int OpenNGroup(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/ngroups.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/ngroups.data", getenv("MBSE_ROOT"));
@ -110,8 +112,10 @@ int OpenNGroup(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = ngrouphdr.recsize; oldsize = ngrouphdr.recsize;
if (oldsize != sizeof(ngroup)) if (oldsize != sizeof(ngroup)) {
NGrpUpdated = 1; NGrpUpdated = 1;
Syslog('+', "Upgraded %s, format changed", fnin);
}
ngrouphdr.hdrsize = sizeof(ngrouphdr); ngrouphdr.hdrsize = sizeof(ngrouphdr);
ngrouphdr.recsize = sizeof(ngroup); ngrouphdr.recsize = sizeof(ngroup);
fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fout); fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fout);
@ -138,9 +142,10 @@ int OpenNGroup(void)
void CloseNGroup(void) void CloseNGroup(int);
void CloseNGroup(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *mgr = NULL, *tmp; st_list *mgr = NULL, *tmp;
@ -148,7 +153,7 @@ void CloseNGroup(void)
sprintf(fout,"%s/etc/ngroups.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/ngroups.temp", getenv("MBSE_ROOT"));
if (NGrpUpdated == 1) { if (NGrpUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -183,7 +188,7 @@ void CloseNGroup(void)
int AppendNGroup(void) int AppendNGroup(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/ngroups.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/ngroups.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -218,7 +223,7 @@ void NgScreen(void)
int EditNGrpRec(int Area) int EditNGrpRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -292,7 +297,7 @@ void EditNGroup(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -355,7 +360,7 @@ void EditNGroup(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseNGroup(); CloseNGroup(FALSE);
return; return;
} }
@ -384,13 +389,22 @@ void EditNGroup(void)
void InitNGroup(void)
{
CountNGroup();
OpenNGroup();
CloseNGroup(TRUE);
}
char *PickNGroup(char *shdr) char *PickNGroup(char *shdr)
{ {
static char MGrp[21] = ""; static char MGrp[21] = "";
int records, i, o = 0, y, x; int records, i, o = 0, y, x;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
@ -476,7 +490,7 @@ char *PickNGroup(char *shdr)
int newf_group_doc(FILE *fp, FILE *toc, int page) int newf_group_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountNGroup(void); int CountNGroup(void);
void EditNGroup(void); void EditNGroup(void);
void InitNGroup(void);
char *PickNGroup(char *); char *PickNGroup(char *);
int newf_group_doc(FILE *, FILE *, int); int newf_group_doc(FILE *, FILE *, int);

View File

@ -2,10 +2,10 @@
* *
* File ..................: m_node.c * File ..................: m_node.c
* Purpose ...............: Nodes Setup Program * Purpose ...............: Nodes Setup Program
* Last modification date : 30-Aug-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -57,12 +57,13 @@ int CountNoderec(void);
int CountNoderec(void) int CountNoderec(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/nodes.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
nodeshdr.hdrsize = sizeof(nodeshdr); nodeshdr.hdrsize = sizeof(nodeshdr);
nodeshdr.recsize = sizeof(nodes); nodeshdr.recsize = sizeof(nodes);
nodeshdr.filegrp = CFG.tic_groups * 13; nodeshdr.filegrp = CFG.tic_groups * 13;
@ -95,7 +96,7 @@ int CountNoderec(void)
int OpenNoderec(void) int OpenNoderec(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
char group[13]; char group[13];
long oldsize; long oldsize;
int i, old_fgroups, old_mgroups; int i, old_fgroups, old_mgroups;
@ -105,7 +106,6 @@ int OpenNoderec(void)
sprintf(fnout, "%s/etc/nodes.temp", getenv("MBSE_ROOT")); sprintf(fnout, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
if ((fin = fopen(fnin, "r")) != NULL) { if ((fin = fopen(fnin, "r")) != NULL) {
if ((fout = fopen(fnout, "w")) != NULL) { if ((fout = fopen(fnout, "w")) != NULL) {
Syslog('+', "Opened nodes.data");
NodeUpdated = 0; NodeUpdated = 0;
fread(&nodeshdr, sizeof(nodeshdr), 1, fin); fread(&nodeshdr, sizeof(nodeshdr), 1, fin);
fseek(fin, 0, SEEK_SET); fseek(fin, 0, SEEK_SET);
@ -130,7 +130,12 @@ int OpenNoderec(void)
(CFG.tic_groups != old_fgroups) || (CFG.tic_groups != old_fgroups) ||
(CFG.toss_groups != old_mgroups))) { (CFG.toss_groups != old_mgroups))) {
NodeUpdated = 1; NodeUpdated = 1;
Syslog('+', "nodes.data nr of groups is changed"); if (oldsize != sizeof(nodes))
Syslog('+', "Upgraded %s, format changed", fnin);
else if (CFG.tic_groups != old_fgroups)
Syslog('+', "Upgraded %s, nr of tic groups is now %d", fnin, CFG.tic_groups);
else if (CFG.toss_groups != old_mgroups)
Syslog('+', "Upgraded %s, nr of mail groups is now %d", fnin, CFG.toss_groups);
} }
nodeshdr.hdrsize = sizeof(nodeshdr); nodeshdr.hdrsize = sizeof(nodeshdr);
nodeshdr.recsize = sizeof(nodes); nodeshdr.recsize = sizeof(nodes);
@ -192,7 +197,7 @@ int OpenNoderec(void)
void CloseNoderec(int Force) void CloseNoderec(int Force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
int i; int i;
char group[13]; char group[13];
@ -244,7 +249,7 @@ int AppendNoderec(void);
int AppendNoderec(void) int AppendNoderec(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
char group[13]; char group[13];
int i; int i;
@ -278,7 +283,7 @@ int AppendNoderec(void)
int GroupInNode(char *Group, int Mail) int GroupInNode(char *Group, int Mail)
{ {
char temp[128], group[13]; char temp[PATH_MAX], group[13];
FILE *no; FILE *no;
int i, groups, Area = 0, RetVal = 0; int i, groups, Area = 0, RetVal = 0;
@ -493,7 +498,7 @@ fidoaddr e_a(fidoaddr, int);
fidoaddr e_a(fidoaddr n, int x) fidoaddr e_a(fidoaddr n, int x)
{ {
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
int i; int i;
for (;;) { for (;;) {
@ -642,7 +647,7 @@ int EditNodeRec(int);
int EditNodeRec(int Area) int EditNodeRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
unsigned long crc, crc1; unsigned long crc, crc1;
gr_list *fgr = NULL, *egr = NULL, *tmp; gr_list *fgr = NULL, *egr = NULL, *tmp;
@ -883,7 +888,7 @@ void EditNodes(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -975,13 +980,22 @@ void EditNodes(void)
void InitNodes(void)
{
CountNoderec();
OpenNoderec();
CloseNoderec(TRUE);
}
fidoaddr PullUplink(char *Hdr) fidoaddr PullUplink(char *Hdr)
{ {
static fidoaddr uplink; static fidoaddr uplink;
int records, m, i, o, x, y; int records, m, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
memset(&uplink, 0, sizeof(uplink)); memset(&uplink, 0, sizeof(uplink));
@ -1098,7 +1112,7 @@ fidoaddr PullUplink(char *Hdr)
int node_doc(FILE *fp, FILE *toc, int page) int node_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int groups, i, First = TRUE; int groups, i, First = TRUE;
char group[13]; char group[13];

View File

@ -5,6 +5,7 @@ int OpenNoderec(void);
void CloseNoderec(int); void CloseNoderec(int);
int GroupInNode(char *, int); int GroupInNode(char *, int);
void EditNodes(void); void EditNodes(void);
void InitNodes(void);
int node_doc(FILE *, FILE *, int); int node_doc(FILE *, FILE *, int);
fidoaddr PullUplink(char *); fidoaddr PullUplink(char *);

View File

@ -2,10 +2,10 @@
* *
* File ..................: setup/m_ol.c * File ..................: setup/m_ol.c
* Purpose ...............: Setup Oneliners. * Purpose ...............: Setup Oneliners.
* Last modification date : 18-Mar-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -52,12 +52,13 @@ int OnelUpdated = 0;
int CountOneline(void) int CountOneline(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/oneline.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "created new %s", ffile);
olhdr.hdrsize = sizeof(olhdr); olhdr.hdrsize = sizeof(olhdr);
olhdr.recsize = sizeof(ol); olhdr.recsize = sizeof(ol);
fwrite(&olhdr, sizeof(olhdr), 1, fil); fwrite(&olhdr, sizeof(olhdr), 1, fil);
@ -85,10 +86,11 @@ int CountOneline(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenOneline(void);
int OpenOneline(void) int OpenOneline(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/oneline.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
@ -102,9 +104,10 @@ int OpenOneline(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = olhdr.recsize; oldsize = olhdr.recsize;
if (oldsize != sizeof(ol)) if (oldsize != sizeof(ol)) {
OnelUpdated = 1; OnelUpdated = 1;
else Syslog('+', "Upgraded %s, format changed", fnin);
} else
OnelUpdated = 0; OnelUpdated = 0;
olhdr.hdrsize = sizeof(olhdr); olhdr.hdrsize = sizeof(olhdr);
olhdr.recsize = sizeof(ol); olhdr.recsize = sizeof(ol);
@ -132,15 +135,16 @@ int OpenOneline(void)
void CloseOneline(void) void CloseOneline(int);
void CloseOneline(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
sprintf(fin, "%s/etc/oneline.data", getenv("MBSE_ROOT")); sprintf(fin, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
sprintf(fout,"%s/etc/oneline.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/oneline.temp", getenv("MBSE_ROOT"));
if (OnelUpdated == 1) { if (OnelUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
if ((rename(fout, fin)) == 0) if ((rename(fout, fin)) == 0)
unlink(fout); unlink(fout);
@ -157,7 +161,7 @@ void CloseOneline(void)
int AppendOneline(void) int AppendOneline(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/oneline.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/oneline.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -178,7 +182,7 @@ int AppendOneline(void)
int EditOnelRec(int Area) int EditOnelRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -258,7 +262,7 @@ void EditOneline(void)
int records, i, x, y, o; int records, i, x, y, o;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[121]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -321,7 +325,7 @@ void EditOneline(void)
strcpy(pick, select_record(records,20)); strcpy(pick, select_record(records,20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseOneline(); CloseOneline(FALSE);
return; return;
} }
@ -350,12 +354,21 @@ void EditOneline(void)
void InitOneline(void)
{
CountOneline();
OpenOneline();
CloseOneline(TRUE);
}
void PurgeOneline(void) void PurgeOneline(void)
{ {
FILE *pOneline, *fp; FILE *pOneline, *fp;
int recno = 0; int recno = 0;
int iCount = 0; int iCount = 0;
char sFileName[81]; char sFileName[PATH_MAX];
char temp[81]; char temp[81];
clr_index(); clr_index();
@ -416,7 +429,7 @@ void PurgeOneline(void)
void ImportOneline(void) void ImportOneline(void)
{ {
FILE *Imp, *pOneline; FILE *Imp, *pOneline;
char temp[81]; char temp[PATH_MAX];
int recno = 0; int recno = 0;
struct tm *l_date; struct tm *l_date;
char buf[12]; char buf[12];

View File

@ -6,6 +6,7 @@
int CountOneline(void); int CountOneline(void);
void EditOneline(void); void EditOneline(void);
void InitOneline(void);
void ol_menu(void); void ol_menu(void);
#endif #endif

View File

@ -2,7 +2,7 @@
* *
* File ..................: mbsetup/m_protocol.c * File ..................: mbsetup/m_protocol.c
* Purpose ...............: Setup Protocols. * Purpose ...............: Setup Protocols.
* Last modification date : 22-Jan-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -53,12 +53,13 @@ int ProtUpdated = 0;
int CountProtocol(void) int CountProtocol(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/protocol.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/protocol.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
PROThdr.hdrsize = sizeof(PROThdr); PROThdr.hdrsize = sizeof(PROThdr);
PROThdr.recsize = sizeof(PROT); PROThdr.recsize = sizeof(PROT);
fwrite(&PROThdr, sizeof(PROThdr), 1, fil); fwrite(&PROThdr, sizeof(PROThdr), 1, fil);
@ -127,10 +128,11 @@ int CountProtocol(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenProtocol(void);
int OpenProtocol(void) int OpenProtocol(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/protocol.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/protocol.data", getenv("MBSE_ROOT"));
@ -144,9 +146,10 @@ int OpenProtocol(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = PROThdr.recsize; oldsize = PROThdr.recsize;
if (oldsize != sizeof(PROT)) if (oldsize != sizeof(PROT)) {
ProtUpdated = 1; ProtUpdated = 1;
else Syslog('+', "Upgraded %s, format changed", fnin);
} else
ProtUpdated = 0; ProtUpdated = 0;
PROThdr.hdrsize = sizeof(PROThdr); PROThdr.hdrsize = sizeof(PROThdr);
PROThdr.recsize = sizeof(PROT); PROThdr.recsize = sizeof(PROT);
@ -174,9 +177,10 @@ int OpenProtocol(void)
void CloseProtocol(void) void CloseProtocol(int);
void CloseProtocol(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *pro = NULL, *tmp; st_list *pro = NULL, *tmp;
@ -184,7 +188,7 @@ void CloseProtocol(void)
sprintf(fout,"%s/etc/protocol.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/protocol.temp", getenv("MBSE_ROOT"));
if (ProtUpdated == 1) { if (ProtUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -219,7 +223,7 @@ void CloseProtocol(void)
int AppendProtocol(void) int AppendProtocol(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/protocol.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/protocol.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -262,7 +266,7 @@ void s_protrec(void)
int EditProtRec(int Area) int EditProtRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -350,7 +354,7 @@ void EditProtocol(void)
int records, i, x; int records, i, x;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -405,7 +409,7 @@ void EditProtocol(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseProtocol(); CloseProtocol(FALSE);
return; return;
} }
@ -426,13 +430,22 @@ void EditProtocol(void)
void InitProtocol(void)
{
CountProtocol();
OpenProtocol();
CloseProtocol(TRUE);
}
char *PickProtocol(int nr) char *PickProtocol(int nr)
{ {
static char Prot[21] = ""; static char Prot[21] = "";
int records, i, x; int records, i, x;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
@ -494,7 +507,7 @@ char *PickProtocol(int nr)
int bbs_prot_doc(FILE *fp, FILE *toc, int page) int bbs_prot_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountProtocol(void); int CountProtocol(void);
void EditProtocol(void); void EditProtocol(void);
void InitProtocol(void);
char *PickProtocol(int); char *PickProtocol(int);
int bbs_prot_doc(FILE *, FILE *, int); int bbs_prot_doc(FILE *, FILE *, int);

View File

@ -2,7 +2,7 @@
* *
* File ..................: m_service.c * File ..................: m_service.c
* Purpose ...............: Service Setup * Purpose ...............: Service Setup
* Last modification date : 30-Apr-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -52,12 +52,13 @@ int ServiceUpdated;
int CountService(void) int CountService(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/service.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/service.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
servhdr.hdrsize = sizeof(servhdr); servhdr.hdrsize = sizeof(servhdr);
servhdr.recsize = sizeof(servrec); servhdr.recsize = sizeof(servrec);
servhdr.lastupd = time(NULL); servhdr.lastupd = time(NULL);
@ -102,10 +103,11 @@ int CountService(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenService(void);
int OpenService(void) int OpenService(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/service.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/service.data", getenv("MBSE_ROOT"));
@ -119,9 +121,10 @@ int OpenService(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = servhdr.recsize; oldsize = servhdr.recsize;
if (oldsize != sizeof(servrec)) if (oldsize != sizeof(servrec)) {
ServiceUpdated = 1; ServiceUpdated = 1;
else Syslog('+', "Upgraded %s, format changed", fnin);
} else
ServiceUpdated = 0; ServiceUpdated = 0;
servhdr.hdrsize = sizeof(servhdr); servhdr.hdrsize = sizeof(servhdr);
servhdr.recsize = sizeof(servrec); servhdr.recsize = sizeof(servrec);
@ -148,9 +151,10 @@ int OpenService(void)
void CloseService(void) void CloseService(int);
void CloseService(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *hat = NULL, *tmp; st_list *hat = NULL, *tmp;
@ -158,7 +162,7 @@ void CloseService(void)
sprintf(fout,"%s/etc/service.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/service.temp", getenv("MBSE_ROOT"));
if (ServiceUpdated == 1) { if (ServiceUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -193,7 +197,7 @@ void CloseService(void)
int AppendService(void) int AppendService(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/service.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/service.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -231,7 +235,7 @@ void ServiceScreen(void)
int EditServiceRec(int Area) int EditServiceRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -303,7 +307,7 @@ void EditService(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -366,7 +370,7 @@ void EditService(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseService(); CloseService(FALSE);
return; return;
} }
@ -395,9 +399,18 @@ void EditService(void)
void InitService(void)
{
CountService();
OpenService();
CloseService(TRUE);
}
int service_doc(FILE *fp, FILE *toc, int page) int service_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountService(void); int CountService(void);
void EditService(void); void EditService(void);
void InitService(void);
int service_doc(FILE *, FILE *, int); int service_doc(FILE *, FILE *, int);
#endif #endif

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_task.c * File ..................: setup/m_task.c
* Purpose ...............: Setup TaskManager. * Purpose ...............: Setup TaskManager.
* Last modification date : 06-Jul-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -200,7 +200,7 @@ void task_menu(void)
int task_doc(FILE *fp, FILE *toc, int page) int task_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
sprintf(temp, "%s/etc/task.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/task.data", getenv("MBSE_ROOT"));

View File

@ -2,10 +2,10 @@
* *
* File ..................: m_ticareas.c * File ..................: m_ticareas.c
* Purpose ...............: TIC Areas Setup Program * Purpose ...............: TIC Areas Setup Program
* Last modification date : 29-Oct-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -60,13 +60,13 @@ FILE *ttfil = NULL;
int CountTicarea(void) int CountTicarea(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/tic.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/tic.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created tic.data"); Syslog('+', "Created new %s", ffile);
tichdr.hdrsize = sizeof(tichdr); tichdr.hdrsize = sizeof(tichdr);
tichdr.recsize = sizeof(tic); tichdr.recsize = sizeof(tic);
tichdr.syssize = CFG.tic_systems * sizeof(sysconnect); tichdr.syssize = CFG.tic_systems * sizeof(sysconnect);
@ -98,7 +98,7 @@ int CountTicarea(void)
int OpenTicarea(void) int OpenTicarea(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize, oldsys; long oldsize, oldsys;
struct _sysconnect syscon; struct _sysconnect syscon;
int i, oldsystems; int i, oldsystems;
@ -107,7 +107,6 @@ int OpenTicarea(void)
sprintf(fnout, "%s/etc/tic.temp", getenv("MBSE_ROOT")); sprintf(fnout, "%s/etc/tic.temp", getenv("MBSE_ROOT"));
if ((fin = fopen(fnin, "r")) != NULL) { if ((fin = fopen(fnin, "r")) != NULL) {
if ((fout = fopen(fnout, "w")) != NULL) { if ((fout = fopen(fnout, "w")) != NULL) {
Syslog('+', "Opened \"tic.data\"");
TicUpdated = 0; TicUpdated = 0;
fread(&tichdr, sizeof(tichdr), 1, fin); fread(&tichdr, sizeof(tichdr), 1, fin);
fseek(fin, 0, SEEK_SET); fseek(fin, 0, SEEK_SET);
@ -128,7 +127,10 @@ int OpenTicarea(void)
oldsystems = oldsys / sizeof(syscon); oldsystems = oldsys / sizeof(syscon);
if ((oldsize != sizeof(tic)) || (CFG.tic_systems != oldsystems)) { if ((oldsize != sizeof(tic)) || (CFG.tic_systems != oldsystems)) {
TicUpdated = 1; TicUpdated = 1;
Syslog('+', "\"tic.data\" nr of systems is changed"); if (oldsize != sizeof(tic))
Syslog('+', "Upgraded %s, format changed", fnin);
else if (CFG.tic_systems != oldsystems)
Syslog('+', "Upgraded %s, nr of systems now %d", fnin, CFG.tic_systems);
} }
tichdr.hdrsize = sizeof(tichdr); tichdr.hdrsize = sizeof(tichdr);
tichdr.recsize = sizeof(tic); tichdr.recsize = sizeof(tic);
@ -168,9 +170,6 @@ int OpenTicarea(void)
fclose(fin); fclose(fin);
fclose(fout); fclose(fout);
Syslog('+', "Opened \"tic.data\"");
if (TicUpdated)
Syslog('+', "Updated \"tic.data\" data format");
return 0; return 0;
} else } else
return -1; return -1;
@ -182,7 +181,7 @@ int OpenTicarea(void)
void CloseTicarea(int Force) void CloseTicarea(int Force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *tir = NULL, *tmp; st_list *tir = NULL, *tmp;
int i; int i;
@ -226,7 +225,6 @@ void CloseTicarea(int Force)
} }
working(1, 0, 0); working(1, 0, 0);
unlink(fout); unlink(fout);
Syslog('+', "No update of \"tic.data\"");
} }
@ -235,7 +233,7 @@ int AppendTicarea(void);
int AppendTicarea(void) int AppendTicarea(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
struct _sysconnect syscon; struct _sysconnect syscon;
int i; int i;
@ -442,7 +440,7 @@ long LoadTicRec(int, int);
long LoadTicRec(int Area, int work) long LoadTicRec(int Area, int work)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
sysconnect System; sysconnect System;
int i; int i;
@ -491,7 +489,7 @@ int SaveTicRec(int Area, int work)
int i; int i;
FILE *fil; FILE *fil;
long offset; long offset;
char mfile[81]; char mfile[PATH_MAX];
sysconnect System; sysconnect System;
if (work) if (work)
@ -548,7 +546,7 @@ void TicGlobal(void);
void TicGlobal(void) void TicGlobal(void)
{ {
gr_list *mgr = NULL, *tmp; gr_list *mgr = NULL, *tmp;
char *p, tfile[128]; char *p, tfile[PATH_MAX];
FILE *fil; FILE *fil;
fidoaddr a1, a2; fidoaddr a1, a2;
int menu = 0, areanr, Areas, akan = 0, Found; int menu = 0, areanr, Areas, akan = 0, Found;
@ -929,7 +927,7 @@ void EditTicarea(void)
int records, i, o, y; int records, i, o, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -1027,12 +1025,21 @@ Comment);
void InitTicarea(void)
{
CountTicarea();
OpenTicarea();
CloseTicarea(TRUE);
}
char *PickTicarea(char *shdr) char *PickTicarea(char *shdr)
{ {
int records, i, o = 0, x, y; int records, i, o = 0, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
static char Buf[81]; static char Buf[81];
@ -1118,7 +1125,7 @@ char *PickTicarea(char *shdr)
int GroupInTic(char *Group) int GroupInTic(char *Group)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *no; FILE *no;
int systems, Area = 0, RetVal = 0; int systems, Area = 0, RetVal = 0;
@ -1152,7 +1159,7 @@ int NodeInTic(fidoaddr A)
{ {
int i, Area = 0, RetVal = 0, systems; int i, Area = 0, RetVal = 0, systems;
FILE *no; FILE *no;
char temp[128]; char temp[PATH_MAX];
sysconnect S; sysconnect S;
sprintf(temp, "%s/etc/tic.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/tic.data", getenv("MBSE_ROOT"));
@ -1184,7 +1191,7 @@ int NodeInTic(fidoaddr A)
int tic_areas_doc(FILE *fp, FILE *toc, int page) int tic_areas_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81], status[4]; char temp[PATH_MAX], status[4];
FILE *no; FILE *no;
int i, systems, First = TRUE; int i, systems, First = TRUE;
sysconnect System; sysconnect System;

View File

@ -7,6 +7,7 @@ void CloseTicarea(int);
int NodeInTic(fidoaddr); int NodeInTic(fidoaddr);
int CountTicarea(void); int CountTicarea(void);
void EditTicarea(void); void EditTicarea(void);
void InitTicarea(void);
char *PickTicarea(char *); char *PickTicarea(char *);
int GroupInTic(char *); int GroupInTic(char *);
int tic_areas_doc(FILE *, FILE *, int); int tic_areas_doc(FILE *, FILE *, int);

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_tty.c * File ..................: setup/m_tty.c
* Purpose ...............: Setup Ttyinfo structure. * Purpose ...............: Setup Ttyinfo structure.
* Last modification date : 24-Jun-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -54,12 +54,13 @@ int TtyUpdated = 0;
int CountTtyinfo(void) int CountTtyinfo(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count, i; int count, i;
sprintf(ffile, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Creaded new %s", ffile);
ttyinfohdr.hdrsize = sizeof(ttyinfohdr); ttyinfohdr.hdrsize = sizeof(ttyinfohdr);
ttyinfohdr.recsize = sizeof(ttyinfo); ttyinfohdr.recsize = sizeof(ttyinfo);
fwrite(&ttyinfohdr, sizeof(ttyinfohdr), 1, fil); fwrite(&ttyinfohdr, sizeof(ttyinfohdr), 1, fil);
@ -101,7 +102,12 @@ int CountTtyinfo(void)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
memset(&ttyinfo, 0, sizeof(ttyinfo)); memset(&ttyinfo, 0, sizeof(ttyinfo));
sprintf(ttyinfo.comment, "ISDN line %d", i+1); sprintf(ttyinfo.comment, "ISDN line %d", i+1);
#ifdef __linux__
sprintf(ttyinfo.tty, "ttyI%d", i); sprintf(ttyinfo.tty, "ttyI%d", i);
#endif
#ifdef __FreeBSD__
sprintf(ttyinfo.tty, "cuaia%d", i);
#endif
sprintf(ttyinfo.speed, "64 kbits"); sprintf(ttyinfo.speed, "64 kbits");
sprintf(ttyinfo.flags, "XA,X75,CM"); sprintf(ttyinfo.flags, "XA,X75,CM");
ttyinfo.type = ISDN; ttyinfo.type = ISDN;
@ -115,7 +121,12 @@ int CountTtyinfo(void)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
memset(&ttyinfo, 0, sizeof(ttyinfo)); memset(&ttyinfo, 0, sizeof(ttyinfo));
sprintf(ttyinfo.comment, "Modem line %d", i+1); sprintf(ttyinfo.comment, "Modem line %d", i+1);
#ifdef __linux__
sprintf(ttyinfo.tty, "ttyS%d", i); sprintf(ttyinfo.tty, "ttyS%d", i);
#endif
#ifdef __FreeBSD__
sprintf(ttyinfo.tty, "cuaa%d", i);
#endif
sprintf(ttyinfo.speed, "33.6 kbits"); sprintf(ttyinfo.speed, "33.6 kbits");
sprintf(ttyinfo.flags, "CM,XA,V32B,V42B,V34"); sprintf(ttyinfo.flags, "CM,XA,V32B,V42B,V34");
ttyinfo.type = POTS; ttyinfo.type = POTS;
@ -148,10 +159,11 @@ int CountTtyinfo(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenTtyinfo(void);
int OpenTtyinfo(void) int OpenTtyinfo(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
@ -165,9 +177,10 @@ int OpenTtyinfo(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = ttyinfohdr.recsize; oldsize = ttyinfohdr.recsize;
if (oldsize != sizeof(ttyinfo)) if (oldsize != sizeof(ttyinfo)) {
TtyUpdated = 1; TtyUpdated = 1;
else Syslog('+', "Updated %s, format changed", fnin);
} else
TtyUpdated = 0; TtyUpdated = 0;
ttyinfohdr.hdrsize = sizeof(ttyinfohdr); ttyinfohdr.hdrsize = sizeof(ttyinfohdr);
ttyinfohdr.recsize = sizeof(ttyinfo); ttyinfohdr.recsize = sizeof(ttyinfo);
@ -195,9 +208,10 @@ int OpenTtyinfo(void)
void CloseTtyinfo(void) void CloseTtyinfo(int);
void CloseTtyinfo(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *tty = NULL, *tmp; st_list *tty = NULL, *tmp;
@ -205,7 +219,7 @@ void CloseTtyinfo(void)
sprintf(fout,"%s/etc/ttyinfo.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/ttyinfo.temp", getenv("MBSE_ROOT"));
if (TtyUpdated == 1) { if (TtyUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -240,7 +254,7 @@ void CloseTtyinfo(void)
int AppendTtyinfo(void) int AppendTtyinfo(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/ttyinfo.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/ttyinfo.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -285,7 +299,7 @@ void TtyScreen(void)
int EditTtyRec(int Area) int EditTtyRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -378,7 +392,7 @@ void EditTtyinfo(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -439,7 +453,7 @@ void EditTtyinfo(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseTtyinfo(); CloseTtyinfo(FALSE);
return; return;
} }
@ -470,9 +484,18 @@ void EditTtyinfo(void)
void InitTtyinfo(void)
{
CountTtyinfo();
OpenTtyinfo();
CloseTtyinfo(TRUE);
}
int tty_doc(FILE *fp, FILE *toc, int page) int tty_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *tty; FILE *tty;
int j; int j;

View File

@ -4,6 +4,7 @@
int CountTtyinfo(void); int CountTtyinfo(void);
void EditTtyinfo(void); void EditTtyinfo(void);
void InitTtyinfo(void);
int tty_doc(FILE *, FILE *, int); int tty_doc(FILE *, FILE *, int);
#endif #endif

View File

@ -2,10 +2,10 @@
* *
* File ..................: setup/m_users.c * File ..................: setup/m_users.c
* Purpose ...............: Edit Users * Purpose ...............: Edit Users
* Last modification date : 29-Jul-2000 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2000 * Copyright (C) 1997-2001
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -54,12 +54,13 @@ int UsrUpdated = 0;
int CountUsers(void) int CountUsers(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/users.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
usrconfighdr.hdrsize = sizeof(usrconfighdr); usrconfighdr.hdrsize = sizeof(usrconfighdr);
usrconfighdr.recsize = sizeof(usrconfig); usrconfighdr.recsize = sizeof(usrconfig);
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fil); fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fil);
@ -87,10 +88,11 @@ int CountUsers(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenUsers(void);
int OpenUsers(void) int OpenUsers(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/users.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/users.data", getenv("MBSE_ROOT"));
@ -104,9 +106,10 @@ int OpenUsers(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = usrconfighdr.recsize; oldsize = usrconfighdr.recsize;
if (oldsize != sizeof(usrconfig)) if (oldsize != sizeof(usrconfig)) {
UsrUpdated = 1; UsrUpdated = 1;
else Syslog('+', "Upgraded %s, format changed", fnin);
} else
UsrUpdated = 0; UsrUpdated = 0;
usrconfighdr.hdrsize = sizeof(usrconfighdr); usrconfighdr.hdrsize = sizeof(usrconfighdr);
usrconfighdr.recsize = sizeof(usrconfig); usrconfighdr.recsize = sizeof(usrconfig);
@ -134,15 +137,16 @@ int OpenUsers(void)
void CloseUsers(void) void CloseUsers(int);
void CloseUsers(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
sprintf(fin, "%s/etc/users.data", getenv("MBSE_ROOT")); sprintf(fin, "%s/etc/users.data", getenv("MBSE_ROOT"));
sprintf(fout,"%s/etc/users.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/users.temp", getenv("MBSE_ROOT"));
if (UsrUpdated == 1) { if (UsrUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
if ((rename(fout, fin)) == 0) if ((rename(fout, fin)) == 0)
unlink(fout); unlink(fout);
@ -159,7 +163,7 @@ void CloseUsers(void)
int AppendUsers(void) int AppendUsers(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/users.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/users.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -291,7 +295,7 @@ void Fields1(void)
int EditUsrRec(int Area) int EditUsrRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j = 0; int j = 0;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -416,7 +420,7 @@ void EditUsers(void)
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -479,7 +483,7 @@ void EditUsers(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseUsers(); CloseUsers(FALSE);
return; return;
} }
@ -507,3 +511,12 @@ void EditUsers(void)
} }
void InitUsers(void)
{
CountUsers();
OpenUsers();
CloseUsers(TRUE);
}

View File

@ -6,6 +6,7 @@
int CountUsers(void); int CountUsers(void);
void EditUsers(void); void EditUsers(void);
void InitUsers(void);
#endif #endif

View File

@ -2,7 +2,7 @@
* *
* File ..................: setup/m_virus.c * File ..................: setup/m_virus.c
* Purpose ...............: Setup Virus structure. * Purpose ...............: Setup Virus structure.
* Last modification date : 22-Jan-2001 * Last modification date : 19-Oct-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -53,33 +53,36 @@ int VirUpdated = 0;
int CountVirus(void) int CountVirus(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
int count; int count;
sprintf(ffile, "%s/etc/virscan.data", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/virscan.data", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "r")) == NULL) { if ((fil = fopen(ffile, "r")) == NULL) {
if ((fil = fopen(ffile, "a+")) != NULL) { if ((fil = fopen(ffile, "a+")) != NULL) {
Syslog('+', "Created new %s", ffile);
virscanhdr.hdrsize = sizeof(virscanhdr); virscanhdr.hdrsize = sizeof(virscanhdr);
virscanhdr.recsize = sizeof(virscan); virscanhdr.recsize = sizeof(virscan);
fwrite(&virscanhdr, sizeof(virscanhdr), 1, fil); fwrite(&virscanhdr, sizeof(virscanhdr), 1, fil);
/* /*
* Create some default records * Create some default records but don't enable them.
*/ */
memset(&virscan, 0, sizeof(virscan)); memset(&virscan, 0, sizeof(virscan));
sprintf(virscan.comment, "AntiVir/Linux Scanner"); sprintf(virscan.comment, "AntiVir/Linux Scanner");
sprintf(virscan.scanner, "/usr/bin/antivir"); sprintf(virscan.scanner, "/usr/bin/antivir");
sprintf(virscan.options, "-allfiles -s -q"); sprintf(virscan.options, "-allfiles -s -q");
virscan.available = TRUE; fwrite(&virscan, sizeof(virscan), 1, fil);
virscan.error = 0;
memset(&virscan, 0, sizeof(virscan));
sprintf(virscan.comment, "F-Prot scanner");
sprintf(virscan.scanner, "/usr/local/bin/f-prot .");
sprintf(virscan.options, "-archive -silent");
fwrite(&virscan, sizeof(virscan), 1, fil); fwrite(&virscan, sizeof(virscan), 1, fil);
memset(&virscan, 0, sizeof(virscan)); memset(&virscan, 0, sizeof(virscan));
sprintf(virscan.comment, "McAfee VirusScan for Linux"); sprintf(virscan.comment, "McAfee VirusScan for Linux");
sprintf(virscan.scanner, "/usr/local/bin/uvscan"); sprintf(virscan.scanner, "/usr/local/bin/uvscan");
sprintf(virscan.options, "--noboot --noexpire -r --secure -"); sprintf(virscan.options, "--noboot --noexpire -r --secure -");
virscan.available = TRUE;
virscan.error = 0;
fwrite(&virscan, sizeof(virscan), 1, fil); fwrite(&virscan, sizeof(virscan), 1, fil);
fclose(fil); fclose(fil);
@ -103,10 +106,11 @@ int CountVirus(void)
* is changed it will be converted on the fly. All editing must be * is changed it will be converted on the fly. All editing must be
* done on the copied file. * done on the copied file.
*/ */
int OpenVirus(void);
int OpenVirus(void) int OpenVirus(void)
{ {
FILE *fin, *fout; FILE *fin, *fout;
char fnin[81], fnout[81]; char fnin[PATH_MAX], fnout[PATH_MAX];
long oldsize; long oldsize;
sprintf(fnin, "%s/etc/virscan.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/virscan.data", getenv("MBSE_ROOT"));
@ -120,9 +124,10 @@ int OpenVirus(void)
* database must always be updated. * database must always be updated.
*/ */
oldsize = virscanhdr.recsize; oldsize = virscanhdr.recsize;
if (oldsize != sizeof(virscan)) if (oldsize != sizeof(virscan)) {
VirUpdated = 1; VirUpdated = 1;
else Syslog('+', "Upgraded %s, format changed", fnin);
} else
VirUpdated = 0; VirUpdated = 0;
virscanhdr.hdrsize = sizeof(virscanhdr); virscanhdr.hdrsize = sizeof(virscanhdr);
virscanhdr.recsize = sizeof(virscan); virscanhdr.recsize = sizeof(virscan);
@ -150,9 +155,10 @@ int OpenVirus(void)
void CloseVirus(void) void CloseVirus(int);
void CloseVirus(int force)
{ {
char fin[81], fout[81]; char fin[PATH_MAX], fout[PATH_MAX];
FILE *fi, *fo; FILE *fi, *fo;
st_list *vir = NULL, *tmp; st_list *vir = NULL, *tmp;
@ -160,7 +166,7 @@ void CloseVirus(void)
sprintf(fout,"%s/etc/virscan.temp", getenv("MBSE_ROOT")); sprintf(fout,"%s/etc/virscan.temp", getenv("MBSE_ROOT"));
if (VirUpdated == 1) { if (VirUpdated == 1) {
if (yes_no((char *)"Database is changed, save changes") == 1) { if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
working(1, 0, 0); working(1, 0, 0);
fi = fopen(fout, "r"); fi = fopen(fout, "r");
fo = fopen(fin, "w"); fo = fopen(fin, "w");
@ -195,7 +201,7 @@ void CloseVirus(void)
int AppendVirus(void) int AppendVirus(void)
{ {
FILE *fil; FILE *fil;
char ffile[81]; char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/virscan.temp", getenv("MBSE_ROOT")); sprintf(ffile, "%s/etc/virscan.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) { if ((fil = fopen(ffile, "a")) != NULL) {
@ -216,7 +222,7 @@ int AppendVirus(void)
int EditVirRec(int Area) int EditVirRec(int Area)
{ {
FILE *fil; FILE *fil;
char mfile[81]; char mfile[PATH_MAX];
long offset; long offset;
int j; int j;
unsigned long crc, crc1; unsigned long crc, crc1;
@ -301,7 +307,7 @@ void EditVirus(void)
int records, i, x, y; int records, i, x, y;
char pick[12]; char pick[12];
FILE *fil; FILE *fil;
char temp[81]; char temp[PATH_MAX];
long offset; long offset;
clr_index(); clr_index();
@ -359,7 +365,7 @@ void EditVirus(void)
strcpy(pick, select_record(records, 20)); strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) { if (strncmp(pick, "-", 1) == 0) {
CloseVirus(); CloseVirus(FALSE);
return; return;
} }
@ -379,9 +385,19 @@ void EditVirus(void)
} }
void InitVirus(void)
{
CountVirus();
OpenVirus();
CloseVirus(TRUE);
}
int virus_doc(FILE *fp, FILE *toc, int page) int virus_doc(FILE *fp, FILE *toc, int page)
{ {
char temp[81]; char temp[PATH_MAX];
FILE *vir; FILE *vir;
int j; int j;

View File

@ -6,6 +6,7 @@
int CountVirus(void); int CountVirus(void);
void EditVirus(void); void EditVirus(void);
void InitVirus(void);
int virus_doc(FILE *, FILE *, int); int virus_doc(FILE *, FILE *, int);
#endif #endif

View File

@ -42,8 +42,13 @@
#include "m_farea.h" #include "m_farea.h"
#include "m_fgroup.h" #include "m_fgroup.h"
#include "m_mail.h" #include "m_mail.h"
#include "m_mgroup.h"
#include "m_hatch.h"
#include "m_tic.h" #include "m_tic.h"
#include "m_ticarea.h"
#include "m_magic.h"
#include "m_fido.h" #include "m_fido.h"
#include "m_lang.h"
#include "m_archive.h" #include "m_archive.h"
#include "m_virus.h" #include "m_virus.h"
#include "m_tty.h" #include "m_tty.h"
@ -52,6 +57,8 @@
#include "m_node.h" #include "m_node.h"
#include "m_fdb.h" #include "m_fdb.h"
#include "m_new.h" #include "m_new.h"
#include "m_ol.h"
#include "m_protocol.h"
#include "m_ff.h" #include "m_ff.h"
#include "m_modem.h" #include "m_modem.h"
#include "m_marea.h" #include "m_marea.h"
@ -321,13 +328,34 @@ void initdatabases(void)
{ {
clr_index(); clr_index();
working(1, 0, 0); working(1, 0, 0);
set_color(WHITE, BLACK);
mvprintw( 5, 6, " INIT DATABASES");
IsDoing("Init Databases"); IsDoing("Init Databases");
config_read();
InitArchive(); InitArchive();
InitDomain(); InitDomain();
InitFilearea(); InitFilearea();
InitFilefind(); InitFilefind();
InitFGroup(); InitFGroup();
InitFidonetdb();
InitHatch();
InitLanguage();
InitLimits();
InitMagics();
InitMsgarea();
InitMGroup();
InitModem();
InitNewfiles();
InitNGroup();
InitNodes();
InitOneline();
InitProtocol();
InitService();
InitTicarea();
InitTtyinfo();
InitUsers();
InitVirus();
working(0, 0, 0); working(0, 0, 0);
clr_index(); clr_index();