misc/SETUP.PAS

37.2 KB 8b99499bd5c90822…
program setup;
uses crt,dos,gentypes,gensubs,configrt,skashit,control,myio;
type
ints = array[0..16] of integer;
const newyes : string = '|B1|15 yup |08|B0 nope ';
      newno  : string = '|B0|08 yup |15|B1 nope ';

saved : boolean = false;
yesstr = '|08Y|07E|15S';
nostr = '|08N|07O';
noentrystr = '|08N|07O |08E|07NTRY';
protfiles : Array[1..4] Of String[12] = ('PROT_R.DAT','PROT_S.DAT','PROT_U.DAT','PROT_D.DAT');
total : array[0..12] of integer = (17,9,16,11,10,7,12,14,6,13,11,19,6);
matrix : array[1..17] of string  =
('      |08B|07asic |08S|07ystem |08I|07nformation |08(|07i|08)     ',
 '      |08B|07asic |08S|07ystem |08I|07nformation |08(|07ii|08)    ',
 '          |08I|07nfusion |08D|07irectories         ',
 '        |08M|07odem/|08N|07ode |08C|07onfiguration       ',
 '          |08T|07elnet |08C|07onfiguration         ',
 '      |08I|07nformation |08F|07orms |08[|07infoforms|08]    ',
 '            |08A|07ccess |08V|07ariables           ',
 '            |08S|07ystem |08P|07asswords           ',
 '          |08N|07ew |08U|07ser |08A|07ccess / |08N|07UV        ',
 '         |08F|07ile |08A|07rea |08C|07onfiguration       ',
 '             |08S|07ystem |08C|07olors             ',
 '     |08E|07xternal |08F|07ile |08T|07ransfer |08P|07rotocols  ',
 '       |08E|07xternal |08D|07oor |08C|07onfiguration     ',
 '          |08M|07essage |08C|07onferences          ',
 '            |08F|07ile |08C|07onferences           ',
 '           |08T|07ext |08F|07ile |08A|07rchives          ',
 '             |08(|07Q|08)|07uit / |08C|07trl-Z           ');

cfgI : array[1..9] of string = (
' System Name           ',
' Sysop Handle          ',
' Co-Sysop Handle       ',
' System Phone Number   ',
' System Location       ',
' Registration Code One ',
' Registration Code Two ',
' Node Number           ',
' Cdrom Drive(s)        ');

cfgII : array[1..16] of string = (
' System Acronym             ',
' Use Lightbar Matrix        ',
' Total Number of Matrixes   ',
' Default Wfc Screen         ',
' Use Direct Screen Writes   ',
' Use Ems/Xms                ',
' Swap Memory for Dosshell   ',
' Force Local Sysop Logon    ',
' Minutes Until Screen Saver ',
' Is This a Closed System    ',
' Chat Cost to User          ',
' Allow Chat Time Start      ',
' Allow Chat Time End        ',
' Make Noise On Chat Page    ',
' Input Box Character        ',
' Use Input Box              ');

cfgIII : array[1..11] of string = (
' Infusion Root Directory    ',
' Infusion Data Directory    ',
' Infusion Text Directory    ',
' Infusion Menu Directory    ',
' Infusion Msgs Directory    ',
' Infusion Extract Directory ',
' Infusion Board Directory   ',
' Infusion Upload Directory  ',
' Infusion Door Directory    ',
' Infusion Screens Directory ',
' Infusion ICL Directory     ');

cfgIV : array[1..10] of string = (
' Is This A Multinode System ',
' Total Number of Nodes      ',
' Use a Fossil Driver        ',
' Comm Port For This Node    ',
' Locked Baudrate            ',
' Modem Init String          ',
' Modem Hangup String        ',
' Modem Off Hook String      ',
' Modem Answer String        ',
' Does Infusion Answer Phone '); {reverse boolean state}

cfgV : array[1..7] of string = (
' Is This a Telnet Node      ',
' Isp Domain Name            ',
' Netmodem Directory         ',
' Launch Netmodem On Init    ',
' Use Dialup Networking      ',
' Isp Session Name           ',
' Redial DUN on Disconnect   ');

cfgVI : array[1..12] of string = (
' Total Number of Infoforms  ',
' Required Infoforms         ',
' Infoform (1) Description   ',
' Infoform (1) Minimum Level ',
' Infoform (2) Description   ',
' Infoform (2) Minimum Level ',
' Infoform (3) Description   ',
' Infoform (3) Minimum Level ',
' Infoform (4) Description   ',
' Infoform (4) Minimum Level ',
' Infoform (5) Description   ',
' Infoform (5) Minimum Level ');

cfgVII : array[1..14] of string = (
' New User ACS Level        ',
' New User Note             ',
' New User File Level       ',
' New User File Points      ',
' New User U/D Ratio        ',
' New User U/D Kb Ratio     ',
' Daily Download KB Limit   ',
' Required P/C Ratio        ',
' Requied MSG Length        ',
' New User ACS Flags        ',
' Sysop ACS Level           ',
' Minimum Logon ACS Level   ',
' Ratio-Exempt ACS Level    ',
' Post Anonymous ACS Level  ');

cfgVIII : array[1..6] of string = (
' Matrix Password         ',
' New User Password (NUP) ',
' Sysop Password          ',
' Lowbaud Password        ',
' Local Keyboard Password ',
' Local Exit Password     ');

