Commit a6d2afb6 authored by rswindell's avatar rswindell
Browse files

Updated for v3.x for Win32.

parent c1ef7af5
This diff is collapsed.
/* MAKEHELP.C */
/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
/* Makes SCFG.HLP for Synchronet configuration program */
#include <stdio.h>
#include <alloc.h>
#include <string.h>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
void main(void)
{
char *files[]={ "SCFG.C"
,"SCFGSYS.C"
,"SCFGMSG.C"
,"SCFGSUB.C"
,"SCFGNODE.C"
,"SCFGCHAT.C"
,"SCFGXFR1.C"
,"SCFGXFR2.C"
,"SCFGNET.C"
,"SCFGXTRN.C"
,NULL };
char str[256],tmp[256];
int i,j,k,line,ixb;
long l;
FILE *stream,*out;
if((out=fopen("SCFGHELP.DAT","wb"))==NULL) {
printf("error opening SCFGHELP.DAT\r\n");
return; }
if((ixb=open("SCFGHELP.IXB",O_WRONLY|O_CREAT|O_BINARY,S_IWRITE|S_IREAD))==-1) {
printf("error opening SCFGHELP.IXB\r\n");
return; }
for(i=0;files[i];i++) {
if((stream=fopen(files[i],"rb"))==NULL) {
printf("error opening %s\r\n",files[i]);
return; }
printf("\r\n%s ",files[i]);
line=0;
while(!feof(stream)) {
if(!fgets(str,128,stream))
break;
line++;
if(strstr(str,"SETHELP(WHERE);")) {
l=ftell(out);
write(ixb,files[i],12);
write(ixb,&line,2);
write(ixb,&l,4);
fgets(str,128,stream); /* skip start comment */
line++;
while(!feof(stream)) {
if(!fgets(str,128,stream))
break;
if(strchr(str,9)) { /* Tab expansion */
strcpy(tmp,str);
k=strlen(tmp);
for(j=l=0;j<k;j++) {
if(tmp[j]==9) {
str[l++]=32;
while(l%4)
str[l++]=32; }
else
str[l++]=tmp[j]; }
str[l]=0; }
line++;
if(strstr(str,"*/")) /* end comment */
break;
fputs(str,out); }
fputc(0,out); } }
fclose(stream); }
fclose(out);
printf("\n");
}
USEUNIT("scfg.c");
USEUNIT("scfgxtrn.c");
USEUNIT("scfgmdm.c");
USEUNIT("scfgmsg.c");
USEUNIT("scfgnet.c");
USEUNIT("scfgnode.c");
USEUNIT("scfgsub.c");
USEUNIT("scfgsys.c");
USEUNIT("scfgxfr1.c");
USEUNIT("scfgxfr2.c");
USEUNIT("scfgchat.c");
USEUNIT("..\..\uifc\uifc.c");
USEUNIT("..\scfgsave.c");
USEUNIT("..\scfglib1.c");
USEUNIT("..\smblib.c");
USEUNIT("..\scfglib2.c");
USEUNIT("..\smbwrap.c");
USEUNIT("..\ars.c");
USEUNIT("..\load_cfg.c");
USEUNIT("..\misc.c");
USEUNIT("..\crc32.c");
//---------------------------------------------------------------------------
This file is used by the project manager only and should be treated like the project file
main
\ No newline at end of file
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.05.03"/>
<PROJECT value="scfg.exe"/>
<OBJFILES value="scfg.obj scfgxtrn.obj scfgmdm.obj scfgmsg.obj scfgnet.obj scfgnode.obj
scfgsub.obj scfgsys.obj scfgxfr1.obj scfgxfr2.obj scfgchat.obj
..\..\uifc\uifc.obj ..\scfgsave.obj ..\scfglib1.obj ..\smblib.obj
..\scfglib2.obj ..\smbwrap.obj ..\ars.obj ..\load_cfg.obj ..\misc.obj
..\crc32.obj"/>
<RESFILES value=""/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES)"/>
<LIBFILES value=""/>
<LIBRARIES value=""/>
<SPARELIBS value=""/>
<PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Vcldb50.bpi vclado50.bpi ibsmp50.bpi
VCLBDE50.bpi vcldbx50.bpi Qrpt50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi
Dss50.bpi TeeQR50.bpi VCLIB50.bpi Vclmid50.bpi vclie50.bpi Inetdb50.bpi
Inet50.bpi NMFast50.bpi webmid50.bpi bcbie50.bpi dclocx50.bpi
bcb2kaxserver50.bpi"/>
<PATHCPP value=".;..\..\uifc;.."/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="tlink32"/>
<USERDEFINES value="_DEBUG"/>
<SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/>
<MAINSOURCE value="scfg.bpf"/>
<INCLUDEPATH value="..\;$(BCB)\include;$(BCB)\include\vcl;..;..\..\uifc;..\..\spawno"/>
<LIBPATH value="..\;..\..\uifc;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-8065 -w-8064 -w-par -w-csu"/>
</MACROS>
<OPTIONS>
<IDLCFLAGS value="-src_suffix cpp -D_DEBUG -I..\. -I$(BCB)\include -I$(BCB)\include\vcl -I..
-I..\..\uifc -I..\..\spawno -boa"/>
<CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC
-tWM- -c"/>
<PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zd"/>
<LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn -v"/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32i.lib"/>
</LINKER>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1033
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[HistoryLists\hlIncludePath]
Count=5
Item0=..\;$(BCB)\include;$(BCB)\include\vcl;..;..\..\uifc;..\..\spawno
Item1=$(BCB)\include;$(BCB)\include\vcl;..;..\..\uifc;..\..\spawno
Item2=$(BCB)\include;$(BCB)\include\vcl;..;..\..\uifc
Item3=$(BCB)\include;$(BCB)\include\vcl;..\..\uifc
Item4=$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=2
Item0=..\;..\..\uifc;$(BCB)\lib\obj;$(BCB)\lib
Item1=$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=1
Item0=_DEBUG
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=c:\sbbs\ctrl
HostApplication=
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
</IDEOPTIONS>
</PROJECT>
\ No newline at end of file
This diff is collapsed.
/* SCFG.H */
/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
#include "uifc.h"
#include <dos.h>
#include <dir.h>
#include <stdio.h>
#include <stdlib.h>
#if defined(__DPMI32__) || defined(__OS2__)
#define far
#define huge
#endif
#include "sbbs.h"
#include "scfglib.h"
/**********/
/* Macros */
/**********/
/*************/
/* Constants */
/*************/
#define SUB_HDRMOD (1L<<31) /* Modified sub-board header info */
/************/
/* Typedefs */
/************/
/********************/
/* Global Variables */
/********************/
extern scfg_t cfg;
extern long freedosmem;
extern char item;
extern char **opt;
extern char tmp[256];
extern char *nulstr;
extern char **mdm_type;
extern char **mdm_file;
extern int mdm_types;
extern char *invalid_code,*num_flags;
extern int backup_level;
extern read_cfg_text_t txt;
/***********************/
/* Function Prototypes */
/***********************/
void bail(int code);
void errormsg(int line, char *source, char action, char *object, ulong access);
int save_changes(int mode);
void node_menu();
void node_cfg();
void results(int i);
void sys_cfg();
void net_cfg();
void msgs_cfg();
void sub_cfg(uint grpnum);
void xfer_cfg();
void libs_cfg();
void dir_cfg(uint libnum);
void xprogs_cfg();
void fevents_cfg();
void tevents_cfg();
void xtrn_cfg();
void swap_cfg();
void xtrnsec_cfg();
void page_cfg();
void xedit_cfg();
void txt_cfg();
void shell_cfg();
void init_mdms();
void mdm_cfg(int mdmnum);
int export_mdm(char *fname);
char code_ok(char *str);
int bits(long l);
char oneflag(long l);
void getar(char *desc, char *ar);
char *ultoac(ulong l,char *str);
FILE *fnopen(int *file, char *str, int access);
/* scfgnet.h */
faddr_t atofaddr(char *str);
This diff is collapsed.
/* scfgmdm.c */
/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
#include "scfg.h"
int exec_mdm(char *fname);
void mdm_cfg(int mdmnum)
{
FREE(cfg.mdm_result);
cfg.mdm_result=NULL;
/*
strcpy(cfg.mdm_answ,"ATA");
strcpy(cfg.mdm_hang,"ATH");
strcpy(cfg.mdm_dial,"ATDT");
strcpy(cfg.mdm_offh,"ATM0H1");
strcpy(cfg.mdm_term,"ATE1V1");
strcpy(cfg.mdm_init,"AT&FS0=0S2=128E0V0X4&C1&D2");
*/
cfg.mdm_answ[0]=0;
cfg.mdm_hang[0]=0;
cfg.mdm_dial[0]=0;
cfg.mdm_offh[0]=0;
cfg.mdm_term[0]=0;
cfg.mdm_init[0]=0;
cfg.mdm_spec[0]=0;
cfg.mdm_results=0;
cfg.mdm_misc=(MDM_RTS|MDM_CTS);
exec_mdm(mdm_file[mdmnum]);
}
void cvttab(char *str)
{
int i;
for(i=0;str[i];i++)
if(str[i]==TAB)
str[i]=SP;
}
int export_mdm(char *fname)
{
char str[256];
int file,i;
time_t now;
FILE *stream;
sprintf(str,"%s%s.MDM",cfg.ctrl_dir,fname);
if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1)
return(0);
if((stream=fdopen(file,"wb"))==NULL) {
close(file);
return(0); }
now=time(NULL);
fprintf(stream,"# Exported from %s Node %u on %.24s\r\n\r\n"
,cfg.sys_name,cfg.node_num,ctime(&now));
fprintf(stream,"COM_RATE\t%ld\r\n",cfg.com_rate);
fprintf(stream,"INIT_STR\t%s\r\n",cfg.mdm_init);
fprintf(stream,"DIAL_STR\t%s\r\n",cfg.mdm_dial);
fprintf(stream,"HANGUP_STR\t%s\r\n",cfg.mdm_hang);
fprintf(stream,"ANSWER_STR\t%s\r\n",cfg.mdm_answ);
fprintf(stream,"OFFHOOK_STR\t%s\r\n",cfg.mdm_offh);
fprintf(stream,"SPEC_INIT\t%s\r\n",cfg.mdm_spec);
fprintf(stream,"TERM_INIT\t%s\r\n",cfg.mdm_term);
fprintf(stream,"LOCKED_RATE\t%s\r\n",(cfg.mdm_misc&MDM_STAYHIGH) ? "YES":"NO");
fprintf(stream,"CALLER_ID\t%s\r\n",(cfg.mdm_misc&MDM_CALLERID) ? "YES":"NO");
fprintf(stream,"DROP_DTR\t%s\r\n",(cfg.mdm_misc&MDM_NODTR) ? "NO":"YES");
fprintf(stream,"FLOW_CONTROL\t%s\r\n"
,(cfg.mdm_misc&(MDM_RTS|MDM_CTS)==(MDM_RTS|MDM_CTS)) ? "BOTH":
(cfg.mdm_misc&MDM_CTS) ? "TRANSMIT" : (cfg.mdm_misc&MDM_RTS) ? "RECEIVE" : "NONE");
for(i=0;i<cfg.mdm_results;i++)
fprintf(stream,"RESULT\t\t%u\t%u\t%u\t%s\r\n",cfg.mdm_result[i].code
,cfg.mdm_result[i].cps,cfg.mdm_result[i].rate,cfg.mdm_result[i].str);
fclose(stream);
return(1);
}
int exec_mdm(char *fname)
{
char str[256],msg[128],*p;
int file,i,j;
FILE *stream;
sprintf(str,"%s%s.MDM",cfg.ctrl_dir,fname);
if((file=open(str,O_RDONLY|O_BINARY|O_DENYALL))==-1)
return(0);
if((stream=fdopen(file,"rb"))==NULL) {
close(file);
return(0); }
while(!feof(stream)) {
if(!fgets(str,255,stream))
break;
cvttab(str);
truncsp(str);
p=str;
while(*p && *p<=SP) /* look for beginning of command */
p++;
if(!*p)
continue;
if(*p=='#') /* remarks start with # */
continue;
if(!strnicmp(p,"COM_RATE",8)) {
p+=8;
while(*p==SP) p++;
cfg.com_rate=atol(p);
continue; }
if(!strnicmp(p,"INIT_STR",8)) {
p+=8;
while(*p==SP) p++;
sprintf(cfg.mdm_init,"%.63s",p);
continue; }
if(!strnicmp(p,"DIAL_STR",8)) {
p+=8;
while(*p==SP) p++;
sprintf(cfg.mdm_dial,"%.63s",p);
continue; }
if(!strnicmp(p,"HANGUP_STR",10)) {
p+=10;
while(*p==SP) p++;
sprintf(cfg.mdm_hang,"%.63s",p);
continue; }
if(!strnicmp(p,"ANSWER_STR",10)) {
p+=10;
while(*p==SP) p++;
sprintf(cfg.mdm_answ,"%.63s",p);
continue; }
if(!strnicmp(p,"OFFHOOK_STR",11)) {
p+=11;
while(*p==SP) p++;
sprintf(cfg.mdm_offh,"%.63s",p);
continue; }
if(!strnicmp(p,"SPEC_INIT",9)) {
p+=9;
while(*p==SP) p++;
sprintf(cfg.mdm_spec,"%.63s",p);
continue; }
if(!strnicmp(p,"TERM_INIT",9)) {
p+=9;
while(*p==SP) p++;
sprintf(cfg.mdm_term,"%.63s",p);
continue; }
if(!strnicmp(p,"LOCKED_RATE",11)) {
p+=11;
while(*p==SP) p++;
if(!stricmp(p,"OFF") || !stricmp(p,"NO"))
cfg.mdm_misc&=~MDM_STAYHIGH;
else
cfg.mdm_misc|=MDM_STAYHIGH;
continue; }
if(!strnicmp(p,"CALLER_ID",9)) {
p+=9;
while(*p==SP) p++;
if(!stricmp(p,"YES") || !stricmp(p,"ON"))
cfg.mdm_misc|=MDM_CALLERID;
else
cfg.mdm_misc&=~MDM_CALLERID;
continue; }
if(!strnicmp(p,"VERBAL_RESULTS",14)) {
p+=14;
while(*p==SP) p++;
if(!stricmp(p,"YES") || !stricmp(p,"ON"))
cfg.mdm_misc|=MDM_VERBAL;
else
cfg.mdm_misc&=~MDM_VERBAL;
continue; }
if(!strnicmp(p,"DROP_DTR",8)) {
p+=8;
while(*p==SP) p++;
if(!stricmp(p,"OFF") || !stricmp(p,"NO"))
cfg.mdm_misc|=MDM_NODTR;
else
cfg.mdm_misc&=~MDM_NODTR;
continue; }
if(!strnicmp(p,"FLOW_CONTROL",12)) {
p+=12;
while(*p==SP) p++;
cfg.mdm_misc&=~(MDM_RTS|MDM_CTS);
strupr(p);
if(strstr(p,"RTS") || strstr(p,"RECEIVE") || strstr(p,"RECV")
|| strstr(p,"BOTH"))
cfg.mdm_misc|=MDM_RTS;
if(strstr(p,"CTS") || strstr(p,"TRANSMIT") || strstr(p,"SEND")
|| strstr(p,"BOTH"))
cfg.mdm_misc|=MDM_CTS;
continue; }
if(!strnicmp(p,"RESULT ",7)) {
p+=7;
while(*p==SP) p++;
i=atoi(p);
for(j=0;j<cfg.mdm_results;j++)
if(cfg.mdm_result[j].code==i)
break;
if(j>=cfg.mdm_results) {
if((cfg.mdm_result=(mdm_result_t *)REALLOC(
cfg.mdm_result,sizeof(mdm_result_t)
*(cfg.mdm_results+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,p,cfg.mdm_results+1);
cfg.mdm_results=0;
bail(1);
continue; }
cfg.mdm_results++; }
cfg.mdm_result[j].code=i;
while(*p!=SP) p++;
while(*p==SP) p++;
cfg.mdm_result[j].cps=atoi(p);
while(*p!=SP) p++;
while(*p==SP) p++;
cfg.mdm_result[j].rate=atoi(p);
while(*p!=SP) p++;
while(*p==SP) p++;
sprintf(cfg.mdm_result[j].str,"%.*s",LEN_MODEM,p);
continue; }
if(!strnicmp(p,"INCLUDE ",8)) {
p+=8;
while(*p==SP) p++;
exec_mdm(p);
continue; }
sprintf(msg,"ERROR: '%.15s' in %.8s.MDM",p,fname);
savnum--;
umsg(msg);
savnum++; }
fclose(stream);
return(1);
}
void init_mdms()
{
char str[128],fname[128];
int file;
FILE *stream;
mdm_types=0;
mdm_type=NULL;
mdm_file=NULL;
sprintf(str,"%sMDMS.IXT",cfg.ctrl_dir);
if((file=nopen(str,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
return; }
if((stream=fdopen(file,"rb"))==NULL) {
close(file);
errormsg(WHERE,ERR_FDOPEN,str,O_RDONLY);
return; }
while(!feof(stream)) {
if(!fgets(str,120,stream))
break;
truncsp(str);
if(!fgets(fname,120,stream))
break;
truncsp(fname);
if((mdm_type=REALLOC(mdm_type,sizeof(char *)*(mdm_types+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,"Modem Type",sizeof(char *)*(mdm_types+1));
break; }
if((mdm_file=REALLOC(mdm_file,sizeof(char *)*(mdm_types+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,"Modem File",sizeof(char *)*(mdm_types+1));
break; }