upgrade mbsetup for database init
This commit is contained in:
parent
ab79ef6069
commit
c5500c65fe
@ -2,7 +2,7 @@
|
||||
*
|
||||
* File ..................: setup/m_archive.c
|
||||
* Purpose ...............: Setup Archive structure.
|
||||
* Last modification date : 22-Jan-2001
|
||||
* Last modification date : 19-Oct-2001
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
@ -53,12 +53,13 @@ int ArchUpdated = 0;
|
||||
int CountArchive(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
archiverhdr.hdrsize = sizeof(archiverhdr);
|
||||
archiverhdr.recsize = sizeof(archiver);
|
||||
fwrite(&archiverhdr, sizeof(archiverhdr), 1, fil);
|
||||
@ -168,10 +169,11 @@ int CountArchive(void)
|
||||
* is changed it will be converted on the fly. All editing must be
|
||||
* done on the copied file.
|
||||
*/
|
||||
int OpenArchive(void);
|
||||
int OpenArchive(void)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char fnin[81], fnout[81];
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
||||
@ -185,9 +187,10 @@ int OpenArchive(void)
|
||||
* database must always be updated.
|
||||
*/
|
||||
oldsize = archiverhdr.recsize;
|
||||
if (oldsize != sizeof(archiver))
|
||||
if (oldsize != sizeof(archiver)) {
|
||||
ArchUpdated = 1;
|
||||
else
|
||||
Syslog('+', "Format of %s changed, updateing", fnin);
|
||||
} else
|
||||
ArchUpdated = 0;
|
||||
archiverhdr.hdrsize = sizeof(archiverhdr);
|
||||
archiverhdr.recsize = sizeof(archiver);
|
||||
@ -215,9 +218,10 @@ int OpenArchive(void)
|
||||
|
||||
|
||||
|
||||
void CloseArchive(void)
|
||||
void CloseArchive(int);
|
||||
void CloseArchive(int force)
|
||||
{
|
||||
char fin[81], fout[81];
|
||||
char fin[PATH_MAX], fout[PATH_MAX];
|
||||
FILE *fi, *fo;
|
||||
st_list *arc = NULL, *tmp;
|
||||
|
||||
@ -225,7 +229,7 @@ void CloseArchive(void)
|
||||
sprintf(fout,"%s/etc/archiver.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (ArchUpdated == 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);
|
||||
fi = fopen(fout, "r");
|
||||
fo = fopen(fin, "w");
|
||||
@ -260,7 +264,7 @@ void CloseArchive(void)
|
||||
int AppendArchive(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/archiver.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
@ -281,7 +285,7 @@ int AppendArchive(void)
|
||||
int EditArchRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[81];
|
||||
char mfile[PATH_MAX];
|
||||
long offset;
|
||||
int j;
|
||||
unsigned long crc, crc1;
|
||||
@ -382,7 +386,7 @@ void EditArchive(void)
|
||||
int records, i, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
clr_index();
|
||||
@ -441,7 +445,7 @@ void EditArchive(void)
|
||||
strcpy(pick, select_record(records, 20));
|
||||
|
||||
if (strncmp(pick, "-", 1) == 0) {
|
||||
CloseArchive();
|
||||
CloseArchive(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -462,13 +466,22 @@ void EditArchive(void)
|
||||
|
||||
|
||||
|
||||
void InitArchive(void)
|
||||
{
|
||||
CountArchive();
|
||||
OpenArchive();
|
||||
CloseArchive(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *PickArchive(char *shdr)
|
||||
{
|
||||
static char Arch[6] = "";
|
||||
int records, i, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
|
||||
@ -533,7 +546,7 @@ char *PickArchive(char *shdr)
|
||||
|
||||
int archive_doc(FILE *fp, FILE *toc, int page)
|
||||
{
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
FILE *arch;
|
||||
int j;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
int CountArchive(void);
|
||||
void EditArchive(void);
|
||||
char *PickArchive(char *);
|
||||
void InitArchive(void);
|
||||
int archive_doc(FILE *, FILE *, int);
|
||||
|
||||
#endif
|
||||
|
@ -2,10 +2,10 @@
|
||||
*
|
||||
* File ..................: m_domain.c
|
||||
* Purpose ...............: Domain Setup
|
||||
* Last modification date : 23-Aug-2000
|
||||
* Last modification date : 19-Oct-2001
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2000
|
||||
* Copyright (C) 1997-2001
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -52,12 +52,13 @@ int DomainUpdated;
|
||||
int CountDomain(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/domain.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
domainhdr.hdrsize = sizeof(domainhdr);
|
||||
domainhdr.recsize = sizeof(domtrans);
|
||||
domainhdr.lastupd = time(NULL);
|
||||
@ -106,10 +107,11 @@ int CountDomain(void)
|
||||
* is changed it will be converted on the fly. All editing must be
|
||||
* done on the copied file.
|
||||
*/
|
||||
int OpenDomain(void);
|
||||
int OpenDomain(void)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char fnin[81], fnout[81];
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/domain.data", getenv("MBSE_ROOT"));
|
||||
@ -123,9 +125,10 @@ int OpenDomain(void)
|
||||
* database must always be updated.
|
||||
*/
|
||||
oldsize = domainhdr.recsize;
|
||||
if (oldsize != sizeof(domtrans))
|
||||
if (oldsize != sizeof(domtrans)) {
|
||||
DomainUpdated = 1;
|
||||
else
|
||||
Syslog('+', "Updated %s to new format", fnin);
|
||||
} else
|
||||
DomainUpdated = 0;
|
||||
domainhdr.hdrsize = sizeof(domainhdr);
|
||||
domainhdr.recsize = sizeof(domtrans);
|
||||
@ -152,16 +155,17 @@ int OpenDomain(void)
|
||||
|
||||
|
||||
|
||||
void CloseDomain(void)
|
||||
void CloseDomain(int);
|
||||
void CloseDomain(int force)
|
||||
{
|
||||
char fin[81], fout[81];
|
||||
char fin[PATH_MAX], fout[PATH_MAX];
|
||||
FILE *fi, *fo;
|
||||
|
||||
sprintf(fin, "%s/etc/domain.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/domain.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (DomainUpdated == 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);
|
||||
fi = fopen(fout, "r");
|
||||
fo = fopen(fin, "w");
|
||||
@ -189,7 +193,7 @@ void CloseDomain(void)
|
||||
int AppendDomain(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/domain.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
@ -227,7 +231,7 @@ void DomainScreen(void)
|
||||
int EditDomainRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[81];
|
||||
char mfile[PATH_MAX];
|
||||
long offset;
|
||||
unsigned long crc, crc1;
|
||||
|
||||
@ -298,7 +302,7 @@ void EditDomain(void)
|
||||
int records, i, o, y, from, too;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
struct domrec tdomtrans;
|
||||
|
||||
@ -359,7 +363,7 @@ void EditDomain(void)
|
||||
strcpy(pick, select_menurec(records));
|
||||
|
||||
if (strncmp(pick, "-", 1) == 0) {
|
||||
CloseDomain();
|
||||
CloseDomain(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -445,9 +449,18 @@ void EditDomain(void)
|
||||
|
||||
|
||||
|
||||
void InitDomain(void)
|
||||
{
|
||||
CountDomain();
|
||||
OpenDomain();
|
||||
CloseDomain(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int domain_doc(FILE *fp, FILE *toc, int page)
|
||||
{
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
FILE *no;
|
||||
int j;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
int CountDomain(void);
|
||||
void EditDomain(void);
|
||||
void InitDomain(void);
|
||||
int domain_doc(FILE *, FILE *, int);
|
||||
|
||||
#endif
|
||||
|
@ -2,10 +2,10 @@
|
||||
*
|
||||
* File ..................: m_farea.c
|
||||
* Purpose ...............: File Setup Program
|
||||
* Last modification date : 28-Mar-2000
|
||||
* Last modification date : 19-Oct-2001
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2000
|
||||
* Copyright (C) 1997-2001
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -55,12 +55,13 @@ int FileUpdated = 0;
|
||||
int CountFilearea(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
areahdr.hdrsize = sizeof(areahdr);
|
||||
areahdr.recsize = sizeof(area);
|
||||
fwrite(&areahdr, sizeof(areahdr), 1, fil);
|
||||
@ -88,7 +89,7 @@ int CountFilearea(void)
|
||||
int OpenFilearea(void)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char fnin[81], fnout[81];
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||
@ -102,9 +103,10 @@ int OpenFilearea(void)
|
||||
* database must always be updated.
|
||||
*/
|
||||
oldsize = areahdr.recsize;
|
||||
if (oldsize != sizeof(area))
|
||||
if (oldsize != sizeof(area)) {
|
||||
FileUpdated = 1;
|
||||
else
|
||||
Syslog('+', "Updated %s to new format", fnin);
|
||||
} else
|
||||
FileUpdated = 0;
|
||||
areahdr.hdrsize = sizeof(areahdr);
|
||||
areahdr.recsize = sizeof(area);
|
||||
@ -131,15 +133,16 @@ int OpenFilearea(void)
|
||||
|
||||
|
||||
|
||||
void CloseFilearea(void)
|
||||
void CloseFilearea(int);
|
||||
void CloseFilearea(int force)
|
||||
{
|
||||
char fin[81], fout[81];
|
||||
char fin[PATH_MAX], fout[PATH_MAX];
|
||||
|
||||
sprintf(fin, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/fareas.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (FileUpdated == 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);
|
||||
if ((rename(fout, fin)) == 0)
|
||||
unlink(fout);
|
||||
@ -156,7 +159,7 @@ void CloseFilearea(void)
|
||||
int AppendFilearea(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/fareas.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
@ -223,7 +226,7 @@ void FileScreen(void)
|
||||
int EditFileRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[81];
|
||||
char mfile[PATH_MAX];
|
||||
long offset;
|
||||
unsigned long crc, crc1;
|
||||
|
||||
@ -345,7 +348,7 @@ void EditFilearea(void)
|
||||
int records, i, o, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
clr_index();
|
||||
@ -408,7 +411,7 @@ void EditFilearea(void)
|
||||
strcpy(pick, select_record(records, 20));
|
||||
|
||||
if (strncmp(pick, "-", 1) == 0) {
|
||||
CloseFilearea();
|
||||
CloseFilearea(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -442,7 +445,7 @@ long PickFilearea(char *shdr)
|
||||
int records, i, o = 0, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
clr_index();
|
||||
@ -526,9 +529,18 @@ long PickFilearea(char *shdr)
|
||||
|
||||
|
||||
|
||||
void InitFilearea(void)
|
||||
{
|
||||
CountFilearea();
|
||||
OpenFilearea();
|
||||
CloseFilearea(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int bbs_file_doc(FILE *fp, FILE *toc, int page)
|
||||
{
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
FILE *no;
|
||||
int i = 0, j = 0;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
int CountFilearea(void);
|
||||
void EditFilearea(void);
|
||||
long PickFilearea(char *);
|
||||
void InitFilearea(void);
|
||||
int bbs_file_doc(FILE *, FILE *, int);
|
||||
|
||||
#endif
|
||||
|
@ -2,10 +2,10 @@
|
||||
*
|
||||
* File ..................: setup/m_fdb.c
|
||||
* Purpose ...............: Edit Files DataBase.
|
||||
* Last modification date : 18-Mar-2000
|
||||
* Last modification date : 19-Oct-2001
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2000
|
||||
* Copyright (C) 1999-2001
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -120,7 +120,7 @@ void EditFile()
|
||||
void E_F(long areanr)
|
||||
{
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
int i, y, o, records, Ondisk;
|
||||
char help[81];
|
||||
static char *menu = (char *)"0";
|
||||
|
@ -2,10 +2,10 @@
|
||||
*
|
||||
* File ..................: m_ff.c
|
||||
* Purpose ...............: Filefind 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
|
||||
* Beekmansbos 10
|
||||
@ -54,12 +54,13 @@ int FilefindUpdated = 0;
|
||||
int CountFilefind(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/scanmgr.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
scanmgrhdr.hdrsize = sizeof(scanmgrhdr);
|
||||
scanmgrhdr.recsize = sizeof(scanmgr);
|
||||
fwrite(&scanmgrhdr, sizeof(scanmgrhdr), 1, fil);
|
||||
@ -84,10 +85,11 @@ int CountFilefind(void)
|
||||
* is changed it will be converted on the fly. All editing must be
|
||||
* done on the copied file.
|
||||
*/
|
||||
int OpenFilefind(void);
|
||||
int OpenFilefind(void)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char fnin[81], fnout[81];
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/scanmgr.data", getenv("MBSE_ROOT"));
|
||||
@ -101,9 +103,10 @@ int OpenFilefind(void)
|
||||
* database must always be updated.
|
||||
*/
|
||||
oldsize = scanmgrhdr.recsize;
|
||||
if (oldsize != sizeof(scanmgr))
|
||||
if (oldsize != sizeof(scanmgr)) {
|
||||
FilefindUpdated = 1;
|
||||
else
|
||||
Syslog('+', "Updated %s to new format", fnin);
|
||||
} else
|
||||
FilefindUpdated = 0;
|
||||
scanmgrhdr.hdrsize = sizeof(scanmgrhdr);
|
||||
scanmgrhdr.recsize = sizeof(scanmgr);
|
||||
@ -130,9 +133,10 @@ int OpenFilefind(void)
|
||||
|
||||
|
||||
|
||||
void CloseFilefind(void)
|
||||
void CloseFilefind(int);
|
||||
void CloseFilefind(int force)
|
||||
{
|
||||
char fin[81], fout[81];
|
||||
char fin[PATH_MAX], fout[PATH_MAX];
|
||||
FILE *fi, *fo;
|
||||
st_list *fff = NULL, *tmp;
|
||||
|
||||
@ -140,7 +144,7 @@ void CloseFilefind(void)
|
||||
sprintf(fout,"%s/etc/scanmgr.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (FilefindUpdated == 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);
|
||||
fi = fopen(fout, "r");
|
||||
fo = fopen(fin, "w");
|
||||
@ -175,7 +179,7 @@ void CloseFilefind(void)
|
||||
int AppendFilefind(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/scanmgr.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
@ -220,7 +224,7 @@ void FFScreen(void)
|
||||
int EditFfRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[81], temp1[2];
|
||||
char mfile[PATH_MAX], temp1[2];
|
||||
long offset;
|
||||
unsigned long crc, crc1;
|
||||
int i;
|
||||
@ -313,7 +317,7 @@ void EditFilefind(void)
|
||||
int records, i, o, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
clr_index();
|
||||
@ -376,7 +380,7 @@ void EditFilefind(void)
|
||||
strcpy(pick, select_record(records, 20));
|
||||
|
||||
if (strncmp(pick, "-", 1) == 0) {
|
||||
CloseFilefind();
|
||||
CloseFilefind(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -405,9 +409,18 @@ void EditFilefind(void)
|
||||
|
||||
|
||||
|
||||
void InitFilefind(void)
|
||||
{
|
||||
CountFilefind();
|
||||
OpenFilefind();
|
||||
CloseFilefind(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ff_doc(FILE *fp, FILE *toc, int page)
|
||||
{
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
FILE *no;
|
||||
int j;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
int CountFilefind(void);
|
||||
void EditFilefind(void);
|
||||
void InitFilefind(void);
|
||||
int ff_doc(FILE *, FILE *, int);
|
||||
|
||||
#endif
|
||||
|
@ -2,10 +2,10 @@
|
||||
*
|
||||
* File ..................: setup/m_fgroups.c
|
||||
* Purpose ...............: Setup FGroups.
|
||||
* 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
|
||||
* Beekmansbos 10
|
||||
@ -55,12 +55,13 @@ int FGrpUpdated = 0;
|
||||
int CountFGroup(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
fgrouphdr.hdrsize = sizeof(fgrouphdr);
|
||||
fgrouphdr.recsize = sizeof(fgroup);
|
||||
fwrite(&fgrouphdr, sizeof(fgrouphdr), 1, fil);
|
||||
@ -87,10 +88,11 @@ int CountFGroup(void)
|
||||
* is changed it will be converted on the fly. All editing must be
|
||||
* done on the copied file.
|
||||
*/
|
||||
int OpenFGroup(void);
|
||||
int OpenFGroup(void)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char fnin[81], fnout[81];
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
|
||||
@ -113,12 +115,15 @@ int OpenFGroup(void)
|
||||
* database must always be updated.
|
||||
*/
|
||||
oldsize = fgrouphdr.recsize;
|
||||
if (oldsize != sizeof(fgroup))
|
||||
if (oldsize != sizeof(fgroup))
|
||||
FGrpUpdated = 1;
|
||||
fgrouphdr.hdrsize = sizeof(fgrouphdr);
|
||||
fgrouphdr.recsize = sizeof(fgroup);
|
||||
fwrite(&fgrouphdr, sizeof(fgrouphdr), 1, fout);
|
||||
|
||||
if (FGrpUpdated)
|
||||
Syslog('+', "Updated %s, format changed", fnin);
|
||||
|
||||
/*
|
||||
* The datarecord is filled with zero's before each
|
||||
* read, so if the format changed, the new fields
|
||||
@ -141,9 +146,10 @@ int OpenFGroup(void)
|
||||
|
||||
|
||||
|
||||
void CloseFGroup(void)
|
||||
void CloseFGroup(int);
|
||||
void CloseFGroup(int force)
|
||||
{
|
||||
char fin[81], fout[81];
|
||||
char fin[PATH_MAX], fout[PATH_MAX];
|
||||
FILE *fi, *fo;
|
||||
st_list *fgr = NULL, *tmp;
|
||||
|
||||
@ -151,7 +157,7 @@ void CloseFGroup(void)
|
||||
sprintf(fout,"%s/etc/fgroups.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (FGrpUpdated == 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);
|
||||
fi = fopen(fout, "r");
|
||||
fo = fopen(fin, "w");
|
||||
@ -186,7 +192,7 @@ void CloseFGroup(void)
|
||||
int AppendFGroup(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[81];
|
||||
char ffile[PATH_MAX];
|
||||
|
||||
sprintf(ffile, "%s/etc/fgroups.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||
@ -251,7 +257,7 @@ void FgScreen(void)
|
||||
int EditFGrpRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[81];
|
||||
char mfile[PATH_MAX];
|
||||
long offset;
|
||||
int j, tmp;
|
||||
unsigned long crc, crc1;
|
||||
@ -352,7 +358,7 @@ void EditFGroup(void)
|
||||
int records, i, o, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
clr_index();
|
||||
@ -415,7 +421,7 @@ void EditFGroup(void)
|
||||
strcpy(pick, select_record(records, 20));
|
||||
|
||||
if (strncmp(pick, "-", 1) == 0) {
|
||||
CloseFGroup();
|
||||
CloseFGroup(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -444,13 +450,22 @@ void EditFGroup(void)
|
||||
|
||||
|
||||
|
||||
void InitFGroup(void)
|
||||
{
|
||||
CountFGroup();
|
||||
OpenFGroup();
|
||||
CloseFGroup(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *PickFGroup(char *shdr)
|
||||
{
|
||||
static char FGrp[21] = "";
|
||||
int records, i, o = 0, x, y;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
|
||||
@ -537,7 +552,7 @@ char *PickFGroup(char *shdr)
|
||||
|
||||
int tic_group_doc(FILE *fp, FILE *toc, int page)
|
||||
{
|
||||
char temp[81];
|
||||
char temp[PATH_MAX];
|
||||
FILE *no;
|
||||
int j;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
int CountFGroup(void);
|
||||
void EditFGroup(void);
|
||||
char *PickFGroup(char *);
|
||||
void InitFGroup(void);
|
||||
int tic_group_doc(FILE *, FILE *, int);
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* File ..................: mbsetup.c
|
||||
* Purpose ...............: Setup Program
|
||||
* Last modification date : 24-Jun-2001
|
||||
* Last modification date : 19-Oct-2001
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
@ -39,6 +39,8 @@
|
||||
#include "ledit.h"
|
||||
#include "m_global.h"
|
||||
#include "m_bbs.h"
|
||||
#include "m_farea.h"
|
||||
#include "m_fgroup.h"
|
||||
#include "m_mail.h"
|
||||
#include "m_tic.h"
|
||||
#include "m_fido.h"
|
||||
@ -156,7 +158,7 @@ void site_docs(void);
|
||||
void site_docs(void)
|
||||
{
|
||||
FILE *fp, *toc;
|
||||
char temp[81], temp1[81];
|
||||
char temp[PATH_MAX], temp1[PATH_MAX];
|
||||
int page = 0, line = 0;
|
||||
|
||||
if (config_read() == -1)
|
||||
@ -315,6 +317,24 @@ void site_docs(void)
|
||||
|
||||
|
||||
|
||||
void initdatabases(void)
|
||||
{
|
||||
clr_index();
|
||||
working(1, 0, 0);
|
||||
IsDoing("Init Databases");
|
||||
|
||||
InitArchive();
|
||||
InitDomain();
|
||||
InitFilearea();
|
||||
InitFilefind();
|
||||
InitFGroup();
|
||||
|
||||
working(0, 0, 0);
|
||||
clr_index();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int loop = 1;
|
||||
@ -351,7 +371,8 @@ int main(int argc, char *argv[])
|
||||
do_quiet = TRUE;
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBSETUP v%s started by %s", VERSION, pw->pw_name);
|
||||
|
||||
initdatabases();
|
||||
|
||||
do {
|
||||
IsDoing("Browsing Menu");
|
||||
clr_index();
|
||||
|
Reference in New Issue
Block a user