2001-08-17 05:46:24 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
2002-01-07 19:16:03 +00:00
|
|
|
* $Id$
|
2001-08-17 05:46:24 +00:00
|
|
|
* Purpose ...............: Config Database.
|
|
|
|
*
|
|
|
|
*****************************************************************************
|
2005-08-28 10:30:41 +00:00
|
|
|
* Copyright (C) 1997-2005
|
2001-08-17 05:46:24 +00:00
|
|
|
*
|
|
|
|
* Michiel Broek FIDO: 2:280/2802
|
|
|
|
* Beekmansbos 10
|
|
|
|
* 1971 BV IJmuiden
|
|
|
|
* the Netherlands
|
|
|
|
*
|
|
|
|
* This file is part of MBSE BBS.
|
|
|
|
*
|
|
|
|
* This BBS is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
2003-08-15 20:05:34 +00:00
|
|
|
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
2001-08-17 05:46:24 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2002-06-30 12:48:44 +00:00
|
|
|
#include "../config.h"
|
2004-02-21 14:24:03 +00:00
|
|
|
#include "mbselib.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
#include "mbse.h"
|
2002-01-07 19:16:03 +00:00
|
|
|
#include "users.h"
|
2004-02-21 14:24:03 +00:00
|
|
|
#include "mbsedb.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InitConfig(void)
|
|
|
|
{
|
|
|
|
if ((getenv("MBSE_ROOT")) == NULL) {
|
|
|
|
printf("Could not get MBSE_ROOT environment variable\n");
|
|
|
|
printf("Please set the environment variable ie:\n");
|
|
|
|
printf("\"MBSE_ROOT=/opt/mbse;export MBSE_ROOT\"\n\n");
|
2002-10-20 20:58:55 +00:00
|
|
|
exit(MBERR_INIT_ERROR);
|
2001-08-17 05:46:24 +00:00
|
|
|
}
|
|
|
|
LoadConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LoadConfig(void)
|
|
|
|
{
|
|
|
|
FILE *pDataFile;
|
|
|
|
char *FileName;
|
|
|
|
|
|
|
|
FileName = calloc(PATH_MAX, sizeof(char));
|
2005-08-28 10:30:41 +00:00
|
|
|
snprintf(FileName, PATH_MAX -1, "%s/etc/config.data", getenv("MBSE_ROOT"));
|
2001-08-17 05:46:24 +00:00
|
|
|
if ((pDataFile = fopen(FileName, "r")) == NULL) {
|
|
|
|
perror("\n\nFATAL ERROR:");
|
|
|
|
printf(" Can't open %s\n", FileName);
|
|
|
|
printf("Please run mbsetup to create configuration file.\n");
|
|
|
|
printf("Or check that your MBSE_ROOT variable is set to the BBS path!\n\n");
|
|
|
|
free(FileName);
|
2002-10-20 20:58:55 +00:00
|
|
|
exit(MBERR_CONFIG_ERROR);
|
2001-08-17 05:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
free(FileName);
|
|
|
|
fread(&CFG, sizeof(CFG), 1, pDataFile);
|
|
|
|
fclose(pDataFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int IsOurAka(fidoaddr taka)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 40; i++) {
|
|
|
|
if ((taka.zone == CFG.aka[i].zone) &&
|
|
|
|
(taka.net == CFG.aka[i].net) &&
|
|
|
|
(taka.node == CFG.aka[i].node) &&
|
|
|
|
(taka.point == CFG.aka[i].point) &&
|
|
|
|
(CFG.akavalid[i]))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|