cfgIIX : array[1..13] of string = (
' Use New User Voting (NUV) ',
' NUV Infoform Number       ',
' Look in AUTOVAL.TXT first ',
' Minimum ACS Level To Vote ',
' Required Yes Votes        ',
' Required No Votes         ',
' Force NUV on ALL Users    ',
' Validate Accepted Users   ',
' Ban Rejected Users        ',
' Accepted User ACS Level   ',
' Accepted User File Level  ',
' Accepted User File Points ',
' Local AC User Percent     ');

cfgIX : array[1..11] of string = (
' Minimum HD Space For ULs  ',
' DSZLOG Path (required)    ',
' Require Diz/Sauce Use     ',
' Upload File Point Grant   ',
' # of K for Each Point     ',
' Upload Time % Returned    ',
' Cost Per Extracted File   ',
' MCI File Point String     ',
' MCI File Points String    ',
' Use Move.exe for Moving   ',
' Download Commision Points ');

cfgX : array[1..19] of string =(
' Default User Color One   ',
' Default User Color Two   ',
' Default User Color Three ',
' Default User Color Four  ',
' Default User Color Five  ',
' Default User Color Six   ',
' Default User Color Seven ',
' Yes Bar Display String   ',
' No Bar Display String    ',
' Yes Bar Color            ',
' No Bar Color             ',
' Uploaded By Color        ',
' Crazy Chat Color One     ',
' Crazy Chat Color Two     ',
' Crazy Chat Color Three   ',
' Crazy Chat Color Four    ',
' Crazy Chat Color Five    ',
' Crazy Chat Color Six     ',
' Crazy Chat Color Seven   ');

cfgXI : array[1..6] of string = (
' Edit Download Protocols   ',
' Edit Batch D/l Protocols  ',
' Edit Upload Protocols     ',
' Edit Batch U/l Protocols  ',
' Add Protocols             ',
' Delete Protocols          ');

{$I .\art\color.pas}
{$I .\art\config.art}
var current_bar,last:ints;quit : boolean;
CurFile : File Of ProtoRec;
Prot : Array[1..15] Of ProtoRec;

procedure err0r(c0de : integer);
begin
case c0de of
     1 : begin skawrite('|CR|08■ |07The supplied node does not exist|CR');
               skawrite('|08■ |07Usage - '+paramstr(0)+' <NODE_NUMBER>|CR');
               skawrite('|07  '+paramstr(0)+' 1  <- would load NODE1.DAT, etc|CR|CR');
               skawrite('|08■ |07Please run INITNODE <NODE_NUMBER> to initialize a new node..');
               writeln;writeln;halt(5);end;
end;
end;

procedure writeconfig(fn : string);
var f:file of configsettype;
begin
assign(f,fn);
rewrite(f);
write(f,cfg);
close(f);
end;

procedure b00lean(testvar : boolean);
begin
if testvar = true then skawrite(yesstr) else skawrite(nostr);
end;

procedure iwrite(strng : string);
begin
if strng = '' then skawrite(noentrystr) else write(strng);
end;

procedure colorwrite(color : integer);
    const colorstr : array [0..15] of string[8] =
      ('Black   ','Blue    ','Green   ','Cyan    ','Red     ','Purple  ',
       'Brown   ','White    ','Gray    ','Hi Blue ','Hi Green','Hi Cyan ',
       'Hi Red  ','Magenta ','Yellow  ','Hi White ');
begin
{back*16+forground}
textattr := color;
write(colorstr[Color and 15]+' on '+colorstr[(Color shr 4) and 7]);
end;

function strip(strng: string ) : string;
var check : integer;
begin
check := 0;
repeat
inc(check);
if strng[check] = #32 then inc(check)
until strng[check] <> #32;
strip := copy(strng,check,length(strng)-check);
end;

procedure header(head : string);
begin
textbackground(0);
clrscr;
gotoxy(1,1);skawrite('|B0|08■|07 '+strip(head));
end;

