koreth%panarthea.ebay@sun.com (Steven Grimm) (09/05/89)
Submitted-by: wscart01@ulkyvx.bitnet (Stuart Carter) Posting-number: Volume 2, Issue 81 Archive-name: gfadiff OK, i've seen some Diff programs posted here. Here is another. This is the comparision program i made up to help me debug. All i ask is that if changes are made, that the new code be uploaded to the nearest BBS and that this code not be uploaded to the compu-serve network. (Had a tiff with them 7 years ago, long story...) Have fun with it.... Stuart PS: One modification i ment to do but never did, the adress that the files Bload into should be even. It will speed up the process by 50% load time. #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # DIFF_315.LST # sed 's/^X//' << 'SHAR_EOF' > DIFF_315.LST && X' X' File Comparision Program by Stuart Carter Version 3.15 c1988 X' X' I Have made this program avalible to the the public with the following X' rules: X' X' 1) Neither this work or any derivative of it will be sold for profit. X' 2) This program may not be distibuted by or thru the Compu-Serve network. X' 3) Any person Altering and uploading this code MUST: X' a)Add name and date to 'Modifying' author's list and X' b)Increment Version counter and X' c)Upload new modifed source code. X' X' Thats all... X' Stuart Carter (502)/491-0126 Bitnet: WSCART01@ULKYVX X' Add Modifying authors names here... X' X' X' X' X' X' X' X1: XT=5 XZ%=0 XC1%=1 XCls XPrint At(23,1);"Comparision Program by Stuart Carter" XPrint At(32,3);"NAME OF FILE #1" XFileselect "*.*","",File1$ XIf File1$="" X End XEndif XPrint At(32,3);"Loading ......." XOpen "R",#1,File1$,100 XField #1,100 As A$ XF1=Lof(#1) XA=Int((F1)/100)+1 XDim F1$(A) XFor X=1 To A-1 X Get #1 X F1$(X)=A$ XNext X XClose #1 XIf F1<65000 X Open "R",#1,File1$,1 X Field #1,1 As A$ X For Y=(X-1)*100 To F1 X Get #1,Y X F1$(X)=F1$(X)+A$ X Next Y X Close #1 XEndif XPrint At(32,3);"NAME OF FILE #2" XFileselect "*.*","",File2$ XIf File2$="" X End XEndif XPrint At(32,3);"Loading ......." XOpen "R",#2,File2$,100 XField #2,100 As B$ XF2=Lof(#2) XB=Int((F2)/100)+1 XDim F2$(B) XFor X=1 To A-1 X Get #2 X F2$(X)=B$ XNext X XClose #2 XIf F2<65000 X Open "R",#2,File2$,1 X Field #2,1 As B$ X For Y=(X-1)*100 To F1 X Get #2,Y X F2$(X)=F2$(X)+B$ X Next Y X Close #2 XEndif XPrint At(32,3);" " XPrint At(10,5);"file#1 : ";File1$;" is ";F1;" bytes" XPrint At(10,7);"file#2 : ";File2$;" is ";F2;" bytes" XPrint At(13,9);"Hexadecimal print(Y/N)"; XInput Z$ XIf Z$="Y" Or Z$="y" Or Z$="yes" Or Z$="YES" Then X H%=1 XEndif XPrint At(13,11);"Send to printer(Y/N)"; XInput Z$ XIf Z$="Y" Or Z$="y" Or Z$="yes" Or Z$="YES" Then X Z%=1 XEndif XCls XIf Z%=1 X Lprint "Comparision of ";File1$;" to ";File2$ XEndif XPrint At(13,1);"Comparision of ";File1$;" to ";File2$ XPrint At(1,1);F1 XQ=3 XFor X=1 To A X If F1$(X)<>F2$(X) X Adf1=Varptr(F1$(X)) X Adf2=Varptr(F2$(X)) X For Y=0 To Len(F1$(X)) X If Peek(Adf1+Y)<>Peek(Adf2+Y) X P1=(X-1)*100+Y X P2=Peek(Adf1+Y) X P3=Peek(Adf2+Y) X If H%=1 X P1$=Hex$(P1) X P2$=Hex$(P2) X P3$=Hex$(P3) X Else X P1$=Str$(P1) X P2$=Str$(P2) X P3$=Str$(P3) X Endif X If Z%=1 X Lprint P1$,P2$,P3$ X Endif X Print At(10,Q);P1$,P2$,P3$ X Q=Q+1 X Endif X Print At(1,1);F1-(X-1)*100-Y;" " X Next Y X Endif X Print At(1,1);F1-(X-1)*100;" " XNext X XQ=Q+1 XPrint At(1,1);" " XPrint At(1,Q) XPrint At(1,Q);"PRESS RETURN TO CONTINUE" XA=Inp(2) XIf A<>13 X End XEndif XClear XGoto 1 SHAR_EOF chmod 0600 DIFF_315.LST || echo "restore of DIFF_315.LST fails" exit 0