> ZipDiff 1.06 , Compare Zip archive with filing system , v1.00 23-Jan-2002 JGH: Initial version (J v1.01 26-Mar-2002 JGH: Doesn't preserve zptr, adds if meta different 29 v1.02 26-Mar-2002 JGH: Disabled since-date checking fname, /ZI matches /ZIP ZD v1.04 17-Nov-2002 JGH: Try and get comparison working properly d2 v1.05 25-Nov-2002 JGH: Doesn't compare ATTRs n< v1.06 20-Jan-2003 JGH: [Needs: Select what to compare] x: F ctrl%30,data%80,extra%128,zp%6:A$=OS_GetEnv:in%=0:add%=0:del%=0 7quit$=cl(" -q",1):debug%=cl("-de",0): ::end o cl("-?",0):"Syntax: *ZipDiff zipfile inpath addlist dellist -debug -r -t dd/mm/yyyy -quit command":end =rc%=cl("-r",0):pre$=cl("-p",1):date$=cl("-t",1):xtr%= Pdi%=cl("-D",0):zip$=cl("",0):in$=cl("",0):list$=cl("",0):del$=cl("",0) pre$<>"":pre$=pre$+"." atm%=&FFFFFF00: attr% mask Ȗdebug%:" run$='"run$"'"'"quit$='"quit$"'"'" zip$='"zip$"'"'" in$='"in$"'"'"list$='"list$"'"'"recurse=";rc%;" date$='"date$"'"'" pre$='"pre$"'" : ' :CloseAll:" at line ";:end $X%=ctrl%:Y%=X%256:sj%=:date%=0 I date$<>"":date%= date$,2)+32* date$,4,2)+512*( date$,7)-1980) B Only does dd/mm/yyyy; needs to allow mmddyyyy and yyyy/mm/dd * In fact, is -t option needed at all? )max%=--8000: mem% max%:wr%=2:rd%=4 : "DA%=file(zip$,5):(A%1)<>1:"Zipfile '"zip$"' not found":end: ,Din$<>"":A%=file(in$,5):A%<>2:"Dir. '"in$"' not found":end: 6(in%=(zip$):list$<>"":add%=(list$) @in$<>"":"Dir "+in$ Jsj%=fs=5:Scan("",0) TCloseAll:end: ^: hCloseAll:*Exec r in%:A%=in%:in%=0:#A% | add%:A%=add%:add%=0:#A%  del%:A%=del%:del%=0:#A%  : Scan(p$,zptr%): p%,r% debug("") debug("PROCScan "+pre$+p$) zt%=zfind(pre$+p$,#in%) 1 zptr%=PTR#in% - don't go back to dir start?  8?X%=0:X%!1=data%:X%!5=1:X%!9=p%:!data%=0:A%=8:&FFD1 "r%=X%!5:p%=X%!9: r%=0:RdName  r%=1  Now scan zipdir  : >RdName:data%?(1+?data%)=13:in$=s($(data%+1)):in$=46: &debug("") 0debug("PROCRdName "+in$) :#t%=0:t%=file(in$,5):t%=3:t%=1 Dzipdiff:t%<>2: N7rc%:"Dir "+in$:Scan(p$+in$+".",#in%):"Dir ^": X b: l&zipdiff:xtr%date%sj%:addInfo v3 if l&e date priority, check date, esp. for RO , IFdate%:IFFNzdate(X%!15)zt%:debug("TYPE:"+h0(t%,2)+":"+h0(zt%,2)+":"):del(pre$+p$+in$):add(pre$+p$+in$): :  If metadata different, add 2 zfile needs to note if metadata doen't exist  t%=2:di%: diff:add(pre$+p$+in$)   *: 4 If time&date same, ignore >6zdate(mdate%)=zmdate% ztime(mtime%)=zmtime%: H If date is earlier, ignore Rzdate(mdate%)zload%:debug("LOAD:"+h0(load%,8)+":"+h0(zload%,8)+":"):= Hexec%<>zexec%:debug("EXEC:"+h0(exec%,8)+":"+h0(zexec%,8)+":"):= Xfilesize%<>zfilesize%:debug("SIZE:"+h0(filesize%,8)+":"+h0(zfilesize%,8)+":"):= e IF(attr%ANDatm%)<>(zattr%ANDatm%):PROCdebug("ATTR:"+FNh0(attr%,8)+":"+FNh0(zattr%,8)+":"):=TRUE  Ignore moddate: j IFFNzdate(mdate%)<>zmdate%:PROCdebug("MDATE:"+FNh0(FNzdate(mdate%),4)+":"+FNh0(zmdate%,4)+":"):=TRUE  Ignore modtime: j IFFNztime(mtime%)<>zmtime%:PROCdebug("MTIME:"+FNh0(FNztime(mtime%),4)+":"+FNh0(zmtime%,4)+":"):=TRUE " Ignore creation times/dates: j IFFNzdate(cdate%)<>zcdate%:PROCdebug("CDATE:"+FNh0(FNzdate(cdate%),4)+":"+FNh0(zcdate%,4)+":"):=TRUE j IFFNztime(ctime%)<>zctime%:PROCdebug("CTIME:"+FNh0(FNztime(ctime%),4)+":"+FNh0(zctime%,4)+":"):=TRUE = : $ Metadata: . modtime/moddate crc compsize filesize extra1 extra2[load] extra3[exec] extra4[attr] extra5[0] extra6[ctime/cdate] extra7[account] 8C modtime moddate filesize load exec attr 0 ctime cdate account B9 load exec len attrs mdate mtime cdate ctime account L: V addInfo ` Needs to check HADFS, etc. j0 Should put l&e date into X%!15 for default trFSExam(64): data%?3=0:X%!15=data%!10:X%?19=data%?14:X%!20=data%!5:X%?24=data%?9: Find mod & cret time&dates ~7FSExam(65): data%?3=0:X%!25=data%!5: Acc numbers -FSExam(4): data%?3=0:accessbyte=data%?6  : +FSExam(A%): X%,Y%:X%=data%:Y%=X%256 B!X%=0:X%?1=9+ in$:X%!3=18:X%?7=A%:$(X%+8)=in$:A%=&14:&FFF1: : ݤconvertname(A$)  A$,".")+A$,"/")=0:=A$ J A%=1 A$:B%= A$,A%,1):(B%&FE)=46:A$=A$,A%-1)+(B%1)+A$,A%+1)  :=A$ : , Convert fs date/time to zip date/time: ?ݤztime(A%):=(A%&1F)*&800+(A%&3F00)8+(A%&3F0000)&20000  Eݤzdate(A%):=(A%31)+(A%&F00)8+((A%&F000)8+(A%&E0)*256)+&200 : 4 zfind() searches through zip from current ptr% (! returns 0=nf, 1=file, 2=dir 2 should: <> if in same dir, and zobject>lookobject, return notfound F9 if different dir, if zdir>lookdir, return notfound P: Z8ݤzfind(fn$,ptr%): zname$,leaf%,found%,notfd%,zptr% dDfn$=up(fn$):#in%=ptr%:zptr%=ptr%:fn$="":=2: Start of zipfile nfn$,path%): r: |# Must be a different directory ,A%=0:A%=A%+1:fn$,A%,1)<>zname$,A%,1) &A%=A%-1:zname$,A%,1)="." A%<1 B%=zname$+".",".",A%+1)-1 A%=fn$+".",".",A%+1)-1 :  debug("checking:"+fn$,A%)) #debug("checking:"+zname$,B%)) : 0path%:A%:B%:notfd%=zname$,B%)>fn$,A%): :  Keep scanning:  :  zfile 1zver%=get16:zflags%=get16:zcomptype%=get16 .zmtime%=get16:zmdate%=get16:zcrc%=get32 &'zcompsize%=get32:zfilesize%=get32 0&znamelen%=get16:zextralen%=get16 :*zname$="":x%=0 127 4:extra%!x%=0: D7znamelen%:x%=1 znamelen%:zname$=zname$+#in%: N6zextralen%:x%=0 zextralen%-1:extra%?x%=#in%: X#zhdrid%=ex16(0):zdsz%=ex16(2) bDzsig%=extra%!4:zload%=extra%!8:zexec%=extra%!12:zattr%=extra%!16 lGzctime%=ex16(24):zcdate%=ex16(26):zacc%=ex16(28):zaux%=ex16(30) v/ hdrid%=&4341 -> Created on Acorn computer 2 dsz% usually =&14, ie 20 bytes of extra data  sig%='ARC0' -> Archive zname$=convertname(zname$) 6#in%=#in%+zcompsize%:(zflags%8):#in%=#in%+12  :  ݤex16(A%)=extra%!A% &FFFF  ݤget32 9zp%?0=#in%:zp%?1=#in%:zp%?2=#in%:zp%?3=#in%:=!zp%  ݤget16 =#in%+(&100*#in%) : %putS(out%,A$):A$="" out%=0: ) A%: A%=1A$:#out%,A$,A%,1)::  : 3add(A$):debug("Adding"):putS(add%,A$+13):  3del(A$):debug("Deling"):putS(del%,A$+13): *: 4debug(A$):debug%=0: >A$ H R: \)ݤbyte(A%,X%,Y%)=((&FFF4)&FF00)256 f!ݤfs: A%,Y%,E%:=(&FFDA)&FF p: z"":A$=quit$:quit$="":os(A$+" "+ß,<>0)) : Bݤfile(A$,A%):$data%=A$:?X%=data%:X%?1=data%256:=(&FFDD)&FF 2ݤOS_GetEnv:A%=0:X%=1:os%=((&FFF4)&FF00)256 KA%=(>&FFFF)&900:A%=((>&9FFF)A%)((&1400-)(A%=0)):?(P-3)A%=&B00 iA$=$(-&E00+A%):A%=0:run$=A$:ș16A$,,A%:ș72,"",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ *Y%=-10:A$=" "+A$:A$=A$,2):A$<>32 6Y%:A$=34:A%=A$,"""",2)+1 Y%:A%=A$+" "," ") CY%:run$=A$,1-(A$=34),A%-1+2*(A$=34)):run$<>"":A$=A$,A%+1)  :=A$ &os(A$):A$=42:A$ A$<>"":A$  Iݤcl(l$,n%): l$="":I%=A$+" "," "):l$=A$,I%-1):A$=s(A$,I%+1)):=l$  l$=32 A$<>"":A$=" "+A$ dI%=A$,l$):l$="": I%>0n%>0:l$=A$,A$+" "," ",I%+1)+1): A$,I%,1)<>" ":l$=l$,l$+" "," ")-1) v I%: A$,I%,1)=" ":A$=A$,2+( A$<>32),I%-2-(I%=1)) I%:A$=A$,I%-1)+A$,A$+" "," ",A$+" "," ",I%)+ l$)+1) #A$=s(A$): n%:=s(l$) =I%<>0 $2ݤs(A$): A$,1)=" ": A$=A$,2): A$,1)<>" " ./ A$,1)=" ": A$=A$, A$-1): A$,1)<>" " 8=A$ Bݤup(A$):A$="":="" LIA%,B%:A%=1A$:B%=A$,A%,1):B%>95:A$=A$,A%-1)+(B%-32)+A$,A%+1) V :=A$ `#ݤh0(A%,N%)="0000000"+~A%,N%)  4{  "  Z{A{LQ%=PA.:CH."* BASIC Y{M{n{檤`G{G{`` Z{,z0ȱV{` ee  { {V{쩏 `