home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
UTIL
/
WWIVE
/
MYWIVE.ZIP
/
CHNEDIT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-05-06
|
5KB
|
244 lines
#include "vars.h"
#pragma hdrstop
void chaindata(int n, char *s)
{
char w,x,y,z,i;
chainfilerec c;
c=chains[n];
if (c.ar==0)
x=32;
else {
for (i=0; i<16; i++)
if ((1 << i) & c.ar)
x='A'+i;
}
if (c.ansir & ansir_ansi)
y='Y';
else
y='N';
if (c.ansir & ansir_no_DOS)
z='N';
else
z='Y';
if (c.ansir & ansir_shrink)
w='Y';
else
w='N';
sprintf(s,"%2d %-28.28s %-27.27s %-3d %1c %1c %1c %1c",
n,c.description,c.filename,c.sl,y,x,z,w);
}
void showchains()
{
int abort,i;
char s[180];
outchr(12);
abort=0;
pla("NN Description Path Name SL ANSI AR DOS S",
&abort);
pla("== ---------------------------- =========================== --- ==== -- === -",
&abort);
for (i=0; (i<numchain) && (!abort); i++) {
chaindata(i,s);
pla(s,&abort);
}
}
void modify_chain(int n)
{
chainfilerec c;
char s[81],s1[81],ch,ch2;
int i,i1,done;
c=chains[n];
done=0;
do {
outchr(12);
npr("A. Description : %s\r\n",c.description);
npr("B. Filename : %s\r\n",c.filename);
npr("C. SL : %d\r\n",c.sl);
strcpy(s,"None.");
if (c.ar!=0) {
for (i=0; i<16; i++)
if ((1 << i) & c.ar)
s[0]='A'+i;
s[1]=0;
}
npr("D. AR : %s\r\n",s);
npr("E. ANSI : %s\r\n",
(c.ansir & ansir_ansi)?"Required":"Optional");
npr("F. DOS Interrupt: %sUsed\r\n",
(c.ansir & ansir_no_DOS)?"NOT ":"");
npr("G. 300 Baud : %sAllowed\r\n",
(c.ansir & ansir_no_300)?"NOT ":"");
npr("H. Shrink : %s\r\n",
(c.ansir & ansir_shrink)?"Yes":"No");
npr("I. Disable pause: %s\r\n",
(c.ansir & ansir_no_pause)?"Yes":"No");
nl();
prt(2,"Which (A-G,Q) ? ");
ch=onek("QABCDEFGHI");
switch(ch) {
case 'Q':done=1; break;
case 'A':
nl();
prt(2,"New description? ");
inputl(s,40);
if (s[0])
strcpy(c.description,s);
break;
case 'B':
nl();
prt(2,"New filename? ");
input(s,40);
if (s[0]!=0)
strcpy(c.filename,s);
break;
case 'C':
nl();
prt(2,"New SL? ");
input(s,3);
i=atoi(s);
if ((i>=0) && (i<256) && (s[0]))
c.sl=i;
break;
case 'D':
nl();
prt(2,"New AR (<SPC>=None) ? ");
ch2=onek("ABCDEFGHIJKLMNOP ");
if (ch2==32)
c.ar=0;
else
c.ar=1 << (ch2-'A');
break;
case 'E':
nl();
prt(5,"Require ANSI? ");
if (yn())
c.ansir |= ansir_ansi;
else
c.ansir &= ~ansir_ansi;
break;
case 'F':
nl();
prt(5,"Have BBS intercept DOS calls? ");
if (ny())
c.ansir &= ~ansir_no_DOS;
else
c.ansir |= ansir_no_DOS;
break;
case 'G':
nl();
prt(5,"Allow 300 baud users to run? ");
if (ny())
c.ansir &= ~ansir_no_300;
else
c.ansir |= ansir_no_300;
break;
case 'H':
nl();
prt(5,"Shrink the BBS to run? ");
if (yn())
c.ansir |= ansir_shrink;
else
c.ansir &= ~ansir_shrink;
break;
case 'I':
nl();
prt(5,"Disable screen pause in program? ");
if (yn())
c.ansir |= ansir_no_pause;
else
c.ansir &= ~ansir_no_pause;
break;
}
} while ((!done) && (!hangup));
chains[n]=c;
}
void insert_chain(int n)
{
chainfilerec c;
int i,i1,nu;
for (i=numchain-1; i>=n; i--)
chains[i+1]=chains[i];
strcpy(c.description,"** NEW CHAIN **");
strcpy(c.filename,"REM");
c.sl=10;
c.ar=0;
c.ansir=0;
chains[n]=c;
++numchain;
modify_chain(n);
}
void delete_chain(int n)
{
int i,i1,nu;
for (i=n; i<numchain; i++)
chains[i]=chains[i+1];
--numchain;
}
void chainedit()
{
int i,i1,i2,done,f;
char s[81],s1[81],s2[81],ch;
showchains();
done=0;
do {
nl();
prt(2,"Chains: D:elete, I:nsert, M:odify, Q:uit, ? : ");
ch=onek("QDIM?");
switch(ch) {
case '?':
showchains();
break;
case 'Q':
done=1;
break;
case 'M':
nl();
prt(2,"Chain number? ");
input(s,2);
i=atoi(s);
if ((s[0]!=0) && (i>=0) && (i<numchain))
modify_chain(i);
break;
case 'I':
if (numchain<50) {
nl();
prt(2,"Insert before which chain? ");
input(s,2);
i=atoi(s);
if ((s[0]!=0) && (i>=0) && (i<=numchain))
insert_chain(i);
}
break;
case 'D':
nl();
prt(2,"Delete which chain? ");
input(s,2);
i=atoi(s);
if ((s[0]!=0) && (i>=0) && (i<numchain)) {
nl();
ansic(5);
npr("Delete %s? ",chains[i].description);
if (yn())
delete_chain(i);
}
break;
}
} while ((!done) && (!hangup));
sprintf(s,"%sCHAINS.DAT",syscfg.datadir);
f=open(s,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
write(f,(void *)chains, numchain * sizeof(chainfilerec));
close(f);
}