procedure drawscreen(scrn : integer);
var dummy,dummy2 : integer;
begin
case scrn of
          0 : move(config1,mem[$b800:0000],sizeof(config1));
          1 : begin
              header(matrix[1]);
              for dummy := 1 to 9 do
              begin
              gotoxy(1,2+dummy);skawrite('|B0|07'+cfgI[dummy]);
              end;
              gotoxy(30,3);iwrite(cfg.longname);
              gotoxy(30,4);iwrite(cfg.sysopname);
              gotoxy(30,5);iwrite(cfg.cosysopname);
              gotoxy(30,6);iwrite(cfg.boardphone);
              gotoxy(30,7);iwrite(cfg.location);
              gotoxy(30,8);skawrite(cfg.regcode1);
              gotoxy(30,9);skawrite(cfg.regcode2);
              gotoxy(30,10);write(cfg.nodenum);
              gotoxy(30,11);iwrite(cfg.cdrom);
              end;
          2 : begin
              header(matrix[2]);
              for dummy := 1 to 16 do begin
              gotoxy(1,2+dummy);skawrite('|B0|07'+cfgII[dummy]);
              end;
              gotoxy(30,3);write(cfg.shortname);
              gotoxy(30,4);if cfg.matrixtype = 0 then skawrite(nostr) else skawrite(yesstr);
              gotoxy(30,5);write(cfg.amtmatrix);
              gotoxy(30,6);write(cfg.defaultwfc);
              gotoxy(30,7);b00lean(cfg.directvideomode);
              gotoxy(30,8);b00lean(cfg.useems);
              gotoxy(30,9);b00lean(cfg.maxdosshell);
              gotoxy(30,10);b00lean(cfg.autologin);
              gotoxy(30,11);write(cfg.screensave);
              gotoxy(30,12);b00lean(cfg.private);
              gotoxy(30,13);write(cfg.chatcost);
              gotoxy(30,14);write(cfg.availtime);
              gotoxy(30,15);write(cfg.unavailtime);
              gotoxy(30,16);b00lean(cfg.chatnoise);
              gotoxy(30,17);write(cfg.boxchar);
              gotoxy(30,18);b00lean(cfg.usebox);
              end;
          3 : begin
              header(matrix[3]);
              for dummy := 1 to 11 do begin
              gotoxy(1,2+dummy);skawrite('|B0|07'+cfgIII[dummy]);
              end;
              gotoxy(30,3);iwrite(cfg.infusiondir);
              gotoxy(30,4);iwrite(cfg.datadir);
              gotoxy(30,5);iwrite(cfg.textfiledir);
              gotoxy(30,6);iwrite(cfg.menudir);
              gotoxy(30,7);iwrite(cfg.textdir);
              gotoxy(30,8);iwrite(cfg.extractdir);
              gotoxy(30,9);iwrite(cfg.boarddir);
              gotoxy(30,10);iwrite(cfg.uploaddir);
              gotoxy(30,11);iwrite(cfg.doordir);
              gotoxy(30,12);iwrite(cfg.screensdir);
              gotoxy(30,13);iwrite(cfg.icldir);
              end;
          4 : begin
              header(matrix[4]);
              for dummy := 1 to 10 do begin
              gotoxy(1,2+dummy);skawrite('|B0|07'+cfgIV[dummy]);
              end;
              gotoxy(30,3);b00lean(cfg.multinode);
              gotoxy(30,4);write(cfg.totalnodes);
              gotoxy(30,5);skawrite(yesstr);
              gotoxy(30,6);write(cfg.usecom);
              gotoxy(30,7);write(cfg.defbaudrate);
              gotoxy(30,8);iwrite(cfg.modemsetupstr);
              gotoxy(30,9);iwrite(cfg.modemhangupstr);
              gotoxy(30,10);iwrite(cfg.offhookstr);
              gotoxy(30,11);iwrite(cfg.autoanswerstr);
              gotoxy(30,12);if cfg.useautoanswer = true then skawrite(nostr) else skawrite(yesstr);
              end;
          5 : begin
              header(matrix[5]);
              for dummy := 1 to 7 do begin
              gotoxy(1,2+dummy);skawrite('|B0|07'+cfgV[dummy]);
              end;
              gotoxy(30,3);b00lean(cfg.telnetnode);
              gotoxy(30,4);iwrite(cfg.ispdomain);
              gotoxy(30,5);iwrite(cfg.netmodemdir);
              gotoxy(30,6);b00lean(cfg.launchnetmodem);
              gotoxy(30,7);b00lean(cfg.usedun);
              gotoxy(30,8);iwrite(cfg.ispsession);
              gotoxy(30,9);b00lean(cfg.redial);
              end;
         6 : begin
              header(matrix[6]);
             for dummy := 1 to 12 do begin
             gotoxy(1,2+dummy);skawrite('|B0|07'+cfgVI[dummy]);
             end;
             gotoxy(30,3);write(cfg.totalinfoforms);
             gotoxy(30,4);write(cfg.requiredforms);
             gotoxy(30,5);iwrite(cfg.infoformstr[1]);
             gotoxy(30,6);write(cfg.infoformlvl[1]);
             gotoxy(30,7);iwrite(cfg.infoformstr[2]);
             gotoxy(30,8);write(cfg.infoformlvl[2]);
             gotoxy(30,9);iwrite(cfg.infoformstr[3]);
             gotoxy(30,10);write(cfg.infoformlvl[3]);
             gotoxy(30,11);iwrite(cfg.infoformstr[4]);
             gotoxy(30,12);write(cfg.infoformlvl[4]);
             gotoxy(30,13);iwrite(cfg.infoformstr[5]);
             gotoxy(30,14);write(cfg.infoformlvl[5]);
             end;
         7 : begin
              header(matrix[7]);
             for dummy := 1 to 14 do begin
             gotoxy(1,2+dummy);skawrite('|B0|07'+cfgVII[dummy]);
             end;
             gotoxy(30,3);write(cfg.deflevel);
             gotoxy(30,4);iwrite(cfg.defusernote);
             gotoxy(30,5);write(cfg.defudlevel);
             gotoxy(30,6);write(cfg.defudpoints);
             gotoxy(30,7);write(cfg.defudratio);
             gotoxy(30,8);write(cfg.defudkratio);
             gotoxy(30,9);write(cfg.defdailykblimit);
             gotoxy(30,10);write(cfg.defpcr);
             gotoxy(30,11);write(cfg.defmsglength);
             gotoxy(30,12);write(cfg.defflags);
             gotoxy(30,13);write(cfg.sysoplevel);
             gotoxy(30,14);write(cfg.logonlevel);
             gotoxy(30,15);write(cfg.exemptlevel);
             gotoxy(30,16);write(cfg.anonymouslevel);
             end;
         8 : begin
              header(matrix[8]);
             for dummy := 1 to 6 do begin
             gotoxy(1,2+dummy);skawrite(cfgVIII[dummy]);
             end;
             gotoxy(30,3);iwrite(cfg.systempassword);
             gotoxy(30,4);iwrite(cfg.newuserpassword);
             gotoxy(30,5);iwrite(cfg.dospassword);
             gotoxy(30,6);iwrite(cfg.lowbaudpassword);
             gotoxy(30,7);iwrite(cfg.kbunlockpassword);
             gotoxy(30,8);iwrite(cfg.exitpassword);
            end;
        9 : begin
              header(matrix[9]);
            for dummy := 1 to 13 do begin
            gotoxy(1,2+dummy);skawrite('|B0|07'+cfgIIX[dummy]);
            end;
            gotoxy(30,3);b00lean(cfg.usenuv);
            gotoxy(30,4);write(cfg.nuvform);
            gotoxy(30,5);b00lean(cfg.useautoval);
            gotoxy(30,6);write(cfg.nuvuselevel);
            gotoxy(30,7);write(cfg.nuvy);
            gotoxy(30,8);write(cfg.nuvn);
            gotoxy(30,9);b00lean(cfg.autoaddnuv);
            gotoxy(30,10);b00lean(cfg.nuvvalidate);
            gotoxy(30,11);b00lean(cfg.nuvkill);
            gotoxy(30,12);write(cfg.nuvlevel);
            gotoxy(30,13);write(cfg.nuvudlevel);
            gotoxy(30,14);write(cfg.nuvpoints);
            gotoxy(30,15);write(cfg.percentlocal);
            end;
       10 : begin
            header(matrix[10]);
            for dummy := 1 to 11 do begin
            gotoxy(1,2+dummy);skawrite('|B0|07'+cfgIX[dummy]);
            end;
            gotoxy(30,3);write(cfg.minfreespace);
            gotoxy(30,4);iwrite(cfg.dszlog);
            gotoxy(30,5);b00lean(cfg.forcediz);
            gotoxy(30,6);write(cfg.uploadfactor);
            gotoxy(30,7);write(cfg.kperpoint);
            gotoxy(30,8);write(cfg.timepercentback,'%');
            gotoxy(30,9);write(cfg.extractcost);
            gotoxy(30,10);write(cfg.filepoint);
            gotoxy(30,11);write(cfg.filepoints);
            gotoxy(30,12);b00lean(cfg.usemove);
            gotoxy(30,13);write(cfg.pointcommision);
            end;
       11 : begin
            header(matrix[11]);
            for dummy := 1 to 19 do begin
            gotoxy(1,2+dummy);skawrite(cfgX[dummy]);
            end;
            gotoxy(30,3);colorwrite(cfg.defcolor1);
            gotoxy(30,4);colorwrite(cfg.defcolor2);
            gotoxy(30,5);colorwrite(cfg.defcolor3);
            gotoxy(30,6);colorwrite(cfg.defcolor4);
            gotoxy(30,7);colorwrite(cfg.defcolor5);
            gotoxy(30,8);colorwrite(cfg.defcolor6);
            gotoxy(30,9);colorwrite(cfg.defcolor7);
            gotoxy(30,10);skawrite('|B0|07'+cfg.yesstr);
            gotoxy(30,11);skawrite('|B0|07'+cfg.nostr);
            gotoxy(30,12);colorwrite(cfg.yescolor);
            gotoxy(30,13);colorwrite(cfg.nocolor);
            gotoxy(30,14);colorwrite(cfg.uploadedbycolor);
            for dummy := 1 to 7 do begin
            gotoxy(30,14+dummy);colorwrite(cfg.cc[dummy]);
            end;
            end;
       12 : begin
            clrscr;
            header(matrix[12]);
            for dummy := 1 to 6 do begin
            gotoxy(1,2+dummy);
            skawrite('|B0'+cfgXI[dummy]);
            end;
            end;
