home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 153.img / TELES.ZIP / FIX.PAS < prev    next >
Pascal/Delphi Source File  |  1988-07-23  |  17KB  |  606 lines

  1. Uses
  2.   Crt,
  3.   Turbo3,
  4.   DOS;
  5.  
  6. {$R-}                   {Range checking off}
  7. {$B+}                   {Boolean complete evaluation on}
  8. {$S+}                   {Stack checking on}
  9. {$I+}                   {I/O checking on}
  10. {$M 32150,1250,1250}          {Declared here suffices for all Units as well!}
  11. {$V-}
  12.  
  13. type
  14.   astr = String[160];  { generic string type for parameters      }
  15.                        { note the change from Waynes str => Astr }
  16.  
  17. const
  18.   buffer_max = 5120;
  19.  
  20.  
  21. CONST strlen=160;
  22.       maxusers=500;
  23.       dsaves : Integer = 0;
  24.  
  25. TYPE restrictions=(rlogon,rchat,rvalidate,rbackspace,ramsg,rpostan,
  26.                    rpost,remail,rvoting,rmsg);
  27.      acrq='@'..'G';
  28.      newtyp=(rp,lt,rm);
  29.      str40=string[40];
  30.      deflts=(spcsr,onekey,wordwrap,pause,mmnu,ansi,color,music);
  31.      pnr=record name:string[40]; number:string[14]; hs:byte; end;
  32.      anontyp=(no,yes,forced,dearabby);
  33.      ansttype=(postn,emailn,pana,sanm,cosysop,lcosysop);
  34.      opts=(alert,smw,nomail);
  35.      dlnscan=set of 0..39;
  36.      emary=array[1..20] of integer;
  37.      clrs=array[false..true,1..8] of byte;
  38.      clrs2=array[false..true,0..9] of byte;
  39.      slr=record
  40.            ttime:byte;
  41.            mallowed:integer;
  42.            emails,posts:byte;
  43.            anst:set of ansttype;
  44.          end;
  45.      messages=record
  46.                 ltr:char;
  47.                 number:integer;
  48.                 ext:byte;
  49.               end;
  50.      smalrec=record
  51.                name:string[25];
  52.                number:integer;
  53.              end;
  54.      userrec=record
  55.                name:string[21];
  56.                realname:string[18];
  57.                deleted:boolean;
  58.                pw:string[8];
  59.                ph:string[12];
  60.                waiting:byte;
  61.                laston:string[10];
  62.                loggedon:integer;
  63.                msgpost:integer;
  64.                emailsent:integer;
  65.                feedback:integer;
  66.                linelen:byte;
  67.                pagelen:byte;
  68.                defaults:set of deflts;
  69.                ontoday:byte;
  70.                illegal:byte;
  71.                ttimeon:real;
  72.                dlnscn:dlnscan;
  73.                sl:byte;
  74.                ac:set of restrictions;
  75.                ar:set of acrq;
  76.                qscan:array[1..19] of messages;
  77.                qscn:array[1..19] of boolean;
  78.                macro:array[1..2] of string[79];
  79.                comptype:byte;
  80.                option:set of opts;
  81.                vote:array[1..9] of byte;
  82.                sbn:byte;
  83.                dsl:byte;
  84.                uploads,downloads:integer;
  85.                uk,dk:integer;
  86.                age:byte;
  87.                sex:char;
  88.                note:string[39];
  89.                forusr:integer;
  90.                cols:clrs;                (* Res[2] will be last file area *)
  91.                res:array[1..72] of byte; (* Res[1] will be last msg base *)
  92.                citystate:string[26];
  93.                street:string[21];
  94.                zipcode:string[10];
  95.                occupation:string[40];
  96.                wherebbs:string[40];
  97.                lockedout:boolean;
  98.                lockedfile:string[8];
  99.                computer:string[14];
  100.                cols2:clrs2;
  101.              end;
  102.       boardrec=record
  103.                  name:string[30];
  104.                  filename:string[12];
  105.                  sl:byte;
  106.                  maxmsgs:byte;
  107.                  pw:string[10];
  108.                  anonymous:anontyp;
  109.                  ar:acrq;
  110.                  key:char;
  111.                  postsl:byte;
  112.                end;
  113.       msgstat=(validated,unvalidated,deleted);
  114.       messagerec=record
  115.                    title:string[30];
  116.                    messagestat:msgstat;
  117.                    message:messages;
  118.                    owner:integer;
  119.                    date:integer;
  120.                    mage:byte;
  121.                  end;
  122.  SYSTATREC=RECORD
  123.                   boardpw:string[20];
  124.                   sysoppw:string[20];
  125.                   hmsg:messages;
  126.                   users:integer;
  127.                   lastdate:string[8];
  128.                   callernum:integer;
  129.                   activetoday:integer;
  130.                   callstoday:integer;
  131.                   msgposttoday:integer;
  132.                   emailtoday:integer;
  133.                   fbacktoday:integer;
  134.                   uptoday:integer;
  135.                   closedsystem:boolean;
  136.                   comport:byte;
  137.                   maxbaud:integer;
  138.                   msgpath:string[79];
  139.                   gfiledate:string[8];
  140.                   lowtime,hitime:integer;
  141.                   res:array[1..185] of byte;
  142.                   sysopcolor:byte;
  143.                   usercolor:byte;
  144.                   maxlines:byte;
  145.                   special:boolean;
  146.                   clearmsg:boolean;
  147.                   bbspw:string[20];
  148.                   matrix:boolean;
  149.                   engage:string[79];
  150.                   endchat:string[79];
  151.                   alias:boolean;
  152.                   echoc:char;
  153.                   sysopin:string[79];
  154.                   sysopout:string[79];
  155.                   note:array[1..2] of string[79];
  156.                   lprompt:string[40];
  157.                   lansi:boolean;
  158.                   init:string[40];
  159.                   wait:string[79];
  160.                   app:boolean;
  161.                   fone:boolean;
  162.                   sysopmacro:array[1..9] of string[72];
  163.                   forcevoting:boolean;
  164.                   multitask:boolean;
  165.                   gfilepath:string[79];
  166.                   pause:string[79];
  167.                   hangup:string[40];
  168.                   answer:string[40];
  169.                   result300:integer;
  170.                   result1200:integer;
  171.                   result2400:integer;
  172.                   nocarrier:integer;
  173.                   tries:byte;
  174.                   newsl:byte;
  175.                   newdsl:byte;
  176.                   newar:set of acrq;
  177.                   newac:set of restrictions;
  178.                   newfp:integer;
  179.                   newuk:integer;
  180.                   bwindow:boolean;
  181.                   bsdelay:byte;
  182.                   mcimsg:boolean;
  183.                   b300lowtime,b300hitime:integer;
  184.                   dllowtime,dlhitime:integer;
  185.                   b300dllowtime,b300dlhitime:integer;
  186.                   lock300:boolean;
  187.                   result4800:integer;
  188.                   result9600:integer;
  189.                   SysopFirst:String[12];
  190.                   SysopLast:String[16];
  191.                   BBSName:String[40];
  192.                   BBSPhone:String[12];
  193.                   ANSIq:String[40];
  194.                   WantQuote:Boolean;
  195.                   Menupath:string[79];
  196.                   autosl:byte;
  197.                   autodsl:byte;
  198.                   autoar:set of acrq;
  199.                   autoac:set of restrictions;
  200.         END;
  201.       blk=array[1..255] of byte;
  202.       mailrec=record
  203.                 title:string[30];
  204.                 from,destin:integer;
  205.                 msg:messages;
  206.                 date:integer;
  207.                 mage:byte;
  208.               end;
  209.       gft=record
  210.             num:integer;
  211.             title:string[40];
  212.             filen:string[12];
  213.           end;
  214.       smr=record
  215.             msg:astr;
  216.             destin:integer;
  217.           end;
  218.       vdatar=record
  219.                question:string[79];
  220.                numa:integer;
  221.                answ:array[0..9] of record
  222.                       ans:string[25];
  223.                       numres:integer;
  224.                     end;
  225.              end;
  226.       ulrec=record
  227.               name:string[25];
  228.               filename:string[12];
  229.               password:string[10];
  230.               dsl:byte;
  231.               maxfiles:integer;
  232.               key:char;
  233.               ulpath:string[39];
  234.               dlpath:string[40];
  235.               agereq:byte;
  236.               ar:acrq;
  237.             end;
  238.       ulfrec=record
  239.                filename:string[12];
  240.                description:string[60];
  241.                filepoints:byte;
  242.                res:array[1..16] of byte;
  243.                nacc:integer;
  244.                ft:byte;
  245.                blocks:integer;
  246.                owner:integer;
  247.                date:string[8];
  248.                daten:integer;
  249.              end;
  250.       strptr=^strrec;
  251.       strrec=record
  252.                i:astr;
  253.                next,last:strptr;
  254.              end;
  255.       zlogt=record
  256.               date:string[8];
  257.               active,calls,post,email,fback,up:integer;
  258.             end;
  259. {    expro=record
  260.              descr:string[30];
  261.              rcmd:string[50];
  262.              scmd:string[50];
  263.              xferok:integer;
  264.            end;}
  265.  
  266. CONST dcols:clrs=((7,7,15,15,15,112,7,143),(3,1,11,9,14,31,4,140));
  267.       dcols2:clrs2=((15,7,7,15,15,15,112,7,143,7),(15,3,1,11,9,14,31,4,140,10));
  268.  
  269. var sf:file of smalrec;
  270.     uf:file of userrec;
  271.     bf:file of boardrec;
  272. {   xp:file of expro;}
  273.     mailfile:file of mailrec;
  274.     ulf:file of ulrec;
  275.     uboards:array[0..39] of ulrec;
  276. {   protocals:array [0..4] of expro;}
  277.     maxulb:integer;
  278.     sysopf:text{[1024]};
  279.     slf:file of slr;
  280.     seclev:array[0..255] of slr;
  281.     systatf:file of systatrec;
  282.     systat:systatrec;
  283.     sr:smalrec;
  284.     thisline,chatr,buf,spd,irt,lastname,ll,i:astr;
  285.     thisuser,user:userrec;
  286.     boards:array[1..19] of boardrec;
  287.     fw,extramsgs,mread,board,numboards,t,usernum,numprotocals:integer;
  288.     pap,lil,realsl,realdsl,ftoday,ptoday,etoday:integer;
  289.     c,ID:char;
  290.     rep,hungup,useron,next,chatcall,doneday,echo,hangup,incom,outcom:boolean;
  291.     extratime,chattime,timeon:real;
  292.     mailread,smread,macok,lan,enddayf,ch,quit,beepend:boolean;
  293.     smf:file of smr;
  294.     vqu:array[1..9] of boolean;
  295.     ldate:integer;
  296.     cmd:char;
  297.     bread:byte;
  298.     bchanged:boolean;
  299.     cf:text; cfo,okt:boolean;
  300.     elevel:byte;
  301.     curco:byte;
  302.     sll:astr;
  303.     andwith:byte;
  304.     checkit:boolean;
  305.     geek:astr;
  306.     lmain:boolean;
  307.     lmsg:boolean;
  308.     windowon,entry,wantfilename,nofile,nofeed:boolean;
  309.     nopfile:boolean;
  310.     reading_a_msg,write_msg:boolean;
  311.     wantout:boolean;
  312.     wcolor:boolean;
  313.     Filv:Text;
  314.     N:Astr;
  315.     noc    : integer;
  316.     found  : boolean;
  317.     directive,menuprompt:astr;
  318.     FILEBOARD:integer;
  319.     first_time:boolean;
  320.     ulff:file of ulfrec;
  321.     crc:integer;
  322.     doit:boolean;
  323.     sortbd,doneft:boolean;
  324.     ldat:astr;
  325.     ix:array[1..9] of string[79];
  326.     ymodem,ucrc,bnp:boolean;
  327.     c1,c2,c3:integer;
  328.     chksum:byte;
  329.     lrn:integer;
  330.     lfn:astr;
  331.     all:boolean;
  332.     ft:byte;
  333.     ymbtt:real;
  334.     ymodemfiles:integer;
  335.     ymbindx:integer;
  336.     ymbary:array[1..20] of record
  337.       fn:string[80];
  338.       tt:real;
  339.     end;
  340.     dta:string[44];
  341.     filenamef,s1,s2,s3:astr;
  342.     donedos,dld,d1,d2,done,abort:boolean;
  343.     cd,cmdlist,start_dir:astr;
  344.     returna,quitafterdone:boolean;
  345.     answerbaud:integer;
  346.     topheap:^byte;
  347.     i1:astr;
  348.     f,f1:file of byte;
  349.     x:byte;
  350.     lastvar:byte;
  351.  
  352. function tch(i:astr):astr;
  353. begin
  354.   if length(i)>2 then i:=copy(i,length(i)-1,2) else
  355.     if length(i)=1 then i:='0'+i;
  356.   tch:=i;
  357. end;
  358.  
  359. function date:astr;
  360. var reg:registers;
  361.     m,d,y:string[4];
  362. begin
  363.   reg.ax:=$2a00; msdos(Dos.Registers(reg)); str(reg.cx,y); str(reg.dx mod 256,d);
  364.   str(reg.dx shr 8,m);
  365.   date:=tch(m)+'/'+tch(d)+'/'+tch(y);
  366. end;
  367.  
  368. function checkpw:boolean;
  369. begin
  370.   checkpw:=true;
  371. end;
  372.  
  373. procedure prompt(i:astr);
  374. begin
  375.   write(i);
  376. end;
  377.  
  378. procedure print(i:astr);
  379. begin
  380.   writeln(i);
  381. end;
  382.  
  383. procedure cl(i:integer);
  384. begin
  385.   textcolor(i);
  386. end;
  387.  
  388. function okansi:boolean;
  389. begin
  390.   okansi:=true;
  391. end;
  392.  
  393. procedure savesystat;  (* save systat *)
  394. begin
  395.   reset(systatf); write(systatf,systat); close(systatf);
  396. end;
  397.  
  398. function cstr(i:integer):astr;
  399. var c:astr;
  400. begin
  401.   str(i,c); cstr:=c;
  402. end;
  403.  
  404. procedure prt(i:astr);
  405. begin
  406.   cl(9);
  407.   write(i);
  408. end;
  409.  
  410. procedure nl;
  411. begin
  412.   writeln;
  413. end;
  414.  
  415. procedure onek(var c:char; ch:astr);    (* 1 Key example: onkey(c,'1234'); *)
  416. var i1,i:astr; tf:boolean;
  417. begin
  418.   tf:=false;
  419.   repeat
  420.     c:=readkey;
  421.     c:=upcase(c);
  422.     tf:=true;
  423.   until (pos(c,ch)>0);
  424.   writeln(c);
  425. end;
  426.  
  427.  
  428. function mln(i:astr; l:integer):astr;
  429. begin
  430.   while length(i)<l do i:=i+' ';
  431.   mln:=i;
  432. end;
  433.  
  434. function mn(i,l:integer):astr;
  435. begin
  436.   mn:=mln(cstr(i),l);
  437. end;
  438.  
  439. function value(I:astr):integer;
  440. var n,n1:integer;
  441. begin
  442.   val(i,n,n1);
  443.   if n1<>0 then begin
  444.     i:=copy(i,1,n1-1);
  445.     val(i,n,n1)
  446.   end;
  447.   value:=n;
  448.   if i='' then value:=0;
  449. end;
  450.  
  451. procedure cls;
  452. begin
  453.   clrscr;
  454. end;
  455.  
  456. procedure checkhangup;
  457. begin
  458. end;
  459.  
  460. procedure local_input1(var i:astr; ml:integer; tf:boolean);
  461. var cp:integer;
  462.     cc:char;
  463.     r:real;
  464. begin
  465.   cp:=1;
  466.   repeat
  467.     cc:=readkey;
  468.     if not tf then cc:=upcase(cc);
  469.     if (cc>=' ') and (cc<chr(127)) then
  470.       if cp<=ml then begin
  471.       i[cp]:=cc;
  472.       cp:=cp+1;
  473.       write(cc);
  474.     end else else case ord(cc) of
  475.       8:if cp>1 then begin
  476.                cc:=chr(8);
  477.                write(cc);write(' '); write(cc);
  478.                cp:=cp-1;
  479.              end;
  480.       21,24:while cp<>1 do begin
  481.                cp:=cp-1;
  482.                write(#8);write(' ');write(#8);
  483.              end;
  484.       end;
  485.   until (cc=#13) or (cc=#14);
  486.   i[0]:=chr(cp-1);
  487.   writeln;
  488. end;
  489.  
  490. procedure getkey(c:Char);
  491. begin
  492.   c:=readkey;
  493. end;
  494.  
  495. procedure local_input(var i:astr; ml:integer);  (* Input uppercase only *)
  496. begin
  497.   local_input1(i,ml,false);
  498. end;
  499.  
  500. procedure local_inputl(var i:astr; ml:integer);   (* Local_Input lower & upper case *)
  501. begin
  502.   local_input1(i,ml,true);
  503. end;
  504.  
  505. Procedure Tcenter(Z:Astr);
  506. Var Y,P:Integer;
  507. Begin
  508.   P:=40-(length(z) div 2);
  509.   y:=wherey;
  510.   gotoxy(p,y);
  511.   writeln(z);
  512. End;
  513.  
  514. Procedure Tcenter2(Z:Astr);
  515. Var Y,P:Integer;
  516. Begin
  517.   P:=40-(length(z) div 2);
  518.   y:=wherey;
  519.   gotoxy(p,y);
  520.   write(z);
  521. End;
  522.  
  523. var a:integer; s:astr;
  524. Begin
  525.   hangup:=false;
  526.   assign(systatf,'status.dat');
  527.   reset(systatf); read(systatf,systat);close(systatf);
  528.   repeat
  529.   window(1,1,80,25);
  530.   clrscr;
  531.   gotoxy(1,1);
  532.   textbackground(1);
  533.   cl(15);clreol;Tcenter('STATUS.DAT -- Crash Recovery By Carl Mueller');
  534.   textbackground(0); gotoxy(1,10);
  535.   textcolor(14);
  536.   Writeln('<< Crash Recovery for STATUS.DAT >>');  Writeln;
  537.   cl(15);
  538.   Writeln('1) # of users     5) Gfiles Drive/Path');
  539.   Writeln('2) # of callers   6) Message Drive/Path');
  540.   Writeln('3) Com port       7) Menus drive/Path');
  541.   Writeln('4) Maximum Baud   Q) Quit to DOS');
  542.   cl(10); writeln;
  543.   Write('Selection: '); cl(9);
  544.   onek(c,'12Q34567');
  545.   case c of
  546.     '1':begin
  547.           textcolor(15);
  548.           writeln('Current number of users is ',systat.users,'.');
  549.           textcolor(12);
  550.           write('Please enter new number: '); textcolor(10);
  551.           local_input(s,3);
  552.           systat.users:=value(s);
  553.         end;
  554.     '2':begin
  555.           textcolor(15);
  556.           Writeln('Current number of callers is ',systat.callernum,'.');
  557.           textcolor(12);
  558.           write('Please enter new number: '); textcolor(10);
  559.           local_input(s,5);
  560.           systat.callernum:=value(s);
  561.         end;
  562.     '3':begin
  563.           textcolor(15);
  564.           writeln('Current comport is ',systat.comport,'.');
  565.           textcolor(12);
  566.           writeln('Enter new comport #: '); textcolor(10);
  567.           local_input(s,1);
  568.           systat.comport:=value(s);
  569.         end;
  570.     '4':begin
  571.           textcolor(15);
  572.           writeln('Maximum baud is ',systat.maxbaud,'.');
  573.           textcolor(12);
  574.           write('Enter new maximum baud: '); textcolor(10);
  575.           local_input(s,4);
  576.           systat.maxbaud:=value(s);
  577.         end;
  578.     '5':begin
  579.           textcolor(15);
  580.           writeln('Gfiles drive/path is ',systat.gfilepath,'.');
  581.           textcolor(12);
  582.           write('Enter new drive/path: '); textcolor(10);
  583.           local_input(s,79);
  584.           systat.gfilepath:=s;
  585.         end;
  586.     '6':begin
  587.           textcolor(15);
  588.           writeln('Message drive/path is ',systat.msgpath,'.');
  589.           textcolor(12);
  590.           write('Enter new drive/path: '); textcolor(10);
  591.           local_input(s,79);
  592.           systat.msgpath:=s;
  593.         end;
  594.      '7':begin
  595.           textcolor(15);
  596.           writeln('Menus drive/path is ',systat.menupath,'.');
  597.           textcolor(12);
  598.           write('Enter new drive/path: '); textcolor(10);
  599.           local_input(s,79);
  600.           systat.menupath:=s;
  601.         end;
  602.    end;
  603.    until (c='Q');
  604.    savesystat;
  605. end.
  606.