home *** CD-ROM | disk | FTP | other *** search
- overlay procedure waitcall;
-
- var wscount:integer;
- lt:real;
- mustgetbaud:boolean;
- which:integer;
- xcount:integer;
-
- procedure maybewritestatus;
- begin
- wscount:=wscount+1;
- if wscount>10 then begin
- writestatus;
- wscount:=0
- end
- end;
-
- function checkforhayesreport:boolean; { Looks for CONNECT 300 }
- var n:real;
- q:sstr;
- p,b:integer;
- k:char;
- brate:baudratetype;
- const lookfor:sstr=#13#10'CONNECT ';
- begin
- checkforhayesreport:=false;
- if numchars=0 then exit;
- p:=1;
- q:='';
- b:=0;
- repeat
- n:=realtime;
- repeat until (realtime>n+15) or (numchars>0);
- if numchars=0 then exit else k:=getchar;
- if (k=#13) and (length(q)>0) then begin
- val (q,b,p);
- brate:=b110;
- while (brate<=b9600) and
- ((b<>baudarray[brate])
- or (not (brate in supportedrates)))
- do brate:=succ(brate);
- if brate<=b9600 then begin
- parity:=false;
- baudrate:=b;
- checkforhayesreport:=true;
- mustgetbaud:=false;
- n:=realtime;
- repeat until carrier or (realtime>n+45)
- end;
- exit
- end;
- if p>length(lookfor) then q:=q+k else begin
- if k=lookfor[p] then p:=p+1 else begin
- b:=b+1;
- if b=2 then exit
- end
- end
- until false
- end;
-
- procedure sendprompt;
- begin
- online:=true;
- write ('System: Press [ENTER] :');
- online:=false;
- end;
-
- procedure receivecall;
- var b:byte;
- timeout,autoswitch:integer;
- k:char;
- brate:baudratetype;
-
- procedure nextrate (var b:baudratetype);
- var ob:baudratetype;
- begin
- ob:=b;
- repeat
- b:=succ(b);
- if b>b9600 then b:=b110;
- if b=ob then exit
- until b in supportedrates
- end;
-
- procedure disconnect;
- begin
- if carrier then hangupmodem;
- baudrate:=defbaudrate;
- parity:=false;
- setparam (usecom,baudrate,parity);
- setupmodem
- end;
-
- function seconds:integer;
- var r:regs;
- begin
- r.ah:=$2c;
- intr ($21,r);
- seconds:=r.dh
- end;
-
- label abort,connected;
- begin
- local:=false;
- online:=false;
- textcolor (normbotcolor);
- window (1,1,80,25);
- clrscr;
- window (1,1,80,24);
- if not mustgetbaud then goto connected;
- writeln;
- brate:=b110;
- parity:=false;
- timeout:=timer+2;
- repeat
- nextrate (brate);
- baudrate:=baudarray[brate];
- writeln (usr,^M^J'Trying ',baudrate,' BAUD: ');
- setparam (usecom,baudrate,parity);
- sendprompt;
- autoswitch:=seconds+3;
- if autoswitch>59 then autoswitch:=autoswitch-60;
- repeat until (not carrier) or (numchars>0) or (keyhit) or
- (timer>=timeout) or (autoswitch=seconds);
- if timer>=timeout then hangupmodem;
- if not carrier then goto abort;
- if keyhit
- then
- begin
- k:=bioskey;
- case upcase(k) of
- #13:goto connected;
- 'D':goto abort;
- end
- end
- else
- begin
- if numchars>0 then begin
- b:=ord(getchar);
- write (usr,b,' received.')
- end else b:=0;
- if b<>13
- then if b=141
- then parity:=true
- else
- begin
- delay (200);
- while numchars>0 do b:=ord(getchar)
- end
- end
- until (b=13) or (b=141) or (timer>timeout);
- if timer<=timeout then begin
- connected:
- setparam (usecom,baudrate,parity);
- baudstr:=strr(baudrate)+','+baudstr+',1';
- online:=true;
- urec.config:=[lowercase,linefeeds,eightycols];
- newcalls:=newcalls+1;
- if carrier then exit
- end;
- abort:
- disconnect
- end;
-
- procedure exitprog(x:byte);
- begin
- if X<>1 then resetit else
- offhook;
- window (1,1,80,25);
- textcolor (normtopcolor);
- textbackground (0);
- clrscr;
- gotoxy (30,24);
- ensureclosed;
- halt(4)
- end;
-
- procedure checkday;
- begin
- if lastdayup<>datestr then begin
- lastdayup:=datestr;
- numdaysup:=numdaysup+1;
- callstoday:=0;
- writestatus;
- gotoxy (71,5);
- write (usr,callstoday:3);
- end
- end;
-
- function statusscreen:char;
- const statwindx=5;
- statwindy=1;
- firstcolx=21;
- firstline=5;
- secondcolx=57;
-
- procedure col1;
- begin
- window (statwindx+firstcolx,statwindy+firstline,80,25);
- end;
-
- procedure col2;
- begin
- window (statwindx+secondcolx,statwindy+firstline,80,25);
- end;
-
- procedure percent (r1,r2:real);
- begin
- if (r2<1) then exit;
- r2:=round((r1/r2)*1000)/10;
- write (usr,r2:6:1)
- end;
-
- procedure drawstatus;
- var tmp:integer;
- totalidle,totalup,totalmins,r:real;
- begin
- if carrier or keyhit then exit;
- window (22,5,29,16);
- textcolor (15);
- gotoxy (1,3);
- totalidle:=numminsidle.total+elapsedtime(numminsidle);
- write (usr,totalidle:7:0);
- gotoxy (1,6);
- r:=round(10*numcallers/numdaysup)/10;
- write (usr,r:7:1);
- gotoxy (1,11);
- write (usr,numdaysup:7);
- gotoxy (1,12);
- totalup:=totalidle+numminsused.total;
- write (usr,totalup:7:0);
- totalmins:=1440.0*(numdaysup-1.0)+timer;
- window (22,17,29,22);
- gotoxy (2,1);
- percent (numminsused.total,totalmins);
- gotoxy (2,2);
- percent (numminsxfer.total,totalmins);
- gotoxy (2,3);
- percent (totalidle,totalmins);
- gotoxy (2,4);
- percent (totalup,totalmins);
- gotoxy (2,5);
- percent (totalmins-totalup,totalmins);
- window (1,1,80,25);
- textcolor(4);
- gotoxy (31,3);
- write (usr,timestr:8);
- gotoxy (40,3);
- write (usr,datestr:8);
- {*gotoxy (47,5);
- tmp:=elapsedtime(numminsidle);
- write (usr,tmp:4);*}
- textcolor(15);
- gotoxy (1,1);
- end;
-
- procedure writeavail;
- var m:sstr;
-
- begin
- gotoxy (48,6);
- m:=sysopavailstr;
- if m='By time: No' then m:='No';
- if m='By time: Yes' then m:='Yes';
- write (usr,'Sysop Available: ',m:3);
- gotoxy (1,1)
- end;
-
- var cnt,numsmail:integer;
- k:char;
- tmp:mstr;
- b,c:byte;
- done,kool:boolean;
- f:char;
- sowhat:anystr;
-
- function shouldexit:boolean;
- begin
- shouldexit:=done or carrier
- end;
-
- procedure handlekey (k:char; beforeabout:boolean);
- begin
- b:=ord(k);
- kool:=true;
- case b of
- 50:begin
- toggleavail;
- if not beforeabout then writeavail
- end;
- 51:answer;
- 49,52,53,54:begin
- done:=true;
- statusscreen:=k
- end;
- end;
- end;
-
- function interrupted (beforeabout:boolean):boolean;
- begin
- if keyhit then begin
- k:=bioskey;
- handlekey (k,beforeabout)
- end;
- done:=done or carrier;
- interrupted:=done;
- end;
-
- begin
- statusscreen:=#0;
- window (1,1,80,25);
- sta:=false;
- done:=false;
- sowhat:=getlastcaller;
- if ansiwait then
- dos_shell ('Waitscrn xcr1000Marcy Y') else dos_shell('Waitscrn xcr1000Marcy N');
- textcolor(1);
- gotoxy (2,5);
- write (usr,'Total Mins Used:');
- gotoxy (2,6);
- write (usr,'Mins Used By Xfer:');
- gotoxy (2,7);
- write (usr,'Minutes Idle:');
- gotoxy (2,8);
- write (usr,'New Calls:');
- gotoxy(2,9);
- write (usr,'New Posts:');
- gotoxy(2,10);
- write (usr,'Calls/Day:');
- gotoxy(2,11);
- write (usr,'New Uploads:');
- gotoxy(2,12);
- write (usr,'New Feedback:');
- gotoxy(2,13);
- write (usr,'New Mail:');
- gotoxy(2,14);
- write (usr,'Number of Calls:');
- gotoxy(2,15);
- write (usr,'Number of Days Up:');
- gotoxy(2,16);
- write (usr,'Total Up:');
- gotoxy(2,17);
- write (usr,'Percent Used:');
- gotoxy(2,18);
- write (usr,'Percent Xfer:');
- gotoxy(2,19);
- write (usr,'Percent Idle:');
- gotoxy(2,20);
- write (usr,'Percent Up:');
- gotoxy(2,21);
- write (usr,'Percent Down:');
- gotoxy (1,25);
- write (usr,' ');
- gotoxy (48,15);
- write (usr,'[1] - Local Login (off-hook)');
- gotoxy (48,16);
- write (usr,'[2] - Toggle Sysop Available');
- gotoxy (48,17);
- write (usr,'[3] - Answer Modem');
- gotoxy (48,18);
- write (usr,'[4] - Exit (0)');
- gotoxy (48,19);
- write (usr,'[5] - Exit (1)');
- movexy (35,1);
- textcolor (15);
- write (usr,'Utopia BBS');
- window (22,5,29,16);
- checkday;
- gotoxy (1,1);
- write (usr,numminsused.total:7:0); {1}
- gotoxy (1,2);
- write (usr,numminsxfer.total:7:0); {2}
- gotoxy (1,4);
- write (usr,newcalls:7); {4}
- gotoxy (1,5);
- write (usr,newposts:7); {5}
- gotoxy (1,7);
- write (usr,newuploads:7); {7}
- gotoxy (1,8);
- write (usr,newfeedback:7); {8}
- gotoxy (1,9);
- write (usr,newmail:7); {9}
- gotoxy (1,10);
- write (usr,numcallers:7:0); {10}
- window (1,1,80,25);
- gotoxy (48,8);
- Write (usr,'Last Caller: ');
- gotoxy (61,8);
- Write (usr,sowhat);
- gotoxy (48,5);
- Write (usr,'Num Calls Today:');
- gotoxy (65,5);
- Write (usr,callstoday:3);
- writeavail;
- repeat
- checkday;
- drawstatus;
- cnt:=0;
- repeat
- delay (250);
- cnt:=cnt+1;
- done:=done or checkforhayesreport
- until (cnt>=240) or done or interrupted (false)
- until done
- end;
-
-
- var k:char;
- label exit;
- begin
- starttimer (numminsidle);
- wscount:=0;
- clrscr;
- repeat
- doanswer;
- mustgetbaud:=true;
- k:=statusscreen;
- if carrier then begin
- receivecall;
- if carrier then goto exit;
- end;
- case ord(k) of
- 52:begin
- local:=false;
- online:=false;
- writestatus;
- goto exit
- end;
- 53:exitprog(0);
- 54:exitprog(1);
- 49:begin
- offhook;
- local:=true;
- online:=false;
- newfeedback:=0;
- newcalls:=0;
- newmail:=0;
- newuploads:=0;
- newposts:=0;
- writestatus;
- goto exit
- end
- end
- until 0=1;
- exit:
- write (normvid);
- window (1,1,80,25);
- clrscr
- end;
-