2000-02-25 10:15:17 +00:00
|
|
|
// This may look like C code, but it is really -*- C++ -*-
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// The Goldware Library
|
|
|
|
// Copyright (C) 1990-1999 Odinn Sorensen
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library 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
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this program; if not, write to the Free
|
|
|
|
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
// MA 02111-1307, USA
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// $Id$
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Read areas from ProBoard.
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <gmemdbg.h>
|
2000-08-23 19:24:19 +00:00
|
|
|
#undef GCFG_NOPROBOARD
|
2000-02-25 10:15:17 +00:00
|
|
|
#include <gedacfg.h>
|
|
|
|
#include <gs_pb200.h>
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void gareafile::ReadProBoard(char* tag) {
|
|
|
|
|
|
|
|
FILE* fp;
|
|
|
|
AreaCfg aa;
|
|
|
|
char options[80];
|
|
|
|
Path file, path;
|
|
|
|
|
|
|
|
*path = NUL;
|
|
|
|
strcpy(options, tag);
|
|
|
|
char* ptr = strtok(tag, " \t");
|
|
|
|
while(ptr) {
|
|
|
|
if(*ptr != '-') {
|
|
|
|
AddBackslash(strcpy(path, ptr));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ptr = strtok(NULL, " \t");
|
|
|
|
}
|
|
|
|
if(*path == NUL) {
|
|
|
|
ptr = getenv("PB");
|
|
|
|
if(ptr)
|
|
|
|
AddBackslash(strcpy(path, ptr));
|
|
|
|
}
|
|
|
|
if(*path == NUL)
|
|
|
|
strcpy(path, areapath);
|
|
|
|
|
|
|
|
Config* cfg = (Config*)throw_calloc(1, sizeof(Config));
|
|
|
|
MakePathname(file, path, "config.pro");
|
|
|
|
fp = fsopen(file, "rb", sharemode);
|
|
|
|
if(fp) {
|
|
|
|
|
|
|
|
if(not quiet)
|
2001-07-16 20:35:42 +00:00
|
|
|
std::cout << "* Reading " << file << std::endl;
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
fread(cfg, sizeof(Config), 1, fp);
|
|
|
|
|
2001-05-05 21:41:41 +00:00
|
|
|
CfgHudsonpath(cfg->msgpath);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
MakePathname(file, path, "aka.pro");
|
|
|
|
uint akasz = (uint)GetFilesize(file);
|
|
|
|
ftn_addr* aka = (ftn_addr*)throw_calloc(1, akasz+sizeof(ftn_addr));
|
|
|
|
fp = fsopen(file, "rb", sharemode);
|
|
|
|
if(fp) {
|
|
|
|
|
|
|
|
if(not quiet)
|
2001-07-16 20:35:42 +00:00
|
|
|
std::cout << "* Reading " << file << std::endl;
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
fread(aka, akasz, 1, fp);
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
MsgAreas* area = (MsgAreas*)throw_calloc(1, sizeof(MsgAreas));
|
|
|
|
MakePathname(file, path, "msgareas.pb");
|
|
|
|
fp = fsopen(file, "rb", sharemode);
|
|
|
|
if(fp) {
|
|
|
|
|
|
|
|
setvbuf(fp, NULL, _IOFBF, 8192);
|
|
|
|
|
|
|
|
if(not quiet)
|
2001-07-16 20:35:42 +00:00
|
|
|
std::cout << "* Reading " << file << std::endl;
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
while(fread(area, sizeof(MsgAreas), 1, fp) == 1) {
|
|
|
|
aa.reset();
|
|
|
|
switch(area->msgkind) {
|
|
|
|
case MSGKIND_LOCAL:
|
|
|
|
aa.type = GMB_LOCAL;
|
|
|
|
aa.attr = attribslocal;
|
|
|
|
break;
|
|
|
|
case MSGKIND_NET:
|
|
|
|
aa.type = GMB_NET;
|
|
|
|
aa.attr = attribsnet;
|
|
|
|
break;
|
|
|
|
case MSGKIND_ECHO:
|
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.attr = attribsecho;
|
|
|
|
break;
|
|
|
|
case MSGKIND_PVTECHO:
|
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.attr = attribsecho;
|
|
|
|
aa.attr.pvt1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(area->msgtype == MSGTYPE_PVT)
|
|
|
|
aa.attr.pvt1();
|
|
|
|
switch(area->msgbasetype) {
|
|
|
|
case MSGBASE_HUDSON:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "HUDSON";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.board = area->areanum;
|
|
|
|
break;
|
|
|
|
case MSGBASE_SQUISH:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SQUISH";
|
2001-05-05 21:41:41 +00:00
|
|
|
aa.setpath(area->path);
|
2000-02-25 10:15:17 +00:00
|
|
|
break;
|
|
|
|
case MSGBASE_SDM:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2001-05-05 21:41:41 +00:00
|
|
|
aa.setpath(area->path);
|
2000-02-25 10:15:17 +00:00
|
|
|
break;
|
|
|
|
case MSGBASE_JAM:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "JAM";
|
2001-05-05 21:41:41 +00:00
|
|
|
aa.setpath(area->path);
|
2000-02-25 10:15:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
aa.aka = aka[area->aka];
|
|
|
|
aa.setdesc(area->name);
|
|
|
|
aa.setechoid(area->echotag);
|
|
|
|
aa.setorigin(area->origin);
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
throw_free(area);
|
|
|
|
throw_free(aka);
|
|
|
|
throw_free(cfg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|