Program Decoder;

Const
     BufSize  =  2048;


Var
    SF, DF : File;
NumR, NumW : Word;
    C1, C2 : Word;
      R, W : Byte;
     BufR  : Array  [ 1..BufSize ] of byte;
     BufW  : Array  [ 1..2*BufSize ] of byte;

Begin
  WriteLn;
  WriteLn('Program  -  Enterer');

  {If (ParamStr(1)='') or (ParamStr(2)='') then
                      begin
                       WriteLn('Usage: Enterer FileName1 FileName2');
                       WriteLn('FileName1 - Source');
                       WriteLn('FileName2 - Destination');
                       Halt(1);
                      end;}
  If (ParamStr(1) = ParamStr(2)) and  (ParamStr(1) <> '') then
                 begin
                    WriteLn ('Error! Can''t recode file to itself!');
                    Halt(2);
                 end;
  Assign  ( SF, ParamStr(1) );
  Assign  ( DF, ParamStr(2) );
  Reset   ( SF, 1 );
  ReWrite ( DF, 1 );

    Repeat
     BlockRead ( SF, BufR, SizeOf(BufR), NumR );
     C2 := 0;
        For C1:= 1 to NumR do
         begin
          W := BufR[C1];
          Inc(C2);
          BufW[C2] := W;
          If W=10 then begin Inc(C2); BufW[C2] := 13; end;
        end;
     BlockWrite ( DF, BufW, C2, NumW );
    Until ( NumR =  0 ) or ( C2 <> NumW );

  Close   ( SF );
  Close   ( DF );
End.