{ COMP.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Program v grafickej podobe zobrazi rozdiely medzi dvoma subormi. } { } { Datum:28.05.96 http://www.trsek.com } program comp; uses crt,dos,trsek; var f,g:file of char; i,i1:integer; ch1,ch2,ch:char; s1,s2:string; begin writeln; writeln('Compare two files Software by TRSEK'); writeln('---------------------------------------------------------------'); if paramcount<2 then begin writeln('Syntax: comp.exe %1 %2'); writeln(' %1 - prvy subor'); writeln(' %2 - druhy subor'); halt(0); end; s1:=paramstr(1); s2:=paramstr(2); writeln('Compare ',s1,' with ',s2); assign(f,s1); assign(g,s2); {$I-} reset(f); if IOresult<>0 then begin writeln('Chyba pri citani suboru ',s1); halt(1); end; reset(g); if IOresult<>0 then begin writeln('Chyba pri citani suboru ',s2); halt(1); end; clrscr; open_win(1,1,80,12,s1,blue); open_win(1,12,80,23,s2,blue); textcolor(yellow); i1:=0;i:=0;ch:=#0; repeat i:=i+1; i1:=i1+1; read(f,ch1); read(g,ch2); if ch1<>ch2 then textbackground(green) else textbackground(blue); window(2,2,78,12); gotoxy(1+i-78*trunc(i/78),1+trunc(i/78)); if ord(ch1)<>7 then write(ch1); if (ch1 in [#10]) then i:=78*trunc(i/78)+78; window(2,13,78,23); gotoxy(1+i1-78*trunc(i1/78),1+trunc(i1/78)); if ord(ch2)<>7 then write(ch2); if (ch1 in [#10]) then i1:=78*trunc(i1/78)+78; if i>777 then begin i:=0;i1:=0;ch:=#0; KurzorZap(false); repeat ch:=readkey; until (ch in [#27,#13]); window(2,2,78,11); clrscr; window(2,13,78,22); clrscr; end; until (eof(f) or eof(g) or (ch=#27)); KurzorZap(false); end.