home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 189.img / TCS120S.ZIP / SUBS2.PAS < prev    next >
Pascal/Delphi Source File  |  1989-04-06  |  34KB  |  1,494 lines

  1. {$R-,S-,I-,D-,F+,V-,B-,N-,L+ }
  2. {$M 65500,0,0 }
  3.  
  4. unit subs2;
  5.  
  6. { $define testingdevices}   { Activate this define for test mode }
  7.  
  8. interface
  9.  
  10. uses printer,dos,crt,overlay,gentypes,configrt,gensubs,subs1,windows,modem,
  11.      statret,chatstuf,flags,userret;
  12.  
  13. procedure beepbeep;
  14. procedure summonbeep;
  15. procedure abortttfile (er:integer);
  16. procedure openttfile;
  17. procedure writecon (k:char);
  18. procedure toggleavail;
  19. function charready:boolean;
  20. function readchar:char;
  21. function waitforchar:char;
  22. procedure clearchain;
  23. function charpressed (k:char):boolean;  { TRUE if K is in typeahead }
  24. procedure addtochain (l:lstr);
  25. procedure directoutchar (k:char);
  26. procedure handleincoming;
  27. procedure writechar (k:char);
  28. {F+}
  29.       function opendevice (var t:textrec):integer;
  30.       function closedevice (var t:textrec):integer;
  31.       function cleardevice (var t:textrec):integer;
  32.       function ignorecommand (var t:textrec):integer;
  33.       function directoutchars (var t:textrec):integer;
  34.       function writechars (var t:textrec):integer;
  35.       function directinchars (var t:textrec):integer;
  36.       function readcharfunc (var t:textrec):integer;
  37. {F-}
  38. function getinputchar:char;
  39. procedure getstr (mode:integer);
  40. procedure writestr (s:anystr);
  41. procedure printxy (x,y:integer;str:anystr);
  42. procedure cls;
  43. procedure writehdr (q:anystr);
  44. function issysop:boolean;
  45. procedure reqlevel (l:integer);
  46. procedure printfile (fn:lstr);
  47. procedure printtexttopoint (var tf:text);
  48. procedure skiptopoint (var tf:text);
  49. function minstr (blocks:integer):sstr;
  50. procedure parserange (numents:integer; var f,l:integer);
  51. function menutype:integer;
  52. function menu (mname:mstr; mfn:sstr; choices:anystr):integer;
  53. function checkpassword (var u:userrec):boolean;
  54. function getpassword:boolean;
  55. procedure getacflag (var ac:accesstype; var tex:mstr);
  56. procedure calcqr;
  57. procedure overlayerror;
  58. function parsedate (date:anystr):lstr;
  59. function ansi:boolean;
  60. function ascii:boolean;
  61. procedure setmenutype;
  62. procedure movexy (x,y:integer);
  63. procedure ansicls;
  64.  
  65. implementation
  66.  
  67. procedure beepbeep;
  68. begin
  69.   nosound;
  70.   sound (200);
  71.   delay (20);
  72.   nosound
  73. end;
  74.  
  75. procedure summonbeep;
  76. var cnt:integer;
  77. begin
  78.   nosound;
  79.   cnt:=1330;
  80.   repeat
  81.     sound (cnt);
  82.     delay (10);
  83.     cnt:=cnt+200;
  84.   until cnt>4300;
  85.   nosound
  86. end;
  87.  
  88. procedure abortttfile (er:integer);
  89. var n:integer;
  90. begin
  91.   specialmsg ('<Texttrap error '+strr(er)+'>');
  92.   texttrap:=false;
  93.   textclose (ttfile);
  94.   n:=ioresult
  95. end;
  96.  
  97. procedure openttfile;
  98. var n:integer;
  99. begin
  100.   appendfile ('Texttrap',ttfile);
  101.   n:=ioresult;
  102.   if n=0
  103.     then texttrap:=true
  104.     else abortttfile (n)
  105. end;
  106.  
  107. {-= BEGINNING OF SCRAMBLE PROCEDURES -=}
  108. function scramble (s:char):char;
  109. var f:text;
  110.     x,y:char;
  111.     z:integer;
  112. begin
  113.  scramble:=s;
  114.  if noscramble then exit;
  115.  if not scrambled then exit;
  116.  if not exist (forumdir+'Scramble.Dat') then exit;
  117.  if not (ord(s) in [65..90,97..122]) then exit;
  118.  assign (f,forumdir+'Scramble.Dat');
  119.  reset (f);
  120.  for z:=1 to ord(s) do
  121.  read (f,x);
  122.  scramble:=x;
  123.  close (f);
  124. end;
  125.  
  126. procedure overridescramble;
  127. begin
  128.  if scrambled then begin
  129.   scrambled:=false;
  130.  end else
  131.  if not scrambled then begin
  132.   scrambled:=true;
  133.  end;
  134.  textcolor (12);
  135.  writeln (usr);
  136.  writeln (usr);
  137.  beepbeep;
  138.  writeln (usr,'┌─────────────────────────────┐');
  139.  write (usr,'│ ** ');
  140.  textcolor (9);
  141.  write (usr,'Data Scramble Override!!');
  142.  textcolor (12);
  143.  writeln (usr,' │');
  144.  write (usr,'│ ** ');
  145.  textcolor (10);
  146.  write (usr,'Data Scramble is now:');
  147.  textcolor (11);
  148.  if scrambled then write (usr,'ON  ') else
  149.   if not scrambled then write (usr,'OFF ');
  150.  textcolor (12);
  151.  writeln (usr,'│');
  152.  writeln (usr,'└─────────────────────────────┘');
  153.  writeln (usr);
  154.  writeln (usr);
  155.  ansicolor (urec.regularcolor);
  156. end;
  157. {-= ENDING OF SCRAMBLE PROCEDURES -=}
  158.  
  159. procedure togglescreenoutput;
  160. begin
  161.  if screenoutput then
  162.  screenoutput:=false else
  163.  screenoutput:=true;
  164. end;
  165.  
  166. procedure writecon (k:char);
  167. var r:registers;
  168.     kk:char;
  169. begin
  170.   if k=^J
  171.     then write (usr,k)
  172.     else
  173.       begin
  174.       { if scrambled then kk:=scramble (k)
  175.         else } kk:=k;
  176.         r.dl:=ord(kk);
  177.         r.ah:=2;
  178.         intr($21,r)
  179.       end
  180. end;
  181.  
  182. procedure toggleavail;
  183. begin
  184.   if sysopavail=notavailable
  185.     then sysopavail:=available
  186.     else sysopavail:=succ(sysopavail)
  187. end;
  188.  
  189. function charready:boolean;
  190. var k:char;
  191. begin
  192.   if modeminlock then while numchars>0 do k:=getchar;
  193.   if hungupon or keyhit
  194.     then charready:=true
  195.     else if online
  196.       then charready:=(not modeminlock) and (numchars>0)
  197.       else charready:=false
  198. end;
  199.  
  200. function readchar:char;
  201.  
  202.   procedure toggletempsysop;
  203.   begin
  204.     if tempsysop
  205.       then ulvl:=regularlevel
  206.       else
  207.         begin
  208.           regularlevel:=ulvl;
  209.           ulvl:=sysoplevel
  210.         end;
  211.     tempsysop:=not tempsysop
  212.   end;
  213.  
  214.   procedure togviewstats;
  215.   begin
  216.     if splitmode
  217.       then unsplit
  218.       else
  219.         begin
  220.           splitscreen (14);
  221.           top;
  222.           clrscr;
  223.           write (usr,'Level:          ',urec.level,
  224.                  ^M^J'File Level:     ',urec.udlevel,
  225.                  ^M^J'File Points:    ',urec.udpoints,
  226.                  ^M^J'User Note:      ',urec.note,
  227.                  ^M^J'# Downloads:    ',urec.downloads,
  228.                  ^M^J'# Uploads:      ',urec.uploads,
  229.                  ^M^J'# of Posts:     ',urec.nbu,
  230.                  ^M^J'G-File Ups:     ',urec.nup,
  231.                  ^M^J'G-File Downs:   ',urec.ndn,
  232.                  ^M^J'Total Time:     ',urec.totaltime:0:0,
  233.                  ^M^J'# of Calls:     ',urec.numon);
  234.           bottom
  235.         end;
  236.   end;
  237.  
  238.   procedure showhelp;
  239.   begin
  240.     if splitmode
  241.       then unsplit
  242.       else begin
  243.         splitscreen (12);
  244.         top;
  245.         clrscr;
  246.         write (usr,
  247. 'Chat with user: <F1>                 Sysop Commands: <F2>'^M^J,
  248. 'Sysop gets the system next: <F7>     Lock the timer: <F8>'^M^J,
  249. 'Lock out all modem input: <F9>       Lock all Modem output: <F10>'^M^J,
  250. 'Chat availabily toggle: <Alt-A>      Grant temporary sysop powers: <Alt-T>'^M^J,
  251. 'Give User 1 min. time: <Right-Arrow> Take away 1 minute time: <Left-Arrow>'^M^J,
  252. 'Take away all time: <Alt-K>          Refresh the Bottom line: <Alt-B>'^M^J,
  253. 'Toggle printer echo: <Ctrl-PrtScr>   Toggle Text Trap: <Alt-E>'^M^J,
  254. 'View users Status: <Alt-V>           Sysop Macros #1-10: <Alt-F1>-<Alt-F10>'^M^J,
  255. 'Override Data Scrambling: <Alt-O>    ');
  256.     end;
  257.   end;
  258.  
  259.   procedure toggletexttrap;
  260.   var n:integer;
  261.   begin
  262.     if texttrap
  263.       then
  264.         begin
  265.           textclose (ttfile);
  266.           n:=ioresult;
  267.           if n<>0 then abortttfile (n);
  268.           texttrap:=false
  269.         end
  270.       else openttfile
  271.   end;
  272.  
  273. procedure printsysopmacro (n:integer);
  274.  
  275.   procedure doitbro (k:char);
  276.   var n:integer;
  277.   begin
  278.     if inuse<>1
  279.       then writecon (k)
  280.       else begin
  281.         bottom;
  282.         writecon (k);
  283.         top
  284.       end;
  285.     if wherey>lasty then gotoxy (wherex,lasty);
  286.     if online and (not modemoutlock) and ((k<>#10) or uselinefeeds)
  287.       then sendchar(k);
  288.     if texttrap then begin
  289.       write (ttfile,k);
  290.       n:=ioresult;
  291.       if n<>0 then abortttfile (n)
  292.     end;
  293.     if printerecho then write (lst,k)
  294.   end;
  295.  
  296.   procedure domacro (var m:anystr);
  297.   var x:integer;
  298.   begin
  299.    for x:=1 to length(m) do begin
  300.     if m[x]='~' then writeln else
  301.     doitbro (m[x]);
  302.    end;
  303.   end;
  304.  
  305. begin
  306.  case n of
  307.   1:domacro (sysopmacro1);
  308.   2:domacro (sysopmacro2);
  309.   3:domacro (sysopmacro3);
  310.   4:domacro (sysopmacro4);
  311.   5:domacro (sysopmacro5);
  312.   6:domacro (sysopmacro6);
  313.   7:domacro (sysopmacro7);
  314.   8:domacro (sysopmacro8);
  315.   9:domacro (sysopmacro9);
  316.   10:domacro (sysopmacro10);
  317.  end;
  318. end;
  319.  
  320. var k:char;
  321.     ret:char;
  322.     dorefresh:boolean;
  323. begin
  324.   requestchat:=false;
  325.   requestcom:=false;
  326.   reqspecial:=false;
  327.   if keyhit
  328.     then
  329.       begin
  330.         k:=bioskey;
  331.         ret:=k;
  332.         if ord(k)>127 then begin
  333.           ret:=#0;
  334.           dorefresh:=ingetstr;
  335.           case ord(k)-128 of
  336.             availtogglechar:
  337.               begin
  338.                 toggleavail;
  339.                 chatmode:=false;
  340.                 dorefresh:=true
  341.               end;
  342.             sysopcomchar:
  343.               begin
  344.                 requestcom:=true;
  345.                 requestchat:=true
  346.               end;
  347.             breakoutchar:halt(e_controlbreak);
  348.             lesstimechar:urec.timetoday:=urec.timetoday-1;
  349.             moretimechar:urec.timetoday:=urec.timetoday+1;
  350.             leftarrow:urec.timetoday:=urec.timetoday-1;
  351.             rightarrow:urec.timetoday:=urec.timetoday+1;
  352.             notimechar:settimeleft (-1);
  353.             chatchar:requestchat:=true;
  354.             sysnextchar:sysnext:=not sysnext;
  355.             timelockchar:if timelock then timelock:=false else begin
  356.                            timelock:=true;
  357.                            lockedtime:=timeleft
  358.                          end;
  359.             inlockchar:modeminlock:=not modeminlock;
  360.             outlockchar:setoutlock (not modemoutlock);
  361.             tempsysopchar:toggletempsysop;
  362.             bottomchar:bottomline;
  363.             viewstatchar:togviewstats;
  364.             sysophelpchar:if dorefresh then showhelp;
  365.             texttrapchar:toggletexttrap;
  366.             printerechochar:printerecho:=not printerecho;
  367.             sm1char:printsysopmacro(1);
  368.             sm2char:printsysopmacro(2);
  369.             sm3char:printsysopmacro(3);
  370.             sm4char:printsysopmacro(4);
  371.             sm5char:printsysopmacro(5);
  372.             sm6char:printsysopmacro(6);
  373.             sm7char:printsysopmacro(7);
  374.             sm8char:printsysopmacro(8);
  375.             sm9char:printsysopmacro(9);
  376.             sm10char:printsysopmacro(10);
  377.             phunkey:write (direct,^G);
  378.             scroverride:overridescramble;
  379.             noscreenoutput:togglescreenoutput;
  380.             72:ret:=^E;
  381.             75:ret:=^S;
  382.             77:ret:=^D;
  383.             80:ret:=^X;
  384.             115:ret:=^A;
  385.             116:ret:=^F;
  386.             73:ret:=^R;
  387.             81:ret:=^C;
  388.             71:ret:=^Q;
  389.             79:ret:=^W;
  390.             83:ret:=^G;
  391.             82:ret:=^V;
  392.             117:ret:=^P;
  393.           end;
  394.           if dorefresh then bottomline
  395.         end
  396.       end
  397.     else
  398.       begin
  399.         k:=getchar;
  400.         if modeminlock
  401.           then ret:=#0
  402.           else ret:=k
  403.       end;
  404.   if ret='+' then write (' '^H);
  405.   readchar:=ret
  406. end;
  407.  
  408. function waitforchar:char;
  409. var t:integer;
  410.     k:char;
  411. begin
  412.   t:=timer+mintimeout;
  413.   if t>=1440 then t:=t-1440;
  414.   repeat
  415.     if timer=t then forcehangup:=true
  416.   until charready;
  417.   waitforchar:=readchar
  418. end;
  419.  
  420. procedure clearchain;
  421. begin
  422.   chainstr[0]:=#0
  423. end;
  424.  
  425. function charpressed (k:char):boolean;  { TRUE if K is in typeahead }
  426. begin
  427.   charpressed:=pos(k,chainstr)>0
  428. end;
  429.  
  430. procedure addtochain (l:lstr);
  431. begin
  432.   if length(chainstr)<>0 then chainstr:=chainstr+',';
  433.   chainstr:=chainstr+l
  434. end;
  435.  
  436. procedure directoutchar (k:char);
  437. var n:integer;
  438. begin
  439.   if inuse<>1
  440.     then writecon (k)
  441.     else begin
  442.       bottom;
  443.       writecon (k);
  444.       top
  445.     end;
  446.   if wherey>lasty then gotoxy (wherex,lasty);
  447.   if online and (not modemoutlock) and ((k<>#10) or uselinefeeds)
  448.     then sendchar(k);
  449.   if texttrap then begin
  450.     write (ttfile,k);
  451.     n:=ioresult;
  452.     if n<>0 then abortttfile (n)
  453.   end;
  454.   if printerecho then write (lst,k)
  455. end;
  456.  
  457. procedure handleincoming;
  458. var k:char;
  459. begin
  460.   k:=readchar;
  461.   case upcase(k) of
  462.     'X',^X,^K,^C,#27,' ':begin
  463.       writeln (direct);
  464.       break:=true;
  465.       linecount:=0;
  466.       xpressed:=(upcase(k)='X') or (k=^X);
  467.       if xpressed then clearchain
  468.     end;
  469.     ^S:k:=waitforchar;
  470.     else if length(chainstr)<255 then chainstr:=chainstr+k
  471.   end
  472. end;
  473.  
  474. procedure writechar (k:char);
  475.  
  476.   procedure endofline;
  477.  
  478.     procedure write13 (k:char);
  479.     var n:integer;
  480.     begin
  481.       for n:=1 to 13 do directoutchar (k)
  482.     end;
  483.  
  484.   var b:boolean;
  485.   begin
  486.     writeln (direct);
  487.     if timelock then settimeleft (lockedtime);
  488.     if curattrib=urec.statcolor then ansicolor (urec.regularcolor);
  489.     linecount:=linecount+1;
  490.     if (linecount>=urec.displaylen-1) and (not dontstop)
  491.           and (moreprompts in urec.config) then begin
  492.       linecount:=1;
  493.       write (direct,'More (Y/N/C)?');
  494.       repeat
  495.         k:=upcase(waitforchar)
  496.       until (k in [^M,' ','C','N','Y']) or hungupon;
  497.       write13 (^H);
  498.       write13 (' ');
  499.       write13 (^H);
  500.       if k='N' then break:=true else if k='C' then dontstop:=true
  501.     end
  502.   end;
  503.  
  504. begin
  505.   if hungupon then exit;
  506.   if k<=^Z then
  507.     case k of
  508.       ^J,#0:exit;
  509.       ^Q:k:=^H;
  510.       ^B:begin
  511.            clearbreak;
  512.            exit
  513.          end
  514.     end;
  515.   if break then exit;
  516.   if k<=^Z then begin
  517.     case k of
  518.       ^G:beepbeep;
  519.       ^L:cls;
  520.       ^N,^R:ansireset;
  521.       ^S:ansicolor (urec.statcolor);
  522.       ^P:ansicolor (urec.promptcolor);
  523.       ^U:ansicolor (urec.inputcolor);
  524.       ^H:directoutchar (k);
  525.       ^M:endofline
  526.     end;
  527.     exit
  528.   end;
  529.   if usecapsonly then k:=upcase(k);
  530.   directoutchar (k);
  531.   if (keyhit or ((not modemoutlock) and online and (numchars>0)))
  532.      and (not nobreak) then handleincoming
  533. end;
  534.  
  535. function getinputchar:char;
  536. var k:char;
  537. begin
  538.   if length(chainstr)=0 then begin
  539.     getinputchar:=waitforchar;
  540.     exit
  541.   end;
  542.   k:=chainstr[1];
  543.   delete (chainstr,1,1);
  544.   if (k=',') and (not nochain) then k:=#13;
  545.   getinputchar:=k
  546. end;
  547.  
  548. {$ifdef testingdevices}
  549.  
  550. procedure devicedone (var t:textrec; m:mstr);
  551. var r:registers;
  552.     cnt:integer;
  553. begin
  554.   write (usr,'Device ');
  555.   cnt:=0;
  556.   while t.name[cnt]<>#0 do begin
  557.     write (usr,t.name[cnt]);
  558.     cnt:=cnt+1
  559.   end;
  560.   writeln (usr,' ',m,'... press any key');
  561.   r.ax:=0;
  562.   intr ($16,r);
  563.   if r.al=3 then halt
  564. end;
  565.  
  566. {$endif}
  567.  
  568. {$F+}
  569.  
  570. function opendevice;
  571. begin
  572.   {$ifdef testingdevices}  devicedone (t,'opened');  {$endif}
  573.   t.handle:=1;
  574.   t.mode:=fminout;
  575.   t.bufend:=0;
  576.   t.bufpos:=0;
  577.   opendevice:=0
  578. end;
  579.  
  580. function closedevice;
  581. begin
  582.   {$ifdef testingdevices}  devicedone (t,'closed');  {$endif}
  583.   t.handle:=0;
  584.   t.mode:=fmclosed;
  585.   t.bufend:=0;
  586.   t.bufpos:=0;
  587.   closedevice:=0
  588. end;
  589.  
  590. function cleardevice;
  591. begin
  592.   {$ifdef testingdevices}  devicedone (t,'cleared');  {$endif}
  593.   t.bufend:=0;
  594.   t.bufpos:=0;
  595.   cleardevice:=0
  596. end;
  597.  
  598. function ignorecommand;
  599. begin
  600.   {$ifdef testingdevices}  devicedone (t,'ignored');  {$endif}
  601.   ignorecommand:=0
  602. end;
  603.  
  604. function directoutchars;
  605. var cnt:integer;
  606. begin
  607.   for cnt:=t.bufend to t.bufpos-1 do
  608.     directoutchar (t.bufptr^[cnt]);
  609.   t.bufend:=0;
  610.   t.bufpos:=0;
  611.   directoutchars:=0
  612. end;
  613.  
  614. function writechars;
  615. var cnt:integer;
  616. begin
  617.   for cnt:=t.bufend to t.bufpos-1 do
  618.     writechar (t.bufptr^[cnt]);
  619.   t.bufend:=0;
  620.   t.bufpos:=0;
  621.   writechars:=0
  622. end;
  623.  
  624. function directinchars;
  625. begin
  626.   with t do begin
  627.     bufptr^[0]:=waitforchar;
  628.     t.bufpos:=0;
  629.     t.bufend:=1
  630.   end;
  631.   directinchars:=0
  632. end;
  633.  
  634. function readcharfunc;
  635. begin
  636.   with t do begin
  637.     bufptr^[0]:=getinputchar;
  638.     t.bufpos:=0;
  639.     t.bufend:=1
  640.   end;
  641.   readcharfunc:=0
  642. end;
  643.  
  644. procedure usermacro (m:string);
  645.  
  646.   procedure doithonky (k:char);
  647.   var n:integer;
  648.   begin
  649.     if inuse<>1
  650.       then writecon (k)
  651.       else begin
  652.         bottom;
  653.         writecon (k);
  654.         top
  655.       end;
  656.     if wherey>lasty then gotoxy (wherex,lasty);
  657.     if online and (not modemoutlock) and ((k<>#10) or uselinefeeds)
  658.       then sendchar(k);
  659.     if texttrap then begin
  660.       write (ttfile,k);
  661.       n:=ioresult;
  662.       if n<>0 then abortttfile (n)
  663.     end;
  664.     if printerecho then write (lst,k)
  665.   end;
  666.  
  667.   procedure domacro (var mm:anystr);
  668.   var x:integer;
  669.   begin
  670.    for x:=1 to length(mm) do begin
  671.     if mm[x]='~' then writeln else
  672.     doithonky (mm[x]);
  673.    end;
  674.   end;
  675.  
  676. begin
  677. {case upstring (m) of
  678.   '^A':domacro (urec.amacro);
  679.   '^D':domacro (urec.dmacro);
  680.   '^F':domacro (urec.fmacro);
  681.  end; }
  682. end;
  683.  
  684.  
  685. {$F-}
  686.  
  687. procedure getstr (mode:integer);
  688. var marker,cnt:integer;
  689.     p:byte absolute input;
  690.     k:char;
  691.     oldinput:anystr;
  692.     done,wrapped:boolean;
  693.     wordtowrap:lstr;
  694.  
  695.   procedure bkspace;
  696.  
  697.     procedure bkwrite (q:sstr);
  698.     begin
  699.       write (q);
  700.       if splitmode and dots then write (usr,q)
  701.     end;
  702.  
  703.   begin
  704.     if p<>0
  705.       then
  706.         begin
  707.           if input[p]=^Q
  708.             then bkwrite (' ')
  709.             else bkwrite (k+' '+k);
  710.           p:=p-1
  711.         end
  712.       else if wordwrap
  713.         then
  714.           begin
  715.             input:=k;
  716.             done:=true
  717.           end
  718.   end;
  719.  
  720.   procedure sendit (k:char; n:integer);
  721.   var temp:anystr;
  722.   begin
  723.     temp[0]:=chr(n);
  724.     fillchar (temp[1],n,k);
  725.     nobreak:=true;
  726.     write (temp)
  727.   end;
  728.  
  729.   procedure superbackspace (r1:integer);
  730.   var cnt,n:integer;
  731.   begin
  732.     n:=0;
  733.     for cnt:=r1 to p do
  734.       if input[cnt]=^Q
  735.         then n:=n-1
  736.         else n:=n+1;
  737.     if n<0 then sendit (' ',-n) else begin
  738.       sendit (^H,n);
  739.       sendit (' ',n);
  740.       sendit (^H,n)
  741.     end;
  742.     p:=r1-1
  743.   end;
  744.  
  745.   procedure cancelent;
  746.   begin
  747.     superbackspace (1)
  748.   end;
  749.  
  750.   function findspace:integer;
  751.   var s:integer;
  752.   begin
  753.     s:=p;
  754.     while (input[s]<>' ') and (s>0) do s:=s-1;
  755.     findspace:=s
  756.   end;
  757.  
  758.   procedure wrapaword (q:char);
  759.   var s:integer;
  760.   begin
  761.     done:=true;
  762.     if q=' ' then exit;
  763.     s:=findspace;
  764.     if s=0 then exit;
  765.     wrapped:=true;
  766.     wordtowrap:=copy(input,s+1,255)+q;
  767.     superbackspace (s)
  768.   end;
  769.  
  770.   procedure deleteword;
  771.   var s,n:integer;
  772.   begin
  773.     if p=0 then exit;
  774.     s:=findspace;
  775.     if s<>0 then s:=s-1;
  776.     n:=p-s;
  777.     p:=s;
  778.     sendit (^H,n);
  779.     sendit (' ',n);
  780.     sendit (^H,n)
  781.   end;
  782.  
  783.   procedure addchar (k:char);
  784.   begin
  785.     if p<buflen
  786.       then if (k<>' ') or (p>0) or wordwrap or beginwithspacesok
  787.         then begin
  788.          p:=p+1;
  789.          input[p]:=k;
  790.          if dots then begin
  791.           writechar (dotchar);
  792.           if splitmode then write (usr,k)
  793.          end
  794.          else writechar (k)
  795.         end
  796.       else
  797.     else if wordwrap then wrapaword (k)
  798.   end;
  799.  
  800.   procedure addcharnoecho (k:char);
  801.   begin
  802.     if p<buflen
  803.       then if (k<>' ') or (p>0) or wordwrap or beginwithspacesok
  804.         then begin
  805.          p:=p+1;
  806.          input[p]:=k;
  807.          if dots then begin
  808.          {writechar (dotchar);}
  809.           if splitmode then {write (usr,k)}
  810.          end
  811.          else {writechar (k)}
  812.         end
  813.       else
  814.     else if wordwrap then wrapaword (k)
  815.   end;
  816.  
  817.   procedure repeatent;
  818.   var cnt:integer;
  819.   begin
  820.     for cnt:=1 to length(oldinput) do addchar (oldinput[cnt])
  821.   end;
  822.  
  823.   procedure tab;
  824.   var n,c:integer;
  825.   begin
  826.     n:=(p+8) and 248;
  827.     if n>buflen then n:=buflen;
  828.     for c:=1 to n-p do addchar (' ')
  829.   end;
  830.  
  831.   procedure getinput;
  832.   begin
  833.     oldinput:=input;
  834.     ingetstr:=true;
  835.     done:=false;
  836.     slash:=false;
  837.     bottomline;
  838.     if splitmode and dots then top;
  839.     p:=0;
  840.     repeat
  841.       clearbreak;
  842.       nobreak:=true;
  843.       k:=getinputchar;
  844.       if hungupon then begin
  845.         input:='';
  846.         k:=#13;
  847.         done:=true
  848.       end;
  849.       case k of
  850.         ^I:tab;
  851.         ^H:bkspace;
  852.         ^M:done:=true;
  853.         ^R:repeatent;
  854.         ^X,#27:cancelent;
  855.         ^W:deleteword;
  856.         ' '..'~':addchar (k);
  857.         ^Q:if wordwrap and bkspinmsgs then addchar (k);
  858.         ^A:usermacro ('^A');
  859.         ^D:usermacro ('^D');
  860.         ^F:usermacro ('^F');
  861.       end;
  862.       if (urec.menutype=1) and (atmenu) and (k='/') then begin
  863.        slash:=true;
  864.       end;
  865.       if requestchat then begin
  866.         p:=0;
  867.         writeln (^B^N^M^M^B);
  868.         chat (requestcom);
  869.         write (^B^M^M^P,lastprompt);
  870.         requestchat:=false
  871.       end;
  872.       if (urec.menutype=1) and (atmenu) and (not slash) then done:=true
  873.     until done;
  874.     if echoit then writeln;
  875.     if splitmode and dots then begin
  876.       writeln (usr);
  877.       bottom
  878.     end;
  879.     ingetstr:=false;
  880.     ansireset
  881.   end;
  882.  
  883.   procedure onekeyinput;
  884.   begin
  885.     oldinput:=input;
  886.     ingetstr:=true;
  887.     done:=false;
  888.     slash:=false;
  889.     bottomline;
  890.     if splitmode and dots then top;
  891.     p:=0;
  892.     repeat
  893.       clearbreak;
  894.       nobreak:=true;
  895.       k:=getinputchar;
  896.       if hungupon then begin
  897.         input:='';
  898.         k:=#13;
  899.         done:=true
  900.       end;
  901.       case k of
  902.         ^I:tab;
  903.         ^H:bkspace;
  904.         ^M:done:=true;
  905.       { ^R:repeatent; }
  906.         ^X,#27:cancelent;
  907.         ^W:deleteword;
  908.         ' '..'~':addcharnoecho (k);
  909.         ^Q:if wordwrap and bkspinmsgs then addchar (k);
  910.       { ^A:usermacro (A);
  911.         ^D:usermacro (D);
  912.         ^F:usermacro (F); }
  913.       end;
  914.       {}{}{} done:=true; {}{}{}
  915.       if (urec.menutype=1) and (atmenu) and (k='/') then begin
  916.        slash:=true;
  917.       end;
  918.       if requestchat then begin
  919.         p:=0;
  920.         writeln (^B^N^M^M^B);
  921.         chat (requestcom);
  922.         write (^B^M^M^P,lastprompt);
  923.         requestchat:=false
  924.       end;
  925.       if (urec.menutype=1) and (atmenu) and (not slash) then done:=true
  926.     until done;
  927.   { if echoit then writeln; }
  928.     if splitmode and dots then begin
  929.       writeln (usr);
  930.       bottom
  931.     end;
  932.     ingetstr:=false;
  933.     ansireset
  934.   end;
  935.  
  936.   procedure divideinput;
  937.   var p:integer;
  938.   begin
  939.     p:=pos(',',input);
  940.     if p=0 then exit;
  941.     addtochain (copy(input,p+1,255)+#13);
  942.     input[0]:=chr(p-1)
  943.   end;
  944.  
  945. begin
  946.   che;
  947.   clearbreak;
  948.   linecount:=1;
  949.   wrapped:=false;
  950.   nochain:=nochain or wordwrap;
  951.   ansicolor (urec.inputcolor);
  952.   if mode=1 then getinput else
  953.   if mode=2 then onekeyinput;
  954.   if not nochain then divideinput;
  955.   while input[length(input)]=' ' do input[0]:=pred(input[0]);
  956.   if not wordwrap then
  957.     while (length(input)>0) and (input[1]=' ') do delete (input,1,1);
  958.   if wrapped then chainstr:=wordtowrap;
  959.   wordwrap:=false;
  960.   nochain:=false;
  961.   beginwithspacesok:=false;
  962.   dots:=false;
  963.   buflen:=80;
  964.   linecount:=1
  965. end;
  966.  
  967. procedure writestr (s:anystr);
  968. var k:char;
  969.     ex:boolean;
  970. begin
  971.   che;
  972.   clearbreak;
  973.   ansireset;
  974.   uselinefeeds:=linefeeds in urec.config;
  975.   usecapsonly:=not (lowercase in urec.config);
  976.   k:=s[length(s)];
  977.   s:=copy(s,1,length(s)-1);
  978.   case k of
  979.     ':':begin
  980.           write (^P,s,': ');
  981.           lastprompt:=s+': ';
  982.           getstr (1)
  983.         end;
  984.     ';':write (s);
  985.     '*':begin
  986.           write (^P,s);
  987.           lastprompt:=s;
  988.           getstr (1)
  989.         end;
  990.     '@':begin
  991.           write (^P,s);
  992.           lastprompt:=s;
  993.           getstr (2)
  994.         end;
  995.     '&':begin
  996.           nochain:=true;
  997.           write (^P,s);
  998.           lastprompt:=s;
  999.           getstr (1)
  1000.         end
  1001.     else writeln (s,k)
  1002.   end;
  1003.   clearbreak
  1004. end;
  1005.  
  1006. procedure printxy (x,y:integer; str:anystr);
  1007. var dum1,dum2:string;
  1008. begin
  1009.  writestr(#27+'['+strr(y)+';'+strr(x)+'f'+^S+str+^R);
  1010. end;
  1011.  
  1012. procedure cls;
  1013. begin
  1014.   bottom;
  1015.   clrscr;
  1016.   bottomline
  1017. end;
  1018.  
  1019. procedure writehdr (q:anystr);
  1020. var cnt,cnt2,x,xx,y,yy,z,zz:integer;
  1021. const l=30;
  1022. begin
  1023.  { if (asciigraphics in urec.config) and (urec.ansiwindows=1) then begin
  1024.    writeln (^B^M);
  1025.    write ('┌');
  1026.    for x:=1 to (l-length(q)) div 2 do write ('─');
  1027.    for z:=1 to length(q) do write ('─');
  1028.    for xx:=1 to (l-length(q)) div 2 do write ('─');
  1029.    writeln ('┐');
  1030.    write ('│');
  1031.    for cnt:=1 to (l-length(q)) div 2 do write (' ');
  1032.    ansicolor (urec.statcolor);
  1033.    write (q,^B);
  1034.    ansicolor (urec.regularcolor);
  1035.    for cnt2:=1 to (length(q)) div 2 do write (' ');
  1036.    writeln ('│');
  1037.    write ('└');
  1038.    for y:=1 to (l-length(q)) div 2 do write ('─');
  1039.    for zz:=1 to length(q) do write ('─');
  1040.    for yy:=1 to (l-length(q)) div 2 do write ('─');
  1041.    writeln ('┘');
  1042.   end
  1043.  else }
  1044.   begin
  1045.    writeln (^B^M);
  1046.    for cnt:=1 to (40-length(q)) div 2 do write (' ');
  1047.    ansicolor (urec.statcolor);
  1048.    write (q,^M^M^B);
  1049.    ansicolor (urec.regularcolor)
  1050.   end;
  1051. end;
  1052.  
  1053. function issysop:boolean;
  1054. begin
  1055.   issysop:=(ulvl>=sysoplevel) or (cursection in urec.config)
  1056. end;
  1057.  
  1058. procedure reqlevel (l:integer);
  1059. begin
  1060.   writeln (^B'Level ',l,' is required for that!')
  1061. end;
  1062.  
  1063. procedure printfile (fn:lstr);
  1064.  
  1065.   procedure getextension (var fname:lstr);
  1066.  
  1067.     procedure tryfiles (a,b,c,d:integer);
  1068.     var q:boolean;
  1069.  
  1070.       function tryfile (n:integer):boolean;
  1071.       const exts:array [1..4] of string[3]=('','ANS','ASC','40');
  1072.       begin
  1073.         if not exist (fname+'.'+exts[n]) then tryfile:=false else begin
  1074.           tryfile:=true;
  1075.           fname:=fname+'.'+exts[n]
  1076.         end
  1077.       end;
  1078.  
  1079.     begin
  1080.       if tryfile (a) then exit;
  1081.       if tryfile (b) then exit;
  1082.       if tryfile (c) then exit;
  1083.       q:=tryfile (d)
  1084.     end;
  1085.  
  1086.   begin
  1087.     if pos ('.',fname)<>0 then exit;
  1088.     if ansigraphics in urec.config  then tryfiles (2,3,1,4) else
  1089.     if asciigraphics in urec.config then tryfiles (3,1,4,2) else
  1090.     if eightycols in urec.config    then tryfiles (1,4,3,2) else
  1091.                                          tryfiles (4,1,3,2)
  1092.   end;
  1093.  
  1094. var tf:text;
  1095.     k:char;
  1096. begin
  1097.   clearbreak;
  1098.   writeln;
  1099.   getextension (fn);
  1100.   assign (tf,fn);
  1101.   reset (tf);
  1102.   iocode:=ioresult;
  1103.   if iocode<>0 then begin
  1104.     fileerror ('Printfile',fn);
  1105.     exit
  1106.   end;
  1107.   clearbreak;
  1108.   while not (eof(tf) or break or hungupon) do
  1109.     begin
  1110.       read (tf,k);
  1111.       write (k)
  1112.     end;
  1113.   if break then writeln (^B);
  1114.   writeln;
  1115.   textclose (tf);
  1116.   curattrib:=0;
  1117.   ansireset
  1118. end;
  1119.  
  1120. procedure printtexttopoint (var tf:text);
  1121. var l:lstr;
  1122. begin
  1123.   l:='';
  1124.   clearbreak;
  1125.   while not (eof(tf) or hungupon) and (l<>'.') do begin
  1126.     if not break then writeln (l);
  1127.     readln (tf,l)
  1128.   end
  1129. end;
  1130.  
  1131. procedure skiptopoint (var tf:text);
  1132. var l:lstr;
  1133. begin
  1134.   l:='';
  1135.   while not eof(tf) and (l<>'.') do
  1136.     readln (tf,l)
  1137. end;
  1138.  
  1139. function minstr (blocks:integer):sstr;
  1140. var min,sec:integer;
  1141.     rsec:real;
  1142.     ss:sstr;
  1143. begin
  1144.   rsec:=1.38 * blocks * (1200/baudrate);
  1145.   min:=trunc (rsec/60.0);
  1146.   sec:=trunc (rsec-(min*60.0));
  1147.   ss:=strr(sec);
  1148.   if length(ss)<2 then ss:='0'+ss;
  1149.   minstr:=strr(min)+':'+ss
  1150. end;
  1151.  
  1152. procedure parserange (numents:integer; var f,l:integer);
  1153. var rf,rl:mstr;
  1154.     p,v1,v2:integer;
  1155. begin
  1156.   f:=0;
  1157.   l:=0;
  1158.   if numents<1 then exit;
  1159.   repeat
  1160.     writestr ('Range [1-'+strr(numents)+'][CR/All][?/Help]:');
  1161.     if input='?' then printfile (textfiledir+'Rangehlp');
  1162.     if (length(input)>0) and (upcase(input[1])='Q') then exit
  1163.   until (input<>'?') or hungupon;
  1164.   if hungupon then exit;
  1165.   if length(input)=0 then begin
  1166.     f:=1;
  1167.     l:=numents
  1168.   end else begin
  1169.     p:=pos('-',input);
  1170.     v1:=valu(copy(input,1,p-1));
  1171.     v2:=valu(copy(input,p+1,255));
  1172.     if p=0 then begin
  1173.       f:=v2;
  1174.       l:=v2
  1175.     end else if p=1 then begin
  1176.       f:=1;
  1177.       l:=v2
  1178.     end else if p=length(input) then begin
  1179.       f:=v1;
  1180.       l:=numents
  1181.     end else begin
  1182.       f:=v1;
  1183.       l:=v2
  1184.     end
  1185.   end;
  1186.   if (f<1) or (l>numents) or (f>l) then begin
  1187.     f:=0;
  1188.     l:=0;
  1189.     writestr ('Invalid range!')
  1190.   end;
  1191.   writeln (^B)
  1192. end;
  1193.  
  1194. function menutype:integer;
  1195. begin
  1196.  menutype:=0;
  1197.  if urec.menutype=0 then menutype:=0 else
  1198.  if urec.menutype=1 then menutype:=1 else
  1199.  if urec.menutype=2 then menutype:=2;
  1200. end;
  1201.  
  1202. function menu (mname:mstr; mfn:sstr; choices:anystr):integer;
  1203. var k:char;
  1204.     sysmenu,percent,needsys:boolean;
  1205.     n,p,i:integer;
  1206.     prompt:lstr;
  1207. begin
  1208.   sysmenu:=false;
  1209.   percent:=false;
  1210.   atmenu:=true;
  1211.   for p:=1 to length(choices)-1 do
  1212.     if choices[p]='%'
  1213.       then if choices[p+1]='@'
  1214.         then percent:=true
  1215.         else
  1216.       else if choices[p+1]='@'
  1217.         then sysmenu:=true;
  1218.   writeln (^B);
  1219.   repeat
  1220.     if chatmode
  1221.       then for n:=1 to 3 do summonbeep;
  1222.     if (timeleft<1) or (timetillevent<=3) then begin
  1223.       if exist (textfiledir+'Timesup') then
  1224.       printfile (textfiledir+'Timesup') else
  1225.       begin
  1226.        writeln;
  1227.        writeln ('Sorry, your time''s up for today!');
  1228.        writeln;
  1229.       end;
  1230.       forcehangup:=true;
  1231.       menu:=0;
  1232.       exit
  1233.     end;
  1234.     if showtime in urec.config
  1235.     then prompt:=^R+'['^P+strr(timeleft)+' left'^R']'
  1236.      else prompt:='';
  1237.     prompt:=prompt+^R'['^P+mname+^R']['^P'?/Help'^R']';
  1238.     prompt:=prompt+':';
  1239.     writestr (prompt);
  1240.     n:=0;
  1241.     if length(input)=0
  1242.       then k:='_'
  1243.       else
  1244.         begin
  1245.           if (match(input,'/OFF')) or (match(input,'/OFFOFF')) or (match(input,'/OPH')) then begin
  1246.             forcehangup:=true;
  1247.             menu:=0;
  1248.             exit
  1249.           end;
  1250.           n:=valu(input);
  1251.           if n>0
  1252.             then k:='#'
  1253.             else k:=upcase(input[1])
  1254.         end;
  1255.     p:=1;
  1256.     i:=1;
  1257.     if k='?'
  1258.       then
  1259.         begin
  1260.           printfile (textfiledir+mfn+'M');
  1261.           if sysmenu and issysop then printfile (textfiledir+mfn+'S')
  1262.         end
  1263.       else
  1264.         while p<=length(choices) do begin
  1265.           needsys:=false;
  1266.           if p<length(choices)
  1267.             then if choices[p+1]='@'
  1268.               then needsys:=true;
  1269.           if upcase(choices[p])=k
  1270.             then if needsys and (not issysop)
  1271.               then
  1272.                 begin
  1273.                   reqlevel (sysoplevel);
  1274.                   p:=255;
  1275.                   needsys:=false
  1276.                 end
  1277.               else p:=256
  1278.             else
  1279.               begin
  1280.                 p:=p+1;
  1281.                 if needsys then p:=p+1;
  1282.                 i:=i+1
  1283.               end
  1284.         end
  1285.   until (p=256) or hungupon;
  1286.   writeln (^B);
  1287.   if hungupon
  1288.     then menu:=0
  1289.     else
  1290.       if k='#' then menu:=-n else menu:=i;
  1291.   atmenu:=false
  1292. end;
  1293.  
  1294. function getpassword:boolean;
  1295. var t,gog,p:sstr;
  1296.     c:char;
  1297.     frm,yiyiyi,ii:integer;
  1298. begin
  1299.   getpassword:=false;
  1300.   dots:=true;
  1301.   buflen:=15;
  1302.   getstr (1);
  1303.   gog:=input;
  1304.   p:='';
  1305.   t:='';
  1306.   frm:=6;
  1307.   if gog='' then begin
  1308.    randomize;
  1309.    for yiyiyi:=1 to frm do begin
  1310.     ii:=random(36);
  1311.     if ii<10 then c:=chr(ord('0')+ii)
  1312.      else c:=chr(ord('A')+ii-10);
  1313.     gog:=gog+c;
  1314.    end;
  1315.   end;
  1316. {  repeat
  1317.     frm:=random (15);
  1318.    until frm in [6..10];
  1319.    writeln ('frm:',frm);
  1320.    for yiyiyi:=1 to frm do
  1321.    begin
  1322.     repeat
  1323.      c[yiyiyi]:=chr(random(90));
  1324.     until c[yiyiyi] in ['0'..'9','A'..'Z'];
  1325.     writeln ('c[yiyiyi]:'+c[yiyiyi]);
  1326.     p:=p+c[yiyiyi];
  1327.     writeln ('p:'+p);
  1328.    end;
  1329.    gog:=p;
  1330.   end; }
  1331.   begin
  1332.    t:=gog;
  1333.    writeln (^R'Password: '^S+t);
  1334.    dots:=true;
  1335.    writestr (^R'Re-enter for verification:');
  1336.    if not match(t,input) then begin
  1337.     writeln ('They don''t match!');
  1338.     getpassword:=hungupon;
  1339.     exit
  1340.    end;
  1341.    urec.password:=t;
  1342.    getpassword:=true
  1343.  end
  1344. end;
  1345.  
  1346. function checkpassword (var u:userrec):boolean;
  1347. var tries:integer;
  1348. begin
  1349.   tries:=0;
  1350.   checkpassword:=true;
  1351.   repeat
  1352.     splitscreen (5);
  1353.     top;
  1354.     writeln (usr,'Password Entry');
  1355.     writeln (usr,'[User Name]: ',u.handle);
  1356.     writeln (usr,'[Password]: ',u.password);
  1357.     write (usr,'Has entered so far: ');
  1358.     bottom;
  1359.     dots:=true;
  1360.     writestr (^M'[Enter Password]:');
  1361.     unsplit;
  1362.     if hungupon then begin
  1363.       checkpassword:=false;
  1364.       exit
  1365.     end;
  1366.     if match(input,u.password)
  1367.       then exit
  1368.       else tries:=tries+1
  1369.   until tries>3;
  1370.   checkpassword:=false
  1371. end;
  1372.  
  1373. procedure getacflag (var ac:accesstype; var tex:mstr);
  1374. begin
  1375.   writestr ('[K]ick off, [B]y level, [L]et in:');
  1376.   ac:=invalid;
  1377.   if length(input)=0 then exit;
  1378.   case upcase(input[1]) of
  1379.     'B':ac:=bylevel;
  1380.     'L':ac:=letin;
  1381.     'K':ac:=keepout
  1382.   end;
  1383.   tex:=accessstr[ac]
  1384. end;
  1385.  
  1386. procedure calcqr;
  1387. begin
  1388.  with urec do begin
  1389.   qr := qrmultifactor*(urec.uploads+urec.nbu)-urec.downloads;
  1390.  end;
  1391. end;
  1392.  
  1393. procedure overlayerror;
  1394. begin
  1395.  write ('Overlay Manager Error ',ovrresult,': ');
  1396.  case ovrresult of
  1397.   -1:write ('Overlay Manager Error.');
  1398.   -2:write ('Overlay File not found.');
  1399.   -3:write ('Not enough memory.');
  1400.   -4:write ('I/O Error.');
  1401.   -5:write ('EMS Driver not installed.');
  1402.   -6:write ('Not enough EMS memory.');
  1403.  end;
  1404.  writeln;
  1405.  halt(4);
  1406. end;
  1407.  
  1408. function parsedate (date:anystr):lstr;
  1409. var m,d,y,inc,gog:sstr;
  1410.     year,month,day,dayofweek:word;
  1411. begin
  1412.  if length(date)<>8 then begin
  1413.   parsedate:=date;
  1414.   exit;
  1415.  end else
  1416.  begin
  1417.   m:=copy (date,1,2);
  1418.   d:=copy (date,4,2);
  1419.   y:=copy (date,7,2);
  1420.   if m='01' then gog:='Jan.';
  1421.   if m='02' then gog:='Feb.';
  1422.   if m='03' then gog:='Mar.';
  1423.   if m='04' then gog:='Apr.';
  1424.   if m='05' then gog:='May.';
  1425.   if m='06' then gog:='Jun.';
  1426.   if m='07' then gog:='Jul.';
  1427.   if m='08' then gog:='Aug.';
  1428.   if m='09' then gog:='Sep.';
  1429.   if m='10' then gog:='Oct.';
  1430.   if m='11' then gog:='Nov.';
  1431.   if m='12' then gog:='Dec.';
  1432.   getdate (year,month,day,dayofweek);
  1433.   inc:=copy (strr(year),1,2);
  1434.   parsedate:=gog+' '+d+' '+inc+y;
  1435.  end;
  1436. end;
  1437.  
  1438. function ansi:boolean;
  1439. begin
  1440.  if (ansigraphics in urec.config) then ansi:=true else
  1441.   ansi:=false;
  1442. end;
  1443.  
  1444. function ascii:boolean;
  1445. begin
  1446.  if (asciigraphics in urec.config) then ascii:=true else
  1447.   ascii:=false;
  1448. end;
  1449.  
  1450. procedure setmenutype;
  1451. var n:integer;
  1452. begin
  1453.   writehdr ('Menu Type');
  1454.   write ('Current setting: '^S);
  1455.   case urec.menutype of
  1456.    0:writeln ('Standard Menus');
  1457.    1:writeln ('Hotkey Menus');
  1458.    2:writeln ('Pulldown Menus');
  1459.   end;
  1460.   writeln (^B^M'Would you like:');
  1461.   writeln;
  1462.   writeln (' [0]: Standard Menus [probably use these]');
  1463.   writeln (' [1]: Hotkey Menus [one-key]');
  1464.   writeln (' [2]: Pulldown Menus [Ansi required]');
  1465.   writeln;
  1466.   writestr (^M'Your choice [CR/Exit]:');
  1467.   if length(input)<1 then exit;
  1468.   n:=valu(input);
  1469.   if (n>-1) and (n<3) then begin
  1470.    case n of
  1471.     0:urec.menutype:=0;
  1472.     1:urec.menutype:=1;
  1473.     2:urec.menutype:=2;
  1474.    end;
  1475.    writeurec
  1476.   end
  1477. end;
  1478.  
  1479. procedure movexy (x,y:integer);
  1480. begin
  1481.  writestr (#27+'['+strr(y)+';'+strr(x)+'f');
  1482. end;
  1483.  
  1484. procedure ansicls;
  1485. begin
  1486.  if (ansigraphics in urec.config) then
  1487.  write (#27+'[2J') else
  1488.  write (^L);
  1489. end;
  1490.  
  1491. begin
  1492. end.
  1493.  
  1494.