home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / gammon20.zip / COMMTAG.PAS < prev    next >
Pascal/Delphi Source File  |  1991-06-19  |  17KB  |  769 lines

  1. {Common.Tag for WWIV doors on T.A.G BBS.  Turbo-Pascal 5.0
  2.  by Joel Bergen ProVision BBS 206-353-6966
  3.  
  4. Version 1.0
  5.  
  6. Features of COMMON.TAG:
  7.  
  8.      Reads DOOR.SYS instead of CHAIN.TXT
  9.      Does does all I/O through the FOSSIL driver.
  10.      Outputs ANSI escape codes instead of ^C WWIV color codes.
  11.  
  12. This unit can be used to recompile WWIV doors for use by T.A.G and GAP BBS
  13. }
  14.  
  15. {$R-}    {Range checking off}
  16. {$B+}    {Boolean complete evaluation on}
  17. {$S+}    {Stack checking on}
  18. {$I+}    {I/O checking on}
  19. {$N-}    {No numeric coprocessor}
  20. {$M 65500,16384,655360} {Turbo 3 default stack and heap}
  21.  
  22. Uses
  23.   Dos, Fossil, crt;
  24.  
  25. TYPE
  26.      userrec=record
  27.                name:string[25];
  28.                realname:string[14];
  29.                laston:string[10];
  30.                linelen:byte;
  31.                pagelen:byte;
  32.                sl:byte;
  33.                age:byte;
  34.                sex:char;
  35.                callsign:string[8];
  36.                gold:real;
  37.              end;
  38.       regs=registers;
  39.  
  40. var
  41.     usernum,baudrate:integer;
  42.     incom,okansi,cs,so,hangup:boolean;
  43.     timeon,timeleft:real;
  44.     thisuser:userrec;
  45.     rp:regs;
  46.     ComPort:byte;
  47.     lastkey:real;
  48.     current_color:byte;
  49.     stdout : text;
  50.  
  51. function cstr(i:longint):string;
  52. var c:string;
  53. begin
  54.   str(i,c); cstr:=c;
  55. end;
  56.  
  57. function timer:real;
  58. var reg:registers;
  59.     h,m,s,t:real;
  60. begin
  61.   reg.ax:=44*256;
  62.   msdos(Dos.Registers(reg));
  63.   h:=(reg.cx div 256);
  64.   m:=(reg.cx mod 256);
  65.   s:=(reg.dx div 256);
  66.   t:=(reg.dx mod 256);
  67.   timer:=h*3600+m*60+s+t/100;
  68. end;
  69.  
  70. function nsl:real;
  71. begin
  72.   if timer<timeon then
  73.     timeon:=timeon-24.0*3600.0;
  74.   nsl:=timeleft-(timer-timeon);
  75. end;
  76.  
  77. function sysop1:boolean;
  78. begin
  79.   sysop1:=false;
  80. end;
  81.  
  82. function sysop:boolean;
  83. begin
  84.   sysop:=sysop1;
  85. end;
  86.  
  87. procedure sl1(i:string);
  88. begin
  89. end;
  90.  
  91. procedure sysoplog(i:string);
  92. begin
  93. end;
  94.  
  95. function tch(i:string):string;
  96. begin
  97.   if length(i)>2 then i:=copy(i,length(i)-1,2) else
  98.     if length(i)=1 then i:='0'+i;
  99.   tch:=i;
  100. end;
  101.  
  102. function time:string;
  103. var reg:registers;
  104.     zt:integer;
  105.     h,m,s:string[4];
  106. begin
  107.   reg.ax:=$2c00; intr($21,Dos.Registers(reg));
  108.   zt:=reg.cx shr 8;  h:=cstr(zt);
  109.   zt:=reg.cx mod 256; str(zt,m); str(reg.dx shr 8,s);
  110.   time:=tch(h)+':'+tch(m)+':'+tch(s);
  111. end;
  112.  
  113. function date:string;
  114. var reg:registers;
  115.     m,d,y:string[4];
  116. begin
  117.   reg.ax:=$2a00; msdos(Dos.Registers(reg)); str(reg.cx,y); str(reg.dx mod 256,d);
  118.   str(reg.dx shr 8,m);
  119.   date:=tch(m)+'/'+tch(d)+'/'+tch(y);
  120. end;
  121.  
  122. function value(I:string):integer;
  123. var n,n1:integer;
  124. begin
  125.   val(i,n,n1);
  126.   if n1<>0 then begin
  127.     i:=copy(i,1,n1-1);
  128.     val(i,n,n1)
  129.   end;
  130.   value:=n;
  131.   if i='' then value:=0;
  132. end;
  133.  
  134.  
  135. function nam:string;
  136. var s:string; i:integer; tf:boolean;
  137. begin
  138.   s:=thisuser.name;
  139.   tf:=true;
  140.   for i:=1 to length(s) do
  141.     if s[i]<'A' then
  142.       tf:=true
  143.     else begin
  144.       if (s[i]<='Z') and not tf then
  145.         s[i]:=chr(ord(s[i])+32);
  146.       tf:=false;
  147.     end;
  148.   nam:=s+' #'+cstr(usernum);
  149. end;
  150.  
  151. function leapyear(yr:integer):boolean;
  152. begin
  153.   leapyear:=(yr mod 4=0) and ((yr mod 100<>0) or (yr mod 400=0));
  154. end;
  155.  
  156. function days(mo,yr:integer):integer;
  157. var d:integer;
  158. begin
  159.   d:=value(copy('312831303130313130313031',1+(mo-1)*2,2));
  160.   if (mo=2) and leapyear(yr) then d:=d+1;
  161.   days:=d;
  162. end;
  163.  
  164. function daycount(mo,yr:integer):integer;
  165. var m,t:integer;
  166. begin
  167.   t:=0;
  168.   for m:=1 to (mo-1) do t:=t+days(m,yr);
  169.   daycount:=t;
  170. end;
  171.  
  172. function daynum(dt:string):integer;
  173. var d,m,y,t,c:integer;
  174. begin
  175.   t:=0;
  176.   m:=value(copy(dt,1,2));
  177.   d:=value(copy(dt,4,2));
  178.   y:=value(copy(dt,7,2))+1900;
  179.   for c:=1985 to y-1 do
  180.     if leapyear(c) then t:=t+366 else t:=t+365;
  181.   t:=t+daycount(m,y)+(d-1);
  182.   daynum:=t;
  183.   if y<1985 then daynum:=0;
  184. end;
  185.  
  186. function dat:string;
  187. var ap,x,y:string; i:integer;
  188. begin
  189.   case daynum(date) mod 7 of
  190.     0:x:='Tue';
  191.     1:x:='Wed';
  192.     2:x:='Thu';
  193.     3:x:='Fri';
  194.     4:x:='Sat';
  195.     5:x:='Sun';
  196.     6:x:='Mon';
  197.   end;
  198.   case value(copy(date,1,2)) of
  199.     1:y:='Jan';
  200.     2:y:='Feb';
  201.     3:y:='Mar';
  202.     4:y:='Apr';
  203.     5:y:='May';
  204.     6:y:='Jun';
  205.     7:y:='Jul';
  206.     8:y:='Aug';
  207.     9:y:='Sep';
  208.     10:y:='Oct';
  209.     11:y:='Nov';
  210.     12:y:='Dec';
  211.   end;
  212.   x:=x+' '+y+' '+copy(date,4,2)+', '+cstr(1900+value(copy(date,7,2)));
  213.   y:=time; i:=value(copy(y,1,2));
  214.   if i>11 then ap:='pm' else ap:='am';
  215.   if i>12 then i:=i-12;
  216.   if i=0 then i:=12;
  217.   dat:=cstr(i)+copy(y,3,3)+' '+ap+'  '+x;
  218. end;
  219.  
  220. procedure checkhangup;
  221. begin
  222.   if incom then
  223.     if NOT CarrierDetect(ComPort-1) THEN Hangup := TRUE;
  224. end;
  225.  
  226. procedure getkey
  227. (var c:char); forward;
  228.  
  229. procedure prompt(i:string); forward;
  230.  
  231. procedure mo(c:char);
  232. {send char out modem only, not on screen}
  233. begin
  234.   if incom and (not hangup) then TransmitChar(ComPort-1,c);
  235. end;
  236.  
  237. PROCEDURE o1(c:char);
  238. {output 1 character to screen & modem}
  239. BEGIN
  240.   if incom then begin
  241.     CheckHangup;
  242.     WriteChar(c); {write to screen}
  243.     mo(c);        {send to modem}
  244.   end else write(stdout,c);
  245. END;
  246.  
  247. PROCEDURE Forec(c:INTEGER);
  248. {This will change the foreground color of local and remote
  249.         0 = Black        8 = Dark Grey
  250.         1 = Blue         9 = Light Blue
  251.         2 = Green       10 = Light Green
  252.         3 = Cyan        11 = Light Cyan
  253.         4 = Red         12 = Light Red
  254.         5 = Magenta     13 = Light Magenta
  255.         6 = Brown       14 = Yellow
  256.         7 = Light Grey  15 = White
  257. also modified to only change colors if different than current color}
  258. VAR i:STRING;
  259. BEGIN
  260.   IF c<>Current_Color THEN BEGIN
  261.     Current_Color := c;
  262.     i:=#27+'[0';
  263.     IF c>8 THEN BEGIN
  264.       i:=i+';1';
  265.       c:=c-8;
  266.     END;
  267.     CASE c OF
  268.       0:i:=i+';30';    {black foreground}
  269.       1:i:=i+';34';    {blue foreground}
  270.       2:i:=i+';32';    {green     "    }
  271.       3:i:=i+';36';    {cyan      "    }
  272.       4:i:=i+';31';    {red       "    }
  273.       5:i:=i+';35';    {magenta   "    }
  274.       6:i:=i+';33';    {yellow    "    }
  275.       7:i:=i+';37';    {white     "    }
  276.       8:i:=i+';0';
  277.     END;
  278.     i:=i+'m';
  279.     Prompt(i);
  280.   END;
  281. END;
  282.  
  283. Procedure ansic(c:integer);
  284. var i:string;
  285.     j:byte;
  286. begin
  287. if okansi then
  288.   case c of
  289.     0 : forec(7);
  290.     1 : forec(11);
  291.     2 : forec(14);
  292.     3 : forec(5);
  293.     4 : begin forec(15); prompt(#27+'[44m'); end; {white on blue}
  294.     5 : forec(2);
  295.     6 : begin forec(12); prompt(#27+'[5m'); end;
  296.     7 : forec(1);
  297.   end;
  298. end;
  299.  
  300. procedure sdc;
  301. var f:integer;
  302. begin
  303.   ansic(0);
  304. end;
  305.  
  306. procedure pausescr;
  307. var i:integer; cc:char;
  308. begin
  309.   ansic(3); prompt('[ENTER]'); ansic(0);
  310.   repeat getkey(cc); until byte(cc)>0;
  311.   for i:=1 to 7 do
  312.     prompt(#8+' '+#8);
  313. end;
  314.  
  315. procedure prompt;
  316. var c:integer; pp:byte; cc:char;
  317. begin
  318.   if (not hangup) then
  319.     for c:=1 to length(i) do begin
  320.       if (i[c]=#10) then ansic(0);
  321.       o1(i[c]);
  322.     end;
  323. end;
  324.  
  325. procedure nl;
  326. begin
  327.   ansic(0);
  328.   prompt(#13+#10);
  329. end;
  330.  
  331. procedure print(i:string);
  332. begin
  333.   prompt(i);
  334.   nl;
  335. end;
  336.  
  337. procedure prt(i:string);
  338. begin
  339.   ansic(2); prompt(i); ansic(0);
  340. end;
  341.  
  342. procedure ynq(i:string);
  343. begin
  344.   ansic(5); prompt(i);
  345. end;
  346.  
  347. procedure mpl(c:integer);
  348. var n:integer; i:string;
  349. begin
  350.   if okansi then begin
  351.     ansic(4);
  352.     i:='';
  353.     for n:=1 to c do i:=i+' ';
  354.     prompt(i);
  355.     prompt(#27+'['+cstr(c)+'D');
  356.   end;
  357. end;
  358.  
  359. procedure tleft;
  360. var x,y:integer;
  361. begin
  362.   if timer<timeon then timeon:=timeon-24.0*60*60;
  363.   if (nsl<0) then begin
  364.     nl;
  365.     print('Time expired.');
  366.     hangup:=true;
  367.   end;
  368.   checkhangup;
  369. end;
  370.  
  371. function empty:boolean;
  372. begin
  373.   rp.ax:=$0b00;
  374.   msdos(Dos.Registers(rp));
  375.   if (rp.ax and $00ff)=$00 then
  376.     empty:=true
  377.   else
  378.     empty:=false;
  379. end;
  380.  
  381. procedure getkey;
  382. {wait for char, no echo, set hangup if timed out}
  383. VAR r : REAL;
  384.     beeped : BOOLEAN;
  385.     SaveCh : CHAR;
  386. BEGIN
  387.   r := timer; beeped:=FALSE;
  388.   REPEAT
  389.     CheckHangup;
  390.     IF ((timer-r) > 120.0) AND NOT beeped THEN BEGIN
  391.       o1(#7);
  392.       beeped:=TRUE;
  393.     END;
  394.     IF (timer-r) > 180.0 THEN BEGIN
  395.       Print('Call back when you wake up.');
  396.       Hangup:=TRUE;
  397.       IF incom THEN begin
  398.         setdtr(comport-1,false);
  399.         delay(2000);
  400.         setdtr(comport-1,true);
  401.       end;
  402.     END;
  403.   UNTIL KeyPressed OR (incom and (SerialInput(comport-1) OR Hangup));
  404.   IF KeyPressed AND NOT Hangup THEN BEGIN  {local key}
  405.     c := ReadKey;
  406.     IF c=#0 THEN BEGIN
  407.       c:=ReadKey;
  408.       CASE c OF
  409.        {#59 : F1;}
  410.         #63 : BEGIN {F5}
  411.                 IF incom THEN begin
  412.                   setdtr(comport-1,false);
  413.                   delay(2000);
  414.                   setdtr(comport-1,true);
  415.                 end;
  416.                 Hangup := TRUE;
  417.               END;
  418.       END;
  419.       c:=#0; {return a null}
  420.     END;
  421.   END ELSE BEGIN  {remote key}
  422.     IF incom and (NOT Hangup) THEN c:=receivechar(comport-1);
  423.   END;
  424. END;
  425.  
  426. procedure cls;
  427. begin
  428.   prompt(#27+'[2J');
  429. end;
  430.  
  431. procedure go(x,y:byte);
  432. var p1,p2:string;
  433.     outchr:byte;
  434. begin
  435.   x:=x mod 80;
  436.   y:=y mod 25;
  437.   p1:=#27+'[';
  438.   str(y,p2);
  439.   p1:=p1+p2+';';
  440.   str(x,p2);
  441.   p1:=p1+p2+'H';
  442.   prompt(p1);
  443. end;
  444.  
  445. Procedure Locate(x,y:byte);
  446. {used by games like Gammon11.  Don't know why they reversed x & y...}
  447. begin
  448.   go(y,x);
  449. end;
  450.  
  451. function yn:boolean;
  452. var c:char;
  453. begin
  454.   if not hangup then begin
  455.     ansic(1);
  456.     repeat
  457.       getkey(c);
  458.       c:=upcase(c);
  459.     until (c='Y') or (c='N') or (c=chr(13)) or hangup;
  460.     if c='Y' then begin
  461.       print('Yes');
  462.       yn:=true;
  463.     end else begin
  464.       print('No');
  465.       yn:=false;
  466.     end;
  467.     if hangup then yn:=false;
  468.   end;
  469. end;
  470.  
  471. procedure input1(var i:string; ml:integer; tf:boolean);
  472. var cp:integer;
  473.     c:char;
  474.     r:real;
  475. begin
  476.  checkhangup;
  477.  if not hangup then begin
  478.   r:=timer;
  479.   cp:=1;
  480.   repeat
  481.     getkey(c);
  482.     if c=#1 then r:=timer;
  483.     if not tf then c:=upcase(c);
  484.     if (c>=' ') and (c<chr(127)) then
  485.       if cp<=ml then begin
  486.       i[cp]:=c;
  487.       cp:=cp+1;
  488.       prompt(c);
  489.     end else else case ord(c) of
  490.       8:if cp>1 then begin
  491.                c:=chr(8);
  492.                prompt(#8#32#8);
  493.                cp:=cp-1;
  494.              end;
  495.       21,24:while cp<>1 do begin
  496.                cp:=cp-1;
  497.                prompt(#8#32#8);
  498.              end;
  499.     end;
  500.     if (timer-r)>300.0 then hangup:=true;
  501.   until (c=#13) or (c=#14) or hangup;
  502.   i[0]:=chr(cp-1);
  503.   nl;
  504.  end;
  505. end;
  506.  
  507. procedure input(var i:string; ml:integer);
  508. begin
  509.   input1(i,ml,false);
  510. end;
  511.  
  512.  
  513. procedure inputl(var i:string; ml:integer);
  514. begin
  515.   input1(i,ml,true);
  516. end;
  517.  
  518. procedure onek(var c:char; ch:string);
  519. begin
  520.   repeat
  521.     getkey(c);
  522.     c:=upcase(c);
  523.   until (pos(c,ch)>0) or hangup;
  524.   if hangup then c:=ch[1];
  525.   print(''+c);
  526. end;
  527.  
  528.  
  529.  procedure wkey(var abort,next:boolean);
  530.  var cc:char;
  531.  begin
  532.     while not (empty or hangup or abort) do begin
  533.       getkey(cc);
  534.       if (cc=' ') or (cc=chr(3)) or (cc=chr(24)) or (cc=chr(11)) then
  535.         abort:=true;
  536.       if (cc=chr(14)) then begin abort:=true; next:=true; end;
  537.       if (cc=chr(19)) or (cc='P') or (cc='p') then begin
  538.         getkey(cc);
  539.       end;
  540.     end;
  541.  end;
  542.  
  543. function ctim(rl:real):string;
  544. var h,m,s:string;
  545. begin
  546.   s:=tch(cstr(trunc(rl-int(rl/60.0)*60.0)));
  547.   m:=tch(cstr(trunc(int(rl/60.0)-int(rl/3600.0)*60.0)));
  548.   h:=cstr(trunc(rl/3600.0));
  549.   if length(h)=1 then h:='0'+h;
  550.   ctim:=h+':'+m+':'+s;
  551. end;
  552.  
  553. function tlef:string;
  554. begin
  555.   tlef:=ctim(nsl);
  556. end;
  557.  
  558. function cstrr(rl:real; base:integer):string;
  559. var c1,c2,c3:integer; i:string; r1,r2:real;
  560. begin
  561.  if rl<=0.0 then cstrr:='0' else begin
  562.   r1:=ln(rl)/ln(1.0*base);
  563.   r2:=exp(ln(1.0*base)*(trunc(r1)));
  564.   i:='';
  565.   while (r2>0.999) do begin
  566.     c1:=trunc(rl/r2);
  567.     i:=i+copy('0123456789ABCDEF',c1+1,1);
  568.     rl:=rl-c1*r2;
  569.     r2:=r2/(1.0*base);
  570.   end;
  571.   cstrr:=i;
  572.  end;
  573. end;
  574.  
  575. procedure printa1(i:string; var abort,next:boolean);
  576. var c:integer;
  577. begin
  578.  checkhangup;
  579.  if not hangup then begin
  580.   abort:=false; next:=false; c:=1;
  581.   if not empty then wkey(abort,next);
  582.   while (not abort) and (c-1<length(i)) and (not hangup) do begin
  583.     checkhangup;
  584.     if i[c]=#3 then
  585.       if i[c+1] in [#0..#8] then
  586.         if okansi then
  587.           ansic(ord(i[c+1]));
  588.     if not empty then wkey(abort,next);
  589.     if i[c]=#3 then
  590.       c:=c+1
  591.     else o1(i[c]);
  592.     c:=c+1;
  593.     lastkey:=timer;
  594.   end;
  595.  end else abort:=true;
  596. end;
  597.  
  598. function wherex:byte;
  599. begin
  600.   rp.ah:=3;
  601.   rp.bh:=0;
  602.   intr($10,rp);
  603.   wherex:=rp.dl+1;
  604. end;
  605.  
  606. procedure printa(i:string; var abort,next:boolean);
  607. var s:string; p,op,rp,rop,nca:integer; crend:boolean;
  608. begin
  609.   abort:=false;
  610.   crend:=(i[length(i)]=#1) and (i[length(i)-1]<>#3);
  611.   if crend then i:=copy(i,1,length(i)-1);
  612.   wkey(abort,next);
  613.   if i='' then nl;
  614.   while (i<>'') and (not abort) and (not hangup) do begin
  615.     rp:=0; nca:=thisuser.linelen-wherex-1; p:=0;
  616.     while (rp<nca) and (p<length(i)) do begin
  617.       if i[p+1]=#8 then rp:=rp-1 else
  618.         if i[p+1]=#3 then
  619.           p:=p+1
  620.         else
  621.           if (i[p+1]<>#10) then rp:=rp+1;
  622.       p:=p+1;
  623.     end;
  624.     op:=p; rop:=rp;
  625.     if (rp>=nca) and (p<length(i)) then begin
  626.       while ((not (i[p] in [' ',#8,#10])) or (i[p-1]=#3)) and (p>1) do begin
  627.         rp:=rp-1; p:=p-1;
  628.       end;
  629.       if p=1 then
  630.         if not (i[1] in [' ',#8,#10]) then begin rp:=rp-1; p:=p-1; end;
  631.     end;
  632.     if abs(rop-rp)>=(thisuser.linelen div 2) then p:=op;
  633.     s:=copy(i,1,p); delete(i,1,p);
  634.     if (s[length(s)]=' ') then s[0]:=pred(s[0]);
  635.     printa1(s,abort,next);
  636.     if ((i='') and crend) or (i<>'') or abort then
  637.       nl
  638.     else
  639.       printa1(' ',abort,next);
  640.   end;
  641. end;
  642.  
  643. procedure printacr(i:string; var abort,next:boolean);
  644. begin
  645.  if not abort then
  646.   if i[length(i)]=#1 then
  647.     printa(i,abort,next)
  648.   else
  649.     printa(i+#1,abort,next);
  650. end;
  651.  
  652. procedure pfl(fn:string; var abort:boolean; cr:boolean);
  653. var fil:text;
  654.     i:string;
  655.     next:boolean;
  656.     cc:char;
  657. begin
  658.     if not hangup then begin
  659.       assign(fil,fn);
  660.       {$I-} reset(fil); {$I+}
  661.       if ioresult<>0 then print('File not found.') else begin
  662.         abort:=false;
  663.         while not eof(fil) and (not abort) and (not hangup) do begin
  664.           readln(fil,i);
  665.           if not empty then getkey(cc) else cc:='r';
  666.           if cc=' ' then abort:=true else print(i);
  667.         end;
  668.         close(fil);
  669.       end;
  670.       nl;nl;
  671.     end;
  672. end;
  673.  
  674. procedure printfile(fn:string);
  675. var abort:boolean;
  676. begin
  677.   pfl(fn,abort,true);
  678. end;
  679.  
  680. procedure iport;
  681. var f:text;
  682.     s:string;
  683.     i,n:integer;
  684. begin
  685.   current_color:=99;
  686.   if paramcount=0 then assign(f,'DOOR.SYS') else assign(f,paramstr(1));
  687.   {$I-} reset(f); {$I+}
  688.   if ioresult=0 then begin
  689.     readln(f,s);          {COMx}
  690.       Val(s[4],ComPort,n);
  691.       incom:=(ComPort<>0);
  692.     readln(f,BaudRate);           {baud}
  693.     readln(f);                    {7 or 8}
  694.     readln(f);                    {node number, 1-99}
  695.     readln(f);                    {DTE baud rate}
  696.     readln(f);                    {Y=screen on}
  697.     readln(f);                    {Y=printer on}
  698.     readln(f);                    {Y=Page Bell on}
  699.     readln(f);                    {Y=Caller Alarm}
  700.     readln(f,thisuser.name);      {User's full name}
  701.       thisuser.realname:=Thisuser.Name;
  702.     readln(f);                    {from city/state}
  703.     readln(f);                    {home phone number}
  704.     readln(f);                    {work phone number}
  705.     readln(f);                    {user's password}
  706.     readln(f,thisuser.sl);        {security level}
  707.     readln(f);                    {total times on}
  708.     readln(f,thisuser.laston);    {date last called}
  709.     readln(f,timeleft);           {seconds left}
  710.     readln(f);                    {minutes left}
  711.     readln(f,s);                  {GR=Graphics, NG=No Graphics, 7E=7,E caller}
  712.       okansi := (s='GR');
  713.     readln(f,thisuser.pagelen);   {lines on screen (24)}
  714.     readln(f);                    {Y=expert, N=Novice}
  715.       thisuser.linelen:=80;
  716.       cs:=(thisuser.sl>199);
  717.       so:=(thisuser.sl=255);
  718.     if incom then begin
  719.       IF OpenFossil(ComPort-1) then
  720.         SetBaudRate(ComPort-1,BaudRate)
  721.       else begin
  722.         Writeln('No Fossil!');
  723.         close(f);
  724.         Halt;
  725.       end;
  726.     end;
  727.     close(f);
  728.   end else begin
  729.     writeln('Parameter file not found.');
  730.     halt;
  731.   end;
  732.   hangup:=false;
  733.   timeon:=timer;
  734.   lastkey:=timer;
  735.   assign(stdout,'');
  736.   rewrite(stdout);
  737. end;
  738.  
  739. procedure return;
  740. begin
  741.   {$I-} close(stdout); {$I+}
  742.   halt;
  743. end;
  744.  
  745. procedure topscr;
  746. begin
  747. end;
  748.  
  749. PROCEDURE PrintAnsiFile (fn:STRING);
  750. {prints an ansi or text file, allowing pausing, aborting, no paging}
  751. VAR  fil:TEXT; i:CHAR;
  752.      abort,next:BOOLEAN;
  753. BEGIN
  754.   abort:=FALSE;
  755.   IF NOT Hangup THEN BEGIN
  756.     Assign(fil,fn);
  757.     {$I-} Reset(fil); {$I+}
  758.     IF IOresult=0 THEN BEGIN
  759.       WHILE NOT EOF(fil) AND NOT Hangup AND NOT Abort DO BEGIN
  760.         CheckHangup;
  761.         Read(fil,i);
  762.         o1(i);
  763.         wkey(abort,next);
  764.       END;
  765.       Close(fil);
  766.     END;
  767.   END;
  768. END;
  769.