end;
end;



procedure init;
var f : file of configsettype;b : byte;
begin
textbackground(0);
skawrite('|08■|07 Infusion BBS Configuration (c)skaboy101 (Grant Passmore) / iDt 1997-98|CR');
skawrite('|08■|07 Initializing infusion setup ...|CR');
if not exist('NODE'+paramstr(1)+'.DAT') then err0r(1) else
begin;
configfile := 'NODE'+paramstr(1)+'.DAT';
skawrite('loading '+configfile+' .... ');delay(2000);
readcfg(false);
end;
skawrite('|08■|07 loading '+paramstr(1)+' data file ...|CR');
skawrite('|08■|07 allocating memory ... |CR');
skawrite('|08■|07 loading screen data ... |CR');
skawrite('|08■|07 initialization complete! .. loading setup program|CR');
cursor_(false);drawscreen(0);
end;

procedure drawbars(barnum : integer);
begin
if barnum = 0 then begin
gotoxy(32,4+last[0]);skawrite('|B0'+matrix[last[0]]);
gotoxy(32,4+current_bar[0]);skawrite('|B1'+matrix[current_bar[0]]);
end else if barnum = 1 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgI[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgI[current_bar[barnum]]);
end else if barnum =2 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgII[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgII[current_bar[barnum]]);
end else if barnum =3 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgIII[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgIII[current_bar[barnum]]);
end else if barnum =4 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgIV[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgIV[current_bar[barnum]]);
end else if barnum =5 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgV[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgV[current_bar[barnum]]);
end else if barnum =6 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgVI[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgVI[current_bar[barnum]]);
end else if barnum = 7 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgVII[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgVII[current_bar[barnum]]);
end else if barnum = 8 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgVIII[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgVIII[current_bar[barnum]]);
end else if barnum = 9  then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgIIX[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgIIX[current_bar[barnum]]);
end else if barnum = 10 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgIX[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgIX[current_bar[barnum]]);
end else if barnum = 11 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgX[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgX[current_bar[barnum]]);
end else if barnum = 12 then begin
gotoxy(1,2+last[barnum]);skawrite('|B0|07'+cfgXI[last[barnum]]);
gotoxy(1,2+current_bar[barnum]);skawrite('|B1|07'+cfgXI[current_bar[barnum]]);
end;
end;

function Int2Str(I: integer): String;
var
  S: string[11];
begin
  Str(I, S);
  Int2Str := S;
end;

function numberedit(x,y,number,total : integer) : integer;
var code : integer;
var numberstr : string;
begin
numberstr := int2str(number);
infield1(x,y,numberstr,total);
val(numberstr,number,code);
numberedit := number;
end;

function yesno(x,y : integer;vartocheck : boolean) : boolean;
var ak47 : char;ecsit : boolean;
begin
begin gotoxy(x,y);if (vartocheck = true) then skawrite(newyes)
else skawrite(newno);end;

repeat
ak47 := bioskey;
case ak47 of
#27 : ecsit := true;
#13 : ecsit := true;
#203..#205 : begin
       if vartocheck = true then begin
       gotoxy(x,y);
       skawrite(newno);
       vartocheck := false;
       end else if vartocheck = false then begin
       gotoxy(x,y);
       skawrite(newyes);
       vartocheck := true;
       end;
       end;
end;
until ecsit = true;
if vartocheck = true then begin gotoxy(x,y);skawrite(yesstr+'                     '); yesno := true end else
                           begin gotoxy(x,y);skawrite(nostr+'                      '); yesno := false;end;

end;

function choosecolor(curcolor : integer) : integer;
var sho : char;b,c,forground,background : integer;quitit : boolean;
begin
savepal;fadedown;move(colorscreen,mem[$b800:0000],sizeof(colorscreen));unfade;
textattr := curcolor;gotoxy(34,9);write('  selected  ');
textbackground(0);
forground := curcolor and 15;
background := curcolor shr 4 and 7;
gotoxy(25,5+forground);skawrite('|15■');
gotoxy(37,13+background);skawrite('|15■');
gotoxy(34,8);write(forground);gotoxy(44,8);write(background);
repeat
sho := bioskey;
case sho of
#13 : quitit := true;
#27 : quitit := true;
#200 : begin
       gotoxy(25,5+forground);write(#32);
       dec(forground);if forground < 0 then forground := 15;
       gotoxy(34,8);write(#32#32);gotoxy(34,8);write(forground);
       gotoxy(25,5+forground);skawrite('|15■');
       textattr := background*16+forground;gotoxy(34,9);write('  selected  ');
       textbackground(0);
       end;
#208 : begin
       gotoxy(25,5+forground);write(#32);gotoxy(34,8);write(#32#32);
       inc(forground);if forground > 15 then forground := 0;
       gotoxy(34,8);write(forground);
       gotoxy(25,5+forground);skawrite('|15■');
       textattr := background*16+forground;gotoxy(34,9);write('  selected  ');
       textbackground(0);
       end;
#205 : begin
       gotoxy(37,13+background);write(#32);gotoxy(44,8);write(#32#32);
       inc(background);if background > 7 then background := 0;
       gotoxy(44,8);write(background);
       gotoxy(37,13+background);skawrite('|15■');
       textattr := background*16+forground;gotoxy(34,9);write('  selected  ');
       textbackground(0);
       end;
#203 : begin
       gotoxy(37,13+background);write(#32);gotoxy(44,8);write(#32#32);
       dec(background);if background < 0 then background := 7;
       gotoxy(44,8);write(background);
       gotoxy(37,13+background);skawrite('|15■');
       textattr := background*16+forground;gotoxy(34,9);write('  selected  ');
       textbackground(0);
       end;
end;
until quitit = true;
choosecolor := background*16+forground;
textbackground(0);
end;

Procedure procedit(chase : integer);
var dumbbool,dumbbool1 : boolean;
    boxChar : string;
begin
cursor_(true);
dumbbool1 := true;
if chase = 1 then begin
                     if current_bar[1] = 1 then infield1(30,3,cfg.longname,30);
                     if current_bar[1] = 2 then infield1(30,4,cfg.sysopname,16);
                     if current_bar[1] = 3 then infield1(30,5,cfg.cosysopname,16);
                     if current_bar[1] = 4 then infield1(30,6,cfg.boardphone,16);
                     if current_bar[1] = 5 then infield1(30,7,cfg.location,30);
                     if current_bar[1] = 6 then infield1(30,8,cfg.regcode1,12);
                     if current_bar[1] = 7 then infield1(30,9,cfg.regcode2,12);
                     if current_bar[1] = 8 then cfg.nodenum := numberedit(30,10,cfg.nodenum,3);
                     if current_bar[1] = 9 then infield1(30,11,cfg.cdrom,30);
                     end
else if chase = 2 then begin
              if current_bar[2] = 1 then infield1(30,3,cfg.shortname,5);
              if current_bar[2] = 2 then begin dumbbool1 := yesno(30,4,dumbbool1);
              if dumbbool1 = true then cfg.matrixtype := 2 else cfg.matrixtype := 0;
              end;
              if current_bar[2] = 3 then cfg.amtmatrix := numberedit(30,5,cfg.amtmatrix,3);
              if current_bar[2] = 4 then infield1(30,6,cfg.defaultwfc,16);
              if current_bar[2] = 5 then cfg.directvideomode := yesno(30,7,cfg.directvideomode);
              if current_bar[2] = 6 then cfg.useems :=  yesno(30,8,cfg.useems);
              if current_bar[2] = 7 then cfg.maxdosshell := yesno(30,9,cfg.maxdosshell);
              if current_bar[2] = 8 then cfg.autologin := yesno(30,10,cfg.autologin);
              if current_bar[2] = 9 then cfg.screensave := numberedit(30,11,cfg.screensave,2);
              if current_bar[2] = 10 then cfg.private := yesno(30,12,cfg.private);
              if current_bar[2] = 11 then cfg.chatcost := numberedit(30,13,cfg.chatcost,5);
              if current_bar[2] = 12 then infield1(30,14,cfg.availtime,8);
              if current_bar[2] = 13 then infield1(30,15,cfg.unavailtime,8);
              if current_bar[2] = 14 then cfg.chatnoise := yesno(30,16,cfg.chatnoise);
              if current_bar[2] = 15 then begin
                 boxChar := cfg.boxchar;
                 infield1(30,17,boxchar,1);
                 cfg.boxChar := boxchar[1];
                 end;
              if current_bar[2] = 16 then cfg.usebox := yesNo(30,18,cfg.useBox);
              end else
if chase = 3 then begin
              if current_bar[3] = 1 then infield1(30,3,cfg.infusiondir,30);
              if current_bar[3] = 2 then infield1(30,4,cfg.datadir,30);
              if current_bar[3] = 3 then infield1(30,5,cfg.textfiledir,30);
              if current_bar[3] = 4 then infield1(30,6,cfg.menudir,30);
              if current_bar[3] = 5 then infield1(30,7,cfg.textdir,30);
              if current_bar[3] = 6 then infield1(30,8,cfg.extractdir,30);
              if current_bar[3] = 7 then infield1(30,9,cfg.boarddir,30);
              if current_bar[3] = 8 then infield1(30,10,cfg.uploaddir,30);
              if current_bar[3] = 9 then infield1(30,11,cfg.doordir,30);
              if current_bar[3] = 10 then infield1(30,12,cfg.screensdir,30);
              if current_bar[3] = 11 then infield1(30,13,cfg.icldir,30);
              end else
if chase = 4 then begin
              if current_bar[4] = 1 then cfg.multinode := yesno(30,3,cfg.multinode);
              if current_bar[4] = 2 then cfg.totalnodes := numberedit(30,4,cfg.totalnodes,3);
              if current_bar[4] = 3 then cfg.usefossil := yesno(30,5,cfg.usefossil);
              if current_bar[4] = 4 then cfg.usecom := numberedit(30,6,cfg.usecom,1);
              if current_bar[4] = 5 then cfg.defbaudrate := numberedit(30,7,cfg.defbaudrate,6);
              if current_bar[4] = 6 then infield1(30,8,cfg.modemsetupstr,12);
              if current_bar[4] = 7 then infield1(30,9,cfg.modemhangupstr,12);
              if current_bar[4] = 8 then infield1(30,10,cfg.offhookstr,12);
              if current_bar[4] = 9 then infield1(30,11,cfg.autoanswerstr,12);
              if current_bar[4] = 10 then begin
              if cfg.useautoanswer = true then dumbbool := false  else dumbbool := true;
              DUMBBOOL := yesno(30,12,dumbbool);
              if dumbbool = true then cfg.useautoanswer := false else cfg.useautoanswer := true;
              end;
              end else
if chase = 5 then begin
              if current_bar[5] = 1 then cfg.telnetnode := yesno(30,3,cfg.telnetnode);
              if current_bar[5] = 2 then infield1(30,4,cfg.ispdomain,30);
              if current_bar[5] = 3 then infield1(30,5,cfg.netmodemdir,30);
              if current_bar[5] = 4 then cfg.launchnetmodem := yesno(30,6,cfg.launchnetmodem);
              if current_bar[5] = 5 then cfg.usedun := yesno(30,7,cfg.usedun);
              if current_bar[5] = 6 then infield1(30,8,cfg.ispsession,30);
              if current_bar[5] = 7 then cfg.redial := yesno(30,9,cfg.redial);
              end else
if chase = 6 then begin
             if current_bar[6] = 1 then cfg.totalinfoforms := numberedit(30,3,cfg.totalinfoforms,3);
             if current_bar[6] = 2 then infield1(30,4,cfg.requiredforms,15);
             if current_bar[6] = 3 then infield1(30,5,cfg.infoformstr[1],30);
             if current_bar[6] = 4 then cfg.infoformlvl[1] := numberedit(30,6,cfg.infoformlvl[1],5);
             if current_bar[6] = 5 then infield1(30,7,cfg.infoformstr[2],30);
             if current_bar[6] = 6 then cfg.infoformlvl[2] := numberedit(30,8,cfg.infoformlvl[2],5);
             if current_bar[6] = 7 then infield1(30,9,cfg.infoformstr[3],30);
             if current_bar[6] = 8 then cfg.infoformlvl[3] := numberedit(30,10,cfg.infoformlvl[3],5);
             if current_bar[6] = 9 then infield1(30,11,cfg.infoformstr[4],30);
             if current_bar[6] = 10 then cfg.infoformlvl[4] := numberedit(30,12,cfg.infoformlvl[4],5);
             if current_bar[6] = 11 then infield1(30,13,cfg.infoformstr[5],30);
             if current_bar[6] = 12 then cfg.infoformlvl[5] := numberedit(30,14,cfg.infoformlvl[5],5);
             end else
if chase = 7 then begin
             if current_bar[7] = 1 then cfg.deflevel := numberedit(30,3,cfg.deflevel,5);
             if current_bar[7] = 2 then infield1(30,4,cfg.defusernote,30);
             if current_bar[7] = 3 then cfg.defudlevel := numberedit(30,5,cfg.defudlevel,5);
             if current_bar[7] = 4 then cfg.defudpoints := numberedit(30,6,cfg.defudpoints,5);
             if current_bar[7] = 5 then cfg.defudratio := numberedit(30,7,cfg.defudratio,5);
             if current_bar[7] = 6 then cfg.defudkratio := numberedit(30,8,cfg.defudkratio,5);
             if current_bar[7] = 7 then cfg.defdailykblimit := numberedit(30,9,cfg.defdailykblimit,5);
             if current_bar[7] = 8 then cfg.defpcr := numberedit(30,10,cfg.defpcr,5);
             if current_bar[7] = 9 then cfg.defmsglength := numberedit(30,11,cfg.defmsglength,5);
             if current_bar[7] = 10 then infield1(30,12,cfg.defflags,30);
             if current_bar[7] = 11 then cfg.sysoplevel := numberedit(30,13,cfg.sysoplevel,5);
             if current_bar[7] = 12 then cfg.logonlevel := numberedit(30,14,cfg.logonlevel,5);
             if current_bar[7] = 13 then cfg.exemptlevel := numberedit(30,15,cfg.exemptlevel,5);
             if current_bar[7] = 14 then cfg.anonymouslevel := numberedit(30,16,cfg.anonymouslevel,5);
             end else
if chase = 8 then begin
             if current_bar[8] = 1 then infield1(30,3,cfg.systempassword,30);
             if current_bar[8] = 2 then infield1(30,4,cfg.newuserpassword,30);
             if current_bar[8] = 3 then infield1(30,5,cfg.dospassword,30);
             if current_bar[8] = 4 then infield1(30,6,cfg.lowbaudpassword,30);
             if current_bar[8] = 5 then infield1(30,7,cfg.kbunlockpassword,30);
             if current_bar[8] = 6 then infield1(30,8,cfg.exitpassword,30);
             end else
if chase = 9 then begin
             if current_bar[9] = 1 then cfg.usenuv := yesno(30,3,cfg.usenuv);
             if current_bar[9] = 2 then cfg.nuvform := numberedit(30,4,cfg.nuvform,1);
             if current_bar[9] = 3 then cfg.useautoval := yesno(30,5,cfg.useautoval);
             if current_bar[9] = 4 then cfg.nuvuselevel := numberedit(30,6,cfg.nuvuselevel,5);
             if current_bar[9] = 5 then cfg.nuvy := numberedit(30,7,cfg.nuvy,3);
             if current_bar[9] = 6 then cfg.nuvn := numberedit(30,8,cfg.nuvn,3);
             if current_bar[9] = 7 then cfg.autoaddnuv := yesno(30,9,cfg.autoaddnuv);
             if current_bar[9] = 8 then cfg.nuvvalidate := yesno(30,10,cfg.nuvvalidate);
             if current_bar[9] = 9 then cfg.nuvkill := yesno(30,11,cfg.nuvkill);
             if current_bar[9] = 10 then cfg.nuvlevel := numberedit(30,12,cfg.nuvlevel,5);
             if current_bar[9] = 11 then cfg.nuvudlevel := numberedit(30,13,cfg.nuvudlevel,5);
             if current_bar[9] = 12 then cfg.nuvpoints := numberedit(30,14,cfg.nuvpoints,5);
             if current_bar[9] = 13 then cfg.percentlocal := numberedit(30,15,cfg.percentlocal,5);
             end else
if chase = 10 then begin
             if current_bar[10] = 1 then cfg.minfreespace := numberedit(30,3,cfg.minfreespace,10);
             if current_bar[10] = 2 then infield1(30,4,cfg.dszlog,30);
             if current_bar[10] = 3 then cfg.forcediz := yesno(30,5,cfg.forcediz);
             if current_bar[10] = 4 then cfg.uploadfactor := numberedit(30,6,cfg.uploadfactor,5);
             if current_bar[10] = 5 then cfg.kperpoint := numberedit(30,7,cfg.kperpoint,5);
             if current_bar[10] = 6 then cfg.timepercentback := numberedit(30,8,cfg.timepercentback,5);
             if current_bar[10] = 7 then cfg.extractcost := numberedit(30,9,cfg.extractcost,5);
             if current_bar[10] = 8 then infield1(30,10,cfg.filepoint,16);
             if current_bar[10] = 9 then infield1(30,11,cfg.filepoints,16);
             if current_bar[10] = 10 then cfg.usemove := yesno(30,12,cfg.usemove);
             if current_bar[10] = 11 then cfg.pointcommision := numberedit(30,13,cfg.pointcommision,5);
             end else
if chase = 11 then begin
            if current_bar[11] = 1 then cfg.defcolor1 := choosecolor(cfg.defcolor1);
            if current_bar[11] = 2 then cfg.defcolor2 := choosecolor(cfg.defcolor2);
            if current_bar[11] = 3 then cfg.defcolor3 := choosecolor(cfg.defcolor3);
            if current_bar[11] = 4 then cfg.defcolor4 := choosecolor(cfg.defcolor4);
            if current_bar[11] = 5 then cfg.defcolor5 := choosecolor(cfg.defcolor5);
            if current_bar[11] = 6 then cfg.defcolor6 := choosecolor(cfg.defcolor6);
            if current_bar[11] = 7 then cfg.defcolor7 := choosecolor(cfg.defcolor7);
            if current_bar[11] = 8 then infield1(30,10,cfg.yesstr,16);
            if current_bar[11] = 9 then infield1(30,11,cfg.nostr,16);
            if current_bar[11] = 10 then cfg.yescolor := choosecolor(cfg.yescolor);
            if current_bar[11] = 11 then cfg.nocolor := choosecolor(cfg.nocolor);
            if current_bar[11] = 12 then cfg.uploadedbycolor := choosecolor(cfg.uploadedbycolor);
            if current_bar[11] = 13 then cfg.cc[1] := choosecolor(cfg.cc[1]);
            if current_bar[11] = 14 then cfg.cc[2] := choosecolor(cfg.cc[2]);
            if current_bar[11] = 15 then cfg.cc[3] := choosecolor(cfg.cc[3]);
            if current_bar[11] = 16 then cfg.cc[4] := choosecolor(cfg.cc[4]);
            if current_bar[11] = 17 then cfg.cc[5] := choosecolor(cfg.cc[5]);
            if current_bar[11] = 18 then cfg.cc[6] := choosecolor(cfg.cc[6]);
            if current_bar[11] = 19 then cfg.cc[7] := choosecolor(cfg.cc[7]);
            end;

drawscreen(chase);
drawbars(chase);
cursor_(false);
end;

Procedure config(section : integer);
var k : char;
begin
drawscreen(section);
drawbars(section);
repeat
k := bioskey;
case k of
#13 : procedit(section);
#26..#27,'Q' : quit := true;
#200 : begin
       last[section] := current_bar[section];
       dec(current_bar[section]);
       if current_bar[section] < 1 then current_bar[section] := total[section];
       drawbars(section);
       end;

#208 : begin
       last[section] := current_bar[section];
       inc(current_bar[section]);
       if current_bar[section] > total[section] then current_bar[section] := 1;
       drawbars(section);
       end;
end;

until (quit = true);
drawscreen(0);drawbars(0);
quit := false;
end;

procedure process(proc : integer);
begin
case proc of
     1 : begin
         case current_bar[0] of
         1..16 : config(current_bar[0]);
         17 : quit := true;
         end;

end;
end;
end;

procedure domatrix;
var k : char;
begin
repeat
k := bioskey;
case upcase(k) of
#13  : process(1);
#26..#27,'Q'  : quit := true;
#196 : writeconfig('NODE'+paramstr(1)+'.DAT');

#200 : begin
       last[0] := current_bar[0];
       dec(current_bar[0]);
       if current_bar[0] < 1 then current_bar[0] := total[0];
       drawbars(0);
       end;

#208 : begin
       last[0] := current_bar[0];
       inc(current_bar[0]);
       if current_bar[0] > total[0] then current_bar[0] := 1;
       drawbars(0);
       end;
end;
until (quit);
if (saved=false) then
 begin
  newyes := '|B1|15  Yup  |B0  |08Nope  ';
  newno  := '|B0|08  Yup  |B1  |15Nope  ';
  gotoxy(42,23);skawrite('|B0|08■ |07save yer changes |08■');
  if (yesno(44,24,saved)=true) then writeconfig('NODE'+paramstr(1)+'.DAT');
 end;
end;


var x : integer;
begin
for x := 0 to 15 do begin last[x] := 1;current_bar[x] := 1;end;

if paramstr(2) = 'modem' then
 begin
  current_bar[0] := 4;config(current_bar[0]);
 end else
if paramstr(2) = 'telnet' then
 begin
  current_bar[0]:=5;config(current_bar[0]);
 end;


if cfg.icldir = '' then cfg.icldir := 'C:\INFUSION\ICL\';
init;
drawbars(0);
domatrix;
textbackground(0);
clrscr;
skawrite('|08--|07 Infusion Bulletin Board System ver '+coolvernum+' Configuration Program by skaboy101|CR');
skawrite('|08--|07 (C)Copyright Grant Passmore (skaboy101) / iDt 1997-98|CR');
cursor_(true);
end.