{$IFDEF MSDOS}
{$M $4000,0,0}
{$ENDIF}

Uses
  DOS,
  tMisc;

Var
  Year, Month, Day, DayOfWeek : {$IFNDEF OS2} Word; {$ELSE} LongInt; {$ENDIF}
  tS, S                       : String [8];
  F, F1                       : Text;
  Strr, Section               : String;

Const
  ChLoc : Boolean = False;

Begin
  GetDate (Year, Month, Day, DayOfWeek);
  Str (Day, tS); If Ord (tS [0]) = 1 Then tS := '0' + tS; S := tS;
  Str (Month, tS); If Ord (tS [0]) = 1 Then tS := '0' + tS; S := S + tS;

{MODIFYING TORNADO.CTL ON MY STATION}

{$IFNDEF OS2}
  If ParamCount > 0 Then
{$ENDIF}
  Begin
    Assign (F,  '\FIDO\TORNADO\tornado.ctl');
    Assign (F1, '\torctl.$$$');

    ReSet (F);
    ReWrite (F1);

    While Not EoF (F) Do
    Begin
      ReadLn (F, Strr);
      If Copy (Trim (Strr), 1, 1) = '[' Then Section := UpString (ExtractWord (1, Strr, ['[', ']', ' ']));

      If Section = 'SYSTEM' Then
      Begin
        If UpString (ExtractWord (1, Strr, [' '])) = 'SYSOP' Then ChangeParam (Strr, 'Konstantin Klyagin');
        If UpString (ExtractWord (1, Strr, [' '])) = 'BBSNAME' Then ChangeParam (Strr, 'Pulse BBS');
        If UpString (ExtractWord (1, Strr, [' '])) = 'LOCATION' Then ChangeParam (Strr, 'Kharkov, Ukraine');
        If UpString (ExtractWord (1, Strr, [' '])) = 'PATH' Then ChangeParam (Strr, 'D:\FIDO\TORNADO');
      End Else
      If Section = 'MISCELLANEOUS' Then
      Begin
        If UpString (ExtractWord (1, Strr, [' '])) = 'SOUND' Then ChangeParam (Strr, 'No');
      End Else
      If Section = 'FILES&DIRS' Then
      Begin
        If UpString (ExtractWord (1, Strr, [' '])) = 'TEMPDIR' Then ChangeParam (Strr, 'C:\TMP');
        If UpString (ExtractWord (1, Strr, [' '])) = 'LOGFILE' Then ChangeParam (Strr, 'E:\FIDO\LOG\tornado.log');
      End;

      WriteLn (F1, Strr);
    End;

    Close (F);  Erase (F);
    Close (F1);

    Rename (F1, '\FIDO\TORNADO\tornado.ctl');
  End;

{PACK}
{$IFNDEF OS2}
  SwapVectors;
  If ParamCount > 0 Then tS := 'w' Else tS := 'a';
  Exec (GetEnv ('COMSPEC'), '/c rar m -s- -rr -r -std \work\inst\tor' + S + tS);
  SwapVectors;
{$ELSE}
  Exec (GetEnv ('COMSPEC'), '/c rar2 m -s- -rr -r -std \work\inst\tor' + S + 'p');
{$ENDIF}

End.