Skip to content
Snippets Groups Projects
Commit e9fbcb44 authored by rswindell's avatar rswindell
Browse files

Ported from Borland/Watcom C++ to MSVC.

parent 6e6f48b9
No related branches found
No related tags found
No related merge requests found
/* rechocfg.C */
/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
/* Portions written by Allen Christiansen 1994-1996 */
#ifdef _WIN32
#include <windows.h>
#endif
#include <dos.h>
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <fcntl.h>
#include <share.h>
#include <malloc.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <sys\stat.h>
#include "crc32.h"
#include "sbbsdefs.h"
#include "sbbsecho.h"
#include "smbwrap.h" /* O_DENYNONE */
#ifdef __WATCOMC__
#include <mem.h>
#define O_DENYNONE SH_DENYNO
#endif
#ifdef __MSDOS__
extern uchar node_swap;
#endif
extern long misc;
extern config_t cfg;
/****************************************************************************/
/* Network open function. Opens all files DENYALL and retries LOOP_NOPEN */
/* number of times if the attempted file is already open or denying access */
/* for some other reason. All files are opened in BINARY mode. */
/****************************************************************************/
int nopen(char *str, int access)
{
int file,share,count=0;
if(access&O_DENYNONE) {
access&=~O_DENYNONE;
share=SH_DENYNO; }
else if(access==O_RDONLY) share=SH_DENYWR;
else share=SH_DENYRW;
while(((file=sopen(str,O_BINARY|access,share))==-1)
&& errno==EACCES && count++<LOOP_NOPEN);
if(file==-1 && errno==EACCES)
printf("\7\nNOPEN: ACCESS DENIED\n\7");
return(file);
}
/****************************************************************************/
/* This function performs an nopen, but returns a file stream with a buffer */
/* allocated. */
/****************************************************************************/
FILE *fnopen(int *file, char *str, int access)
{
char mode[128];
FILE *stream;
if(access&O_WRONLY) {
access&=~O_WRONLY;
access|=O_RDWR; } /* fdopen can't open WRONLY */
if(((*file)=nopen(str,access))==-1)
return(NULL);
if(access&O_APPEND) {
if(access&(O_RDONLY|O_RDWR))
strcpy(mode,"a+");
else
strcpy(mode,"a"); }
else {
if(access&(O_WRONLY|O_RDWR))
strcpy(mode,"r+");
else
strcpy(mode,"r"); }
stream=fdopen((*file),mode);
if(stream==NULL) {
printf("\7\nFDOPEN(%s) FAILED\n",mode);
close(*file);
return(NULL); }
setvbuf(stream,NULL,_IOFBF,16*1024);
return(stream);
}
/******************************************************************************
Here we take a string and put a terminator in place of the first TAB or SPACE
******************************************************************************/
char *cleanstr(char *instr)
{
int i;
for(i=0;instr[i];i++)
if((uchar)instr[i]<=SP)
break;
instr[i]=0;
return(instr);
}
/****************************************************************************/
/* Returns the FidoNet address kept in str as ASCII. */
/****************************************************************************/
faddr_t atofaddr(char *instr)
{
char *p,str[51];
faddr_t addr;
sprintf(str,"%.50s",instr);
cleanstr(str);
if(!stricmp(str,"ALL")) {
addr.zone=addr.net=addr.node=addr.point=0xffff;
return(addr); }
addr.zone=addr.net=addr.node=addr.point=0;
if((p=strchr(str,':'))!=NULL) {
if(!strnicmp(str,"ALL:",4))
addr.zone=0xffff;
else
addr.zone=atoi(str);
p++;
if(!strnicmp(p,"ALL",3))
addr.net=0xffff;
else
addr.net=atoi(p); }
else {
#ifdef SCFG
if(total_faddrs)
addr.zone=faddr[0].zone;
else
#endif
addr.zone=1;
addr.net=atoi(str); }
if(!addr.zone) /* no such thing as zone 0 */
addr.zone=1;
if((p=strchr(str,'/'))!=NULL) {
p++;
if(!strnicmp(p,"ALL",3))
addr.node=0xffff;
else
addr.node=atoi(p); }
else {
if(!addr.net) {
#ifdef SCFG
if(total_faddrs)
addr.net=faddr[0].net;
else
#endif
addr.net=1; }
addr.node=atoi(str); }
if((p=strchr(str,'.'))!=NULL) {
p++;
if(!strnicmp(p,"ALL",3))
addr.point=0xffff;
else
addr.point=atoi(p); }
return(addr);
}
/****************************************************************************/
/* Returns an ASCII string for FidoNet address 'addr' */
/****************************************************************************/
char *faddrtoa(faddr_t addr)
{
static char str[25];
char tmp[25];
if(addr.zone==0xffff)
strcpy(str,"ALL");
else {
sprintf(str,"%u:",addr.zone);
if(addr.net==0xffff)
strcat(str,"ALL");
else {
sprintf(tmp,"%u/",addr.net);
strcat(str,tmp);
if(addr.node==0xffff)
strcat(str,"ALL");
else {
sprintf(tmp,"%u",addr.node);
strcat(str,tmp);
if(addr.point==0xffff)
strcat(str,".ALL");
else if(addr.point) {
sprintf(tmp,".%u",addr.point);
strcat(str,tmp); } } } }
return(str);
}
/******************************************************************************
This function returns the number of the node in the SBBSECHO.CFG file which
matches the address passed to it (or cfg.nodecfgs if no match).
******************************************************************************/
int matchnode(faddr_t addr, int exact)
{
int i;
if(exact!=2) {
for(i=0;i<cfg.nodecfgs;i++) /* Look for exact match */
if(!memcmp(&cfg.nodecfg[i].faddr,&addr,sizeof(faddr_t)))
break;
if(exact || i<cfg.nodecfgs)
return(i); }
for(i=0;i<cfg.nodecfgs;i++) /* Look for point match */
if(cfg.nodecfg[i].faddr.point==0xffff
&& addr.zone==cfg.nodecfg[i].faddr.zone
&& addr.net==cfg.nodecfg[i].faddr.net
&& addr.node==cfg.nodecfg[i].faddr.node)
break;
if(i<cfg.nodecfgs)
return(i);
for(i=0;i<cfg.nodecfgs;i++) /* Look for node match */
if(cfg.nodecfg[i].faddr.node==0xffff
&& addr.zone==cfg.nodecfg[i].faddr.zone
&& addr.net==cfg.nodecfg[i].faddr.net)
break;
if(i<cfg.nodecfgs)
return(i);
for(i=0;i<cfg.nodecfgs;i++) /* Look for net match */
if(cfg.nodecfg[i].faddr.net==0xffff
&& addr.zone==cfg.nodecfg[i].faddr.zone)
break;
if(i<cfg.nodecfgs)
return(i);
for(i=0;i<cfg.nodecfgs;i++) /* Look for total wild */
if(cfg.nodecfg[i].faddr.zone==0xffff)
break;
return(i);
}
/****************************************************************************/
/* Returns 32-crc of string (not counting terminating NULL) */
/****************************************************************************/
ulong crc32(char *str)
{
int i=0;
ulong crc=0xffffffffUL;
while(str[i])
crc=ucrc32(str[i++],crc);
crc=~crc;
return(crc);
}
void read_echo_cfg()
{
uchar str[1025],tmp[512],*p,*tp;
short attr;
int i,j,file;
FILE *stream;
faddr_t addr,route_addr;
/****** READ IN SBBSECHO.CFG FILE *******/
printf("\n\nReading %s\n",cfg.cfgfile);
if((stream=fnopen(&file,cfg.cfgfile,O_RDONLY))==NULL) {
printf("Unable to open %s for read.\n",cfg.cfgfile);
exit(1); }
cfg.maxpktsize=DFLT_PKT_SIZE;
cfg.maxbdlsize=DFLT_BDL_SIZE;
cfg.badecho=-1;
cfg.log=LOG_DEFAULTS;
while(1) {
if(!fgets(str,256,stream))
break;
truncsp(str);
p=str;
while(*p && *p<=SP) p++;
if(*p==';')
continue;
sprintf(tmp,"%-.25s",p);
tp=strchr(tmp,SP);
if(tp)
*tp=0; /* Chop off at space */
strupr(tmp); /* Convert code to uppercase */
while(*p>SP) p++; /* Skip code */
while(*p && *p<=SP) p++; /* Skip white space */
if(!strcmp(tmp,"PACKER")) { /* Archive Definition */
if((cfg.arcdef=(arcdef_t *)REALLOC(cfg.arcdef
,sizeof(arcdef_t)*(cfg.arcdefs+1)))==NULL) {
printf("\nError allocating %u bytes of memory for arcdef #%u.\n"
,sizeof(arcdef_t)*(cfg.arcdefs+1),cfg.arcdefs+1);
exit(1); }
sprintf(cfg.arcdef[cfg.arcdefs].name,"%-.25s",p);
tp=cfg.arcdef[cfg.arcdefs].name;
while(*tp && *tp>SP) tp++;
*tp=0;
while(*p && *p>SP) p++;
while(*p && *p<=SP) p++;
cfg.arcdef[cfg.arcdefs].byteloc=atoi(p);
while(*p && *p>SP) p++;
while(*p && *p<=SP) p++;
sprintf(cfg.arcdef[cfg.arcdefs].hexid,"%-.25s",p);
tp=cfg.arcdef[cfg.arcdefs].hexid;
while(*tp && *tp>SP) tp++;
*tp=0;
while(fgets(str,256,stream) && strnicmp(str,"END",3)) {
p=str;
while(*p && *p<=SP) p++;
if(!strnicmp(p,"PACK ",5)) {
p+=5;
while(*p && *p<=SP) p++;
sprintf(cfg.arcdef[cfg.arcdefs].pack,"%-.80s",p);
truncsp(cfg.arcdef[cfg.arcdefs].pack);
continue; }
if(!strnicmp(p,"UNPACK ",7)) {
p+=7;
while(*p && *p<=SP) p++;
sprintf(cfg.arcdef[cfg.arcdefs].unpack,"%-.80s",p);
truncsp(cfg.arcdef[cfg.arcdefs].unpack); } }
++cfg.arcdefs;
continue; }
if(!strcmp(tmp,"REGNUM"))
continue;
if(!strcmp(tmp,"NOTIFY")) {
cfg.notify=atoi(cleanstr(p));
continue; }
if(!strcmp(tmp,"LOG")) {
cleanstr(p);
if(!stricmp(p,"ALL"))
cfg.log=0xffffffffUL;
else if(!stricmp(p,"DEFAULT"))
cfg.log=LOG_DEFAULTS;
else if(!stricmp(p,"NONE"))
cfg.log=0L;
else
cfg.log=strtol(cleanstr(p),0,16);
continue; }
if(!strcmp(tmp,"NOSWAP")) {
#ifdef __MSDOS__
node_swap=0;
#endif
continue; }
if(!strcmp(tmp,"SECURE_ECHOMAIL")) {
misc|=SECURE;
continue; }
if(!strcmp(tmp,"CHECKMEM")) {
misc|=CHECKMEM;
continue; }
if(!strcmp(tmp,"STORE_SEENBY")) {
misc|=STORE_SEENBY;
continue; }
if(!strcmp(tmp,"STORE_PATH")) {
misc|=STORE_PATH;
continue; }
if(!strcmp(tmp,"STORE_KLUDGE")) {
misc|=STORE_KLUDGE;
continue; }
if(!strcmp(tmp,"FUZZY_ZONE")) {
misc|=FUZZY_ZONE;
continue; }
if(!strcmp(tmp,"FAST_OPEN")) {
continue; }
if(!strcmp(tmp,"FLO_MAILER")) {
misc|=FLO_MAILER;
continue; }
if(!strcmp(tmp,"ELIST_ONLY")) {
misc|=ELIST_ONLY;
continue; }
if(!strcmp(tmp,"KILL_EMPTY")) {
misc|=KILL_EMPTY_MAIL;
continue; }
if(!strcmp(tmp,"AREAFILE")) {
sprintf(cfg.areafile,"%-.80s",cleanstr(p));
continue; }
if(!strcmp(tmp,"LOGFILE")) {
sprintf(cfg.logfile,"%-.80s",cleanstr(p));
continue; }
if(!strcmp(tmp,"INBOUND")) { /* Inbound directory */
sprintf(cfg.inbound,"%-.80s",cleanstr(p));
if(cfg.inbound[strlen(cfg.inbound)-1]!='\\')
strcat(cfg.inbound,"\\");
continue; }
if(!strcmp(tmp,"SECURE_INBOUND")) { /* Secure Inbound directory */
sprintf(cfg.secure,"%-.80s",cleanstr(p));
if(cfg.secure[strlen(cfg.secure)-1]!='\\')
strcat(cfg.secure,"\\");
continue; }
if(!strcmp(tmp,"OUTBOUND")) { /* Outbound directory */
sprintf(cfg.outbound,"%-.80s",cleanstr(p));
if(cfg.outbound[strlen(cfg.outbound)-1]!='\\')
strcat(cfg.outbound,"\\");
continue; }
if(!strcmp(tmp,"ARCSIZE")) { /* Maximum bundle size */
cfg.maxbdlsize=atol(p);
continue; }
if(!strcmp(tmp,"PKTSIZE")) { /* Maximum packet size */
cfg.maxpktsize=atol(p);
continue; }
if(!strcmp(tmp,"USEPACKER")) { /* Which packer to use */
if(!*p)
continue;
strcpy(str,p);
p=str;
while(*p && *p>SP) p++;
if(!*p)
continue;
*p=0;
p++;
for(i=0;i<cfg.arcdefs;i++)
if(!strnicmp(cfg.arcdef[i].name,str
,strlen(cfg.arcdef[i].name)))
break;
if(i==cfg.arcdefs) /* i = number of arcdef til done */
i=0xffff; /* Uncompressed type if not found */
while(*p) {
while(*p && *p<=SP) p++;
if(!*p)
break;
addr=atofaddr(p);
while(*p && *p>SP) p++;
j=matchnode(addr,1);
if(j==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,j+1);
exit(1); }
memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
cfg.nodecfg[j].faddr=addr; }
cfg.nodecfg[j].arctype=i; } }
if(!strcmp(tmp,"PKTPWD")) { /* Packet Password */
if(!*p)
continue;
addr=atofaddr(p);
while(*p && *p>SP) p++; /* Skip address */
while(*p && *p<=SP) p++; /* Find beginning of password */
j=matchnode(addr,1);
if(j==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,j+1);
exit(1); }
memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
cfg.nodecfg[j].faddr=addr; }
sprintf(cfg.nodecfg[j].pktpwd,"%.8s",p); }
if(!strcmp(tmp,"PKTTYPE")) { /* Packet Type to Use */
if(!*p)
continue;
strcpy(str,p);
p=str;
while(*p && *p>SP) p++;
*p=0;
p++;
while(*p) {
while(*p && *p<=SP) p++;
if(!*p)
break;
addr=atofaddr(p);
while(*p && *p>SP) p++;
j=matchnode(addr,1);
if(j==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,j+1);
exit(1); }
memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
cfg.nodecfg[j].faddr=addr; }
if(!strcmp(str,"2+"))
cfg.nodecfg[j].pkt_type=PKT_TWO_PLUS;
else if(!strcmp(str,"2.2"))
cfg.nodecfg[j].pkt_type=PKT_TWO_TWO;
else if(!strcmp(str,"2"))
cfg.nodecfg[j].pkt_type=PKT_TWO; } }
if(!strcmp(tmp,"SEND_NOTIFY")) { /* Nodes to send notify lists to */
while(*p) {
while(*p && *p<=SP) p++;
if(!*p)
break;
addr=atofaddr(p);
while(*p && *p>SP) p++;
j=matchnode(addr,1);
if(j==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,j+1);
exit(1); }
memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
cfg.nodecfg[j].faddr=addr; }
cfg.nodecfg[j].attr|=SEND_NOTIFY; } }
if(!strcmp(tmp,"PASSIVE")
|| !strcmp(tmp,"HOLD")
|| !strcmp(tmp,"CRASH")
|| !strcmp(tmp,"DIRECT")) { /* Set node attributes */
if(!strcmp(tmp,"PASSIVE"))
attr=ATTR_PASSIVE;
else if(!strcmp(tmp,"CRASH"))
attr=ATTR_CRASH;
else if(!strcmp(tmp,"HOLD"))
attr=ATTR_HOLD;
else if(!strcmp(tmp,"DIRECT"))
attr=ATTR_DIRECT;
while(*p) {
while(*p && *p<=SP) p++;
if(!*p)
break;
addr=atofaddr(p);
while(*p && *p>SP) p++;
j=matchnode(addr,1);
if(j==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,j+1);
exit(1); }
memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
cfg.nodecfg[j].faddr=addr; }
cfg.nodecfg[j].attr|=attr; } }
if(!strcmp(tmp,"ROUTE_TO")) {
while(*p && *p<=SP) p++;
if(*p) {
route_addr=atofaddr(p);
while(*p && *p>SP) p++; }
while(*p) {
while(*p && *p<=SP) p++;
if(!*p)
break;
addr=atofaddr(p);
while(*p && *p>SP) p++;
j=matchnode(addr,1);
if(j==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,j+1);
exit(1); }
memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
cfg.nodecfg[j].faddr=addr; }
cfg.nodecfg[j].route=route_addr; } }
if(!strcmp(tmp,"AREAFIX")) { /* Areafix stuff here */
if(!*p)
continue;
addr=atofaddr(p);
i=matchnode(addr,1);
if(i==cfg.nodecfgs) {
cfg.nodecfgs++;
if((cfg.nodecfg=(nodecfg_t *)REALLOC(cfg.nodecfg
,sizeof(nodecfg_t)*(i+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u.\n"
,i+1);
exit(1); }
memset(&cfg.nodecfg[i],0,sizeof(nodecfg_t));
cfg.nodecfg[i].faddr=addr; }
cfg.nodecfg[i].flag=NULL;
while(*p && *p>SP) p++; /* Get to the end of the address */
while(*p && *p<=SP) p++; /* Skip over whitespace chars */
tp=p;
while(*p && *p>SP) p++; /* Find end of password */
*p=0; /* and terminate the string */
++p;
sprintf(cfg.nodecfg[i].password,"%-.25s",tp);
while(*p && *p<=SP) p++; /* Search for more chars */
if(!*p) /* Nothing else there */
continue;
while(*p) {
tp=p;
while(*p && *p>SP) p++; /* Find end of this flag */
*p=0; /* and terminate it */
++p;
for(j=0;j<cfg.nodecfg[i].numflags;j++)
if(!strnicmp(cfg.nodecfg[i].flag[j].flag,tp
,strlen(cfg.nodecfg[i].flag[j].flag)))
break;
if(j==cfg.nodecfg[i].numflags) {
if((cfg.nodecfg[i].flag=
(flag_t *)REALLOC(cfg.nodecfg[i].flag
,sizeof(flag_t)*(j+1)))==NULL) {
printf("\nError allocating memory for nodecfg #%u "
"flag #%u.\n",cfg.nodecfgs,j+1);
exit(1); }
cfg.nodecfg[i].numflags++;
sprintf(cfg.nodecfg[i].flag[j].flag,"%.4s",tp); }
while(*p && *p<=SP) p++; } }
if(!strcmp(tmp,"ECHOLIST")) { /* Echolists go here */
if((cfg.listcfg=(echolist_t *)REALLOC(cfg.listcfg
,sizeof(echolist_t)*(cfg.listcfgs+1)))==NULL) {
printf("\nError allocating memory for echolist cfg #%u.\n"
,cfg.listcfgs+1);
exit(1); }
memset(&cfg.listcfg[cfg.listcfgs],0,sizeof(echolist_t));
++cfg.listcfgs;
/* Need to forward requests? */
if(!strnicmp(p,"FORWARD ",8) || !strnicmp(p,"HUB ",4)) {
if(!strnicmp(p,"HUB ",4))
cfg.listcfg[cfg.listcfgs-1].misc|=NOFWD;
while(*p && *p>SP) p++;
while(*p && *p<=SP) p++;
if(*p)
cfg.listcfg[cfg.listcfgs-1].forward=atofaddr(p);
while(*p && *p>SP) p++;
while(*p && *p<=SP) p++;
if(*p && !(cfg.listcfg[cfg.listcfgs-1].misc&NOFWD)) {
tp=p;
while(*p && *p>SP) p++;
*p=0;
++p;
while(*p && *p<=SP) p++;
sprintf(cfg.listcfg[cfg.listcfgs-1].password,"%.71s",tp); } }
else
cfg.listcfg[cfg.listcfgs-1].misc|=NOFWD;
if(!*p)
continue;
tp=p;
while(*p && *p>SP) p++;
*p=0;
p++;
sprintf(cfg.listcfg[cfg.listcfgs-1].listpath,"%-.128s",tp);
cfg.listcfg[cfg.listcfgs-1].numflags=0;
cfg.listcfg[cfg.listcfgs-1].flag=NULL;
while(*p && *p<=SP) p++; /* Skip over whitespace chars */
while(*p) {
tp=p;
while(*p && *p>SP) p++; /* Find end of this flag */
*p=0; /* and terminate it */
++p;
for(j=0;j<cfg.listcfg[cfg.listcfgs-1].numflags;j++)
if(!strnicmp(cfg.listcfg[cfg.listcfgs-1].flag[j].flag,tp
,strlen(cfg.listcfg[cfg.listcfgs-1].flag[j].flag)))
break;
if(j==cfg.listcfg[cfg.listcfgs-1].numflags) {
if((cfg.listcfg[cfg.listcfgs-1].flag=
(flag_t *)REALLOC(cfg.listcfg[cfg.listcfgs-1].flag
,sizeof(flag_t)*(j+1)))==NULL) {
printf("\nError allocating memory for listcfg #%u "
"flag #%u.\n",cfg.listcfgs,j+1);
exit(1); }
cfg.listcfg[cfg.listcfgs-1].numflags++;
sprintf(cfg.listcfg[cfg.listcfgs-1].flag[j].flag,"%.4s",tp); }
while(*p && *p<=SP) p++; } }
// printf("Unrecognized line in SBBSECHO.CFG file.\n");
}
fclose(stream);
printf("\n");
}
This diff is collapsed.
# Microsoft Developer Studio Project File - Name="sbbsecho" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=sbbsecho - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "sbbsecho.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "sbbsecho.mak" CFG="sbbsecho - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "sbbsecho - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "sbbsecho - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "sbbsecho - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "msvc.win32.exe.release"
# PROP Intermediate_Dir "msvc.win32.exe.release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WRAPPER_DLL" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib msvc.win32.dll.release/sbbs.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "sbbsecho - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "msvc.win32.exe.debug"
# PROP Intermediate_Dir "msvc.win32.exe.debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "WRAPPER_DLL" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib msvc.win32.dll.debug/sbbs.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "sbbsecho - Win32 Release"
# Name "sbbsecho - Win32 Debug"
# Begin Source File
SOURCE=.\crc32.c
# End Source File
# Begin Source File
SOURCE=.\lzh.c
# End Source File
# Begin Source File
SOURCE=.\rechocfg.c
# End Source File
# Begin Source File
SOURCE=.\sbbsecho.c
# End Source File
# Begin Source File
SOURCE=.\smblib.c
# End Source File
# Begin Source File
SOURCE=.\smbtxt.c
# End Source File
# Begin Source File
SOURCE=.\smbwrap.c
# End Source File
# End Target
# End Project
/* SBBSECHO.H */
/* Developed 1990-2000 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
/* Portions written by Allen Christiansen 1994-1996 */
#define SBBSECHO_VER "2.00"
#define IMPORT_NETMAIL (1L<<0)
#define IMPORT_PACKETS (1L<<1)
#define IMPORT_ECHOMAIL (1L<<2)
#define EXPORT_ECHOMAIL (1L<<3)
#define DELETE_NETMAIL (1L<<4)
#define DELETE_PACKETS (1L<<5)
#define STORE_SEENBY (1L<<6) /* Store SEEN-BYs in SMB */
#define STORE_PATH (1L<<7) /* Store PATHs in SMB */
#define STORE_KLUDGE (1L<<8) /* Store unknown kludges in SMB */
#define IGNORE_MSGPTRS (1L<<9)
#define UPDATE_MSGPTRS (1L<<10)
#define LEAVE_MSGPTRS (1L<<11)
#define CHECKMEM (1L<<12) /* Display available memory */
#define ASCII_ONLY (1L<<13)
#define LOGFILE (1L<<14)
#define REPORT (1L<<15)
#define EXPORT_ALL (1L<<16)
#define UNKNOWN_NETMAIL (1L<<17)
#define IGNORE_ADDRESS (1L<<18)
#define IGNORE_RECV (1L<<19)
#define CONVERT_TEAR (1L<<20)
#define IMPORT_PRIVATE (1L<<21)
#define LOCAL_NETMAIL (1L<<22)
#define NOTIFY_RECEIPT (1L<<23)
#define FLO_MAILER (1L<<24) /* Binkley .FLO style mailer */
#define PACK_NETMAIL (1L<<25) /* Pack *.MSG NetMail into packets */
#define FUZZY_ZONE (1L<<26)
#define FAST_OPEN (1L<<27)
#define SECURE (1L<<28) /* Secure operation */
#define ELIST_ONLY (1L<<29) /* Allow adding from AREAS.BBS */
#define GEN_NOTIFY_LIST (1L<<30) /* Generate Notify Lists */
#define KILL_EMPTY_MAIL (1L<<31) /* Kill empty netmail messages */
#define ATTR_HOLD (1<<0) /* Hold */
#define ATTR_CRASH (1<<1) /* Crash */
#define ATTR_DIRECT (1<<2) /* Direct */
#define ATTR_PASSIVE (1<<3) /* Used to temp disconnect */
#define SEND_NOTIFY (1<<4) /* Send Notify Lists */
#define LOG_AREAFIX (1L<<0) /* Log areafix messages */
#define LOG_IMPORTED (1L<<1) /* Log imported netmail messages */
#define LOG_PACKETS (1L<<2) /* Log imported packet names/types */
#define LOG_SECURITY (1L<<3) /* Log security violations */
#define LOG_GRUNGED (1L<<4) /* Log grunged messages */
#define LOG_PRIVATE (1L<<5) /* Log disallowed private msgs */
#define LOG_AREA_TOTALS (1L<<6) /* Log totals for each area */
#define LOG_TOTALS (1L<<7) /* Log over-all totals */
#define LOG_PACKING (1L<<8) /* Log packing of out-bound netmail */
#define LOG_ROUTING (1L<<9) /* Log routing of out-bound netmail */
#define LOG_DUPES (1L<<24) /* Log individual dupe messages */
#define LOG_CIRCULAR (1L<<25) /* Log individual circ paths */
#define LOG_IGNORED (1L<<26) /* Log ignored netmail */
#define LOG_UNKNOWN (1L<<27) /* Log netmail for unknown users */
#define LOG_DEFAULTS 0xffffffL /* Low 24 bits default to ON */
#define PKT_TWO_PLUS 0 /* Type 2+ Packet Header */
#define PKT_TWO_TWO 1 /* Type 2.2 Packet Header */
#define PKT_TWO 2 /* Old Type Packet Header */
#define MAX_OPEN_SMBS 2
#define DFLT_OPEN_PKTS 4
#define MAX_TOTAL_PKTS 100
#define DFLT_PKT_SIZE 250*1024L
#define DFLT_BDL_SIZE 250*1024L
#define NOFWD (1<<0) /* Do not forward requests */
typedef struct { /* Fidonet Packet Header */
short orignode, /* Origination Node of Packet */
destnode, /* Destination Node of Packet */
year, /* Year of Packet Creation e.g. 1995 */
month, /* Month of Packet Creation 0-11 */
day, /* Day of Packet Creation 1-31 */
hour, /* Hour of Packet Creation 0-23 */
min, /* Minute of Packet Creation 0-59 */
sec, /* Second of Packet Creation 0-59 */
baud, /* Max Baud Rate of Orig & Dest */
pkttype, /* Packet Type (-1 is obsolete) */
orignet, /* Origination Net of Packet */
destnet; /* Destination Net of Packet */
uchar prodcode, /* Product Code (00h is Fido) */
sernum, /* Binary Serial Number or NULL */
password[8]; /* Session Password or NULL */
short origzone, /* Origination Zone of Packet or NULL */
destzone; /* Destination Zone of Packet or NULL */
uchar empty[20]; /* Fill Characters */
} pkthdr_t;
typedef struct { /* Type 2+ Packet Header Info */
short auxnet, /* Orig Net if Origin is a Point */
cwcopy; /* Must be Equal to cword */
uchar prodcode, /* Product Code */
revision; /* Revision */
short cword, /* Compatibility Word */
origzone, /* Zone of Packet Sender or NULL */
destzone, /* Zone of Packet Receiver or NULL */
origpoint, /* Origination Point of Packet */
destpoint; /* Destination Point of Packet */
uchar empty[4];
} two_plus_t;
typedef struct { /* Type 2.2 Packet Header Info */
uchar origdomn[8], /* Origination Domain */
destdomn[8], /* Destination Domain */
empty[4]; /* Product Specific Data */
} two_two_t;
typedef struct {
uint sub; /* Set to INVALID_SUB if pass-thru */
ulong tag; /* CRC-32 of tag name */
char *name; /* Area tag name */
uint uplinks; /* Total number of uplinks for this echo */
uint imported; /* Total messages imported this run */
uint exported; /* Total messages exported this run */
uint circular; /* Total circular paths detected */
uint dupes; /* Total duplicate messages detected */
faddr_t *uplink; /* Each uplink */
} areasbbs_t;
typedef struct {
char flag[5];
} flag_t;
typedef struct {
uint tags; /* Number of area tags */
char **tag; /* Name of each area tag */
} area_t;
typedef struct {
FILE *stream; /* The stream associated with this packet */
faddr_t uplink; /* The current uplink for this packet */
uchar filename[128],curopen;/* Name of the file and if it's open or not */
} outpkt_t;
typedef struct {
uint addrs; /* Total number of uplinks */
faddr_t *addr; /* Each uplink */
} addrlist_t;
typedef struct {
char name[26] /* Short name of archive type */
,hexid[26] /* Hexadecimal ID to search for */
,pack[81] /* Pack command line */
,unpack[81]; /* Unpack command line */
uint byteloc; /* Offset to Hex ID */
} arcdef_t;
typedef struct {
faddr_t faddr /* Fido address of this node */
,route; /* Address to route FLO stuff through */
ushort arctype /* De/archiver to use for this node */
,numflags /* Number of flags defined for this node */
,pkt_type; /* Packet type to use for outgoing PKTs */
ushort attr; /* Message bits to set for this node */
char password[26]; /* Areafix password for this node */
char pktpwd[9]; /* Packet password for this node */
flag_t *flag; /* Areafix flags for this node */
} nodecfg_t;
typedef struct {
char listpath[129]; /* Path to this echolist */
uint numflags,misc; /* Number of flags for this echolist */
flag_t *flag; /* Flags to access this echolist */
faddr_t forward; /* Where to forward requests */
char password[72]; /* Password to use for forwarding req's */
} echolist_t;
typedef struct {
faddr_t dest;
char fname[13];
} attach_t;
typedef struct {
char inbound[82] /* Inbound directory */
,secure[82] /* Secure Inbound directory */
,outbound[82] /* Outbound directory */
,areafile[128] /* AREAS.BBS path/filename */
,logfile[128] /* LOG path/filename */
,cfgfile[128]; /* Configuration path/filename */
ulong maxpktsize /* Maximum size for packets */
,maxbdlsize /* Maximum size for bundles */
,log; /* What do we log? */
int badecho; /* Area to store bad echomail msgs */
uint arcdefs /* Number of archive definitions */
,nodecfgs /* Number of nodes with configs */
,listcfgs /* Number of echolists defined */
,areas /* Number of areas defined */
,notify; /* User number (sysop) to notify */
arcdef_t *arcdef; /* Each archive definition */
nodecfg_t *nodecfg; /* Each node configuration */
echolist_t *listcfg; /* Each echolist configuration */
areasbbs_t *area; /* Each area configuration */
} config_t;
#ifdef __WATCOMC__
struct time {
unsigned char ti_min; /* Minutes */
unsigned char ti_hour; /* Hours */
unsigned char ti_hund; /* Hundredths of seconds */
unsigned char ti_sec; /* Seconds */
};
struct date {
int da_year; /* Year - 1980 */
char da_day; /* Day of the month */
char da_mon; /* Month (1 = Jan) */
};
#endif
/***********************/
/* Function prototypes */
/***********************/
void read_echo_cfg();
void bail(int code);
char *ultoac(ulong l,char *str);
int bstrlen(char *str);
int nopen(char *str, int access);
FILE *fnopen(int *file, char *str,int access);
//char *sectostr(uint sec, char *str);
void truncsp(char *str);
ulong ahtoul(char *str);
int mv(char *src, char *dest, char copy); /* fast file move/copy function */
char *timestr(time_t *intime); /* ASCII representation of time_t */
//time_t dstrtounix(char *str); /* ASCII date (MM/DD/YY) to unix conversion */
//char *unixtodstr(time_t unix, char *str); /* Unix time to ASCII date */
//int chk_ar(char *str, user_t user); /* checks access requirements */
//ushort crc16(char *str);
void ucrc16(uchar ch, ushort *rcrc);
//char fexist(char *filespec);
//long flength(char *filespec);
//long fdate(char *filespec);
faddr_t atofaddr(char *str);
int matchnode(faddr_t addr, int exact);
void export_echomail(char *sub_code,faddr_t addr);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment