> ZipNewFile 0.26 5 Zip up files updated on or since specified date A 06-Sep-99 v0.21 JGH: Checks access permissions - DL skipped (7 03-Mar-00 v0.22 JGH: Outputs today's date as well 2* 12-Aug-03 v0.23 JGH: Outputs prepath <- 27-Feb-05 v0.24 JGH: Reads command line FN 05-Mar-07 v0.25 JGH: Includes '!*' files, skips index/htm if no public R P2 17-Feb-13 v0.26 JGH: Looks for -nozip option Z: d5ctrl%30,name%80:A$=OS_GetEnv:X%=ctrl%:Y%=X%256 nGquit$=cl(" -q",1):debug%=cl("-d",0):"Spool":"Exec"::exit() xA$="":GetParams Xcl("-?",0):"Syntax: "run$" startdir date prefixdir -nozip -quit quitcmd":exit(0) Dnozip%=cl("-n",0):dir$=cl("",1):date$=cl("",1):pre$=cl("",1) [date%=date$+32*date$,1+date$,"/"))+&200*(date$,1+date$,"/",1+date$,"/")))-1981) Pdebug%:"dir$='"dir$"'"'"date$='"date$"'"'"pre$='"pre$"'"'"quit$='"quit$"'" +dir$<>"":"Dir "+dir$: Preserve path? today$=Time :15:fs%=fs:*Spool _Make Uout$="_FILES/ZIP":pre$<>"":out$=pre$,pre$+".",".")-1):out$="_"+out$,5)+"/ZIP" *"*Basic"cr"*ACCESS "out$" WR/WR"cr; 0"CH.""%.^.Library.Archive"""cr"C"out$;cr; Z"Z| Accessible files modified on or later than "date$;cr;"| Created on ";today$;cr; 8Scan(1,"@."):Scan(2,"@."):cr;"*Quit";cr;:*Spool '"SetType _Make FFE":"Stamp _Make" .quit$="" nozip%=0:"*Exec _Make":*BASIC exit(0): : "*GetParams:"List Newer Files v0.26"' ,<"Enter directory to start from: "dir$:dir$="":dir$="$" 6 A$=dir$ @A"List files on or later than: "date$:date$<>"":A$=A$+" "+A$ J6"Directory prefix: "pre$:pre$<>"":A$=A$+" "+pre$ T ^: h"Scan(f%,path$): p%,r%,t%,f$ r1:f$=gbpb8(p%):r%=X%!5:p%=X%!9:r%=0:RdName | r%=1: : RdName:f$=46:  Skip certain filenames: f$=95 f$,1)="_": t%=file(f$,5):t%=3:t%=1 Efs%=5:$(name%+8)=f$:osw(&14,&12002000,&40000000):X%!15=name%!10 1 Skip certain objects by access permissions: cf$="index/htm":X%?14 16:X%?14=&11: If 'index/htm' has public 'R', make it appear to be R/R 5f$<>"$":t%=2 (X%?14 8):: Locked dir, skip ?t%=1:(X%?14 &13)<>&11:: No public R, owner still has W ( Skip certain objects by filetypes: /(X%!2 &FFFFFF00)=&FFFFC000:: Link file : f%:f%<>t%: t%=2:f$,1)="!":t%=3 t%=1:DoFile: & Process a directory: 0A"Dir "+f$:Scan(1,path$+"."+f$):Scan(2,path$+"."+f$):*DIR ^ : D: N DoFile XFthis%=(X%?15 31)+32*(X%?16 15)+32*(X%?16 &F0)+256*(X%?15 &E0) bthis%"":",";pre$;".";path$+"."+f$,4);  cr;  :  ---------- Eosw(A%,D%,E%):X%,Y%:X%=name%:Y%=X%256:!X%=D%:X%!4=E%:&FFF1: #ݤcr:"FX3,16"::"FX3":13:="" 0ݤspc(A%):=A%," ",html%)+" ",text%)) ݤup(A$):A$="":="" Dz%,B$: z%=1 A$:A$,1)>="`":B$=B$+(A$-32) B$=B$+A$,1) A$=A$,2)::=B$ ݤsize(A%):A%<1000:=d(A%,3)+spc(1) A%=(A%+1023)1024:A%<1000:=d(A%,3)+"K" A%=(A%+1023)1024:A%<1000:=d(A%,3)+"M" A%=(A%+1023)1024:A%<1000:=d(A%,3)+"G" aݤdate(A%):=d0(A%31,2)+"/"+d0((A%&F00)256,2)+"/"+d0(1981+(A%&F000)&1000+(A%&E0)2,4)  ---------- :  ProgEnv  FileIO  Number * Date 4 String >: H" > BLib.Date 1.03 13-Mar-2007 R% Time and date support functions \: (C)J.G.Harston, may be freely used and redistributed fK v1.00 12-Sep-1992 JGH: FromOrd(), DayOfWeek(), Day(), Mon() functions p6 v1.01 18-Feb-1994 JGH: ToOrd() and Since() added z- v1.02 17-Sep-2005 JGH: ToOrd() debugged C v1.03 13-Mar-2007 JGH: Added [To|From][Day|Month]() functions : : 6 FNDay(day%) - return 3-char day of week string 0 FNMon(month%) - return 3-char month string 6 ------------------------------------------------ : 4ݤDay(A%):="000SunMonTueWedThuFriSat",A%*3+1,3) LݤMon(A%):="000JanFebMarAprMayJunJulAugSepOctNovDecDDDEEEFFF",A%*3+1,3) : : B FNDate_FromDay(A$) - return day number for supplied string D FNDate_FromMonth(A$) - return month number for supplied string D -------------------------------------------------------------- : !ݤDate_FromDay(A$):A$=uc(A$) $'A%="SUNMONTUEWEDTHUFRISAT",A$,3)) .(A%-1)3=0:=A%3+1 =0 8: B#ݤDate_FromMonth(A$):A$=uc(A$) L6A%="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",A$,3)) V(A%-1)3=0:=A%3+1 =0 `: j: tD FNDate_ToDay(day%) - return full-length day of week string ~> FNDate_ToMonth(month%) - return full-length month string D -------------------------------------------------------------- : ݤDate_ToDay(A%) Z="SunMonTueWednesThursFriSatur","01040710162124",A%*2-1,2),"3336535",A%,1))+"day" : ݤDate_ToMonth(A%) đ="JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember","010816212629333743525967",A%*2-1,2),"785534469788",A%,1)) : : P FNDate_DayOfWeek(day%,month%,year%) - return day of week for supplied date @ 1=Sunday, 7=Saturday P -------------------------------------------------------------------------- :  (ݤDate_DayOfWeek(d%,m%,y%):y%=y%400 q=(y%*365.25+m%*30+d%+"120112234455",m%,1)+((y%4)=0)-((y%-1)100)-(m%>2((y%4)=0(y%100)<>0y%=0))+3)7+1 : (: 2K PROCDate_FromOrd - convert time and date to 5-byte centi-second count <* On entry: mem%->five bytes of memory F, day, month, year of the date PA hours, minutes, seconds, centiseconds of the time ZI On exit: mem% to mem%+4 containes five-byte centisecond time since d' 00:00:00 on 1-Jan-1900. nK --------------------------------------------------------------------- x: ;Date_FromOrd(mem%,d%,m%,y%,hr%,mn%,sc%,cs%):y%=y%400 qd%=y%*365.25+m%*30+d%+"120112234455",m%,1)+((y%4)=0)-((y%-1)100)-(m%>2((y%4)=0(y%100)<>0y%=0))+36493 d%>146066:d%=d%-146097 =d%=d%*&41EB:mem%!1=d%+d%:d%=((hr%*60+mn%)*60+sc%)*100+cs% #?mem%=d%:mem%!1=mem%!1+d%256: : : I PROCDate_ToOrd - convert 5-byte centi-second count to time and date K On entry: mem%->five bytes of memory containing five-byte centisecond 2 time since 00:00:00 on 1-Jan-1900. , On exit: day, month, year of the date A hours, minutes, seconds, centiseconds of the time K --------------------------------------------------------------------- : $Date_ToOrd(mem%): A%,B%,C%,D% @year%=0:month%=0:day%=0:hour%=0:minute%=0:second%=0:centi%=0 "-mem%!1<0:: Problems with negatives ATM ,FD%=mem%!1&83D6+2447065:C%=mem%?0+256*(mem%!1&83D6):centi%=C%100 6>C%=C%100:second%=C%60:C%=C%60:minute%=C%60:hour%=C%60 @8B%=((D%*4+3)146097-4)+3:C%=B%14614*5+2:D%=D%*4+3 J.A%=C%153+2:day%=C%1535+1:month%=A%12+1 T*year%=D%146097*100+B%1461+A%12-4800 ^ h: r: |> FNDate_Since - return number of days since a past date I On entry: td%, tm% and ty% should be set to today's date, month and I year and pd%, pm% and py% should be set to the past date,  month and year. ( Requires X%->5-byte control block I ------------------------------------------------------------------- : 1ݤDate_Since(td%,tm%,ty%,pd%,pm%,py%): past% 4Date_FromOrd(X%,pd%,pm%,py%,0,0,0,0):past%=X%!1 =Date_FromOrd(X%,td%,tm%,ty%,0,0,0,0):=(X%!1-past%)&83D6 : " > BLib.FileIO 1.04 22Mar2008 0 v1.04 22Mar2008 JGH: FNgbpb8 strips spaces < v1.01 07Sep2006 JGH: FNargs avoid zero page on RISC OS * v1.00 09Aug1988 JGH: Initial version : % General File Interface Routines &% =============================== 0: :, Returns file type, file info in X%!... D, -------------------------------------- NBݤfile(A$,A%):$name%=A$:?X%=name%:X%?1=name%256:=(&FFDD)&FF X: b General OSGBPB call l ------------------- vTgbpb(A%,chn%,addr%,num%,ptr%):?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:&FFD1: : @ Return current disk (5), directory (6) or library (7) name @ ---------------------------------------------------------- Yݤgbpb(A%):X%!1=name%:&FFD1:A%=name%+((1+?name%)((A%-2)=6)):A%?(1+?A%)=13:=$(A%+1) : B Returns entry in current directory, or null string if at end B ------------------------------------------------------------ Eݤgbpb8(ptr%):X%!1=name%:X%!5=1:X%!9=ptr%:A%=8:&FFD1:X%!5=1:="" 7A%=name%+1:A%!(A%?-1)=&D20:A%?($A%," ")-1)=13:=$A% : 6 OSARGS call with data. Returns any returned data 6 ------------------------------------------------ 3ݤargs(A%,Y%,ptr%):X%,E%:?(P-3)=0:E%=Y%:Y%=0 .<&8000:!&70:X%=&70:!X%=ptr%:&FFDA:=!X%  'ș"OS_Args",A%,Y%,ptr%,,ptr%:=ptr% :  ' OSARGS call ignoring X, returns A *' --------------------------------- 4<ݤargsA(A%):<&8000:X%,Y%,E%,!&70:X%=&70:=(&FFDA)&FF >ș"OS_Args",A%A%:=A% H: R& Get current filing system number \& -------------------------------- f ݤfs:A%,Y%,E%:=(&FFDA)&FF p: z" > BLib.Number 1.01 09Aug1988 ( v1.00 09Aug1988 JGH: First version 1 v1.01 xxxxxxxxx JGH: Added Octal and Binary 4 Bug: Octal and Binary don't work for &8xxxxxxx :  Number Output Routines  ~~~~~~~~~~~~~~~~~~~~~~  # Hexadecimal padded with zeros #ݤh0(A%,N%)="0000000"+~A%,N%) : $ Hexadecimal padded with spaces "ݤh(A%,N%)=" "+~A%,N%) :  Decimal padded with zeros #ݤd0(A%,N%)="00000000"+A%,N%) : $ Decimal padded with spaces .#ݤd(A%,N%)=" "+A%,N%) 8: B Octal padded with zeros L?ݤo0(A%,N%): A$,B$:A%<0:B$="7":A%=A% &7FFFFFFF B$="0" V7 A$=(A% 7)+A$:A%=A% 8: A%=0:=N%,B$)+A$,N%) `: j Octal padded with spaces t>ݤo(A%,N%): A$,B$:A%<0:B$="7":A%=A% &7FFFFFFF B$=" " ~7 A$=(A% 7)+A$:A%=A% 8: A%=0:=N%,B$)+A$,N%) :  Binary padded with zeros ?ݤb0(A%,N%): A$,B$:A%<0:B$="1":A%=A% &7FFFFFFF B$="0" 6 A$=(A% 1)+A$:A%=A% 2:A%=0:=N%,B$)+A$,N%) :  Binary padded with spaces >ݤb(A%,N%): A$,B$:A%<0:B$="1":A%=A% &7FFFFFFF B$=" " 6 A$=(A% 1)+A$:A%=A% 2:A%=0:=N%,B$)+A$,N%) : ) Drive character for supplied number ݤdrv(A%)=(48+A%-7*(A%>9)) : ) Drive number for supplied character "ݤDrv(A$)=A$-48+7*(A$>"9")31 : # > BLib.ProgEnv 1.04 09Jan2007 (: 2# Program Environment Functions <# ============================= F: P? Return command line tail, sets run$ to execution filename Z; Works with BASIC on I/O,T6502,Arc,TZ80BBC,PC,Win,TARM d; Needs: 270 free bytes above end of heap for temp. w/s n? --------------------------------------------------------- x:ݤOS_GetEnv:A$,A%:X%=1:os%=((&FFF4)&FF00)256:X%-1 Jos%=32:>&FFFF:ș"GetModuleFileName",0,X%,255:A$=$$X%:run$=A$:=@cmd$ os%=32:A$=$&100 {A$=0:>&7FFF:run$=$&8100:ș"OS_GetEnv"A$,,A%:ș"OS_WriteEnv","",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ 2A$=0:?(P-3):A$=$&600 A$=0:A$=$(-&300) 7A%=A$+" "," "):run$=A$,A%-1):run$<>"":=A$,A%+1) bY%=X%256:A%=9:?X%=0:X%!1=X%+16:X%!16=0:&FFD1:A%=X%+16:!A%?A%+A%?2<>8:A%?(A%+1)=13:=$(A%+1) ="" : . Run a program, passing it a command line = If program is *Command, called with OSCLI, else CHAINed = ------------------------------------------------------- &os(A$):A$=42:A$ A$<>"":A$  : ( Exit program, setting return value ( ---------------------------------- "@exit(A%):"FX1,"+A%:quit$=quit$:A$=quit$:quit$="":os(A$) ,os%=32:Ș A% 6os%<6: *Quit @ J: T# > BLib.CmdLine 1.10 27Jul2009 ^# v1.10 Parses "quoted" options h: r Command Line Parsing | ~~~~~~~~~~~~~~~~~~~~ : F FNcl() - parse command line for switches, options and parameters F ---------------------------------------------------------------- ( FNcl("",0) - return next parameter < FNcl(switch$,0) - return TRUE/FALSE if switch$ present = FNcl(option$,1) - return option string if present or "" : cݤcl(l$,n%):l$="":A$=s(A$):A$=34:A%=A$+" "" ",""" ",2):l$=A$,2,A%-2):A$=s(A$,A%+1)):=l$ "":A%=A$,l$):A%:A$=s(A$,A%-1)+A$,A$," ",A%)+1))+" ":= n%=0:l$<>"":= %A%=" ",l$=32)+A$,l$):A%=0:="" 'A$=A$,A%-1)+s(A$,A$," ",A%)+1)) Cl$=32:l$=A$,A%):A$=A$,A%-1):=l$,1-(l$=34),l$+2*(l$=34)) PA$,A%,1)<>34:l$=A$,A%,A$+" "," ",A%)-A%):A$=A$,A%-1)+A$,A%+l$+1):=l$ Jl$=A$,A%+1,A$+""" ",""" ",A%+1)-A%-1):A$=A$,A%-1)+A$,A%+l$+3):=l$ &/ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " 0+A$,1)=" ":A$=A$,A$-1):A$,1)<>" " :=A$ D: N" > BLib.String 1.00 09Aug1998 X: b# String Manipulation Functions l# ============================= v: 7 FNs() - strip spaces from start and end of string 7 ------------------------------------------------- /ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " +A$,1)=" ":A$=A$,A$-1):A$,1)<>" " =A$ : + FNuc() - convert string to upper case + ------------------------------------- ݤuc(A$): B$:A$="":="" 5B$=B$+(A$((A$<"@")&DF)):A$=A$,2):A$="":=B$ : + FNlc() - convert string to lower case + ------------------------------------- ݤlc(A$): B$:A$="":="" 5B$=B$+(A$((A$<"_")&20)):A$=A$,2):A$="":=B$ : " > BLib.Time 1.03 12-Aug-2006 *! RTC Time and date functions 4: (C)J.G.Harston, may be freely used and redistributed >: ---------------------------------------------------- H/ All functions assume global control block R0 pointed to by X%,Y% and set up as follows: \( DIM ctrl% 31:X%=ctrl%:Y%=X%DIV256 f: p: z' Real-Time-Clock reading functions ' ================================= : H ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I FNtime - return RTC time&date or null string if none present L returned date is correct for years after 1996 and 1999 : (ݤtime:?X%=0:A%=14:&FFF1:?X%=0:="" X%?24=13:A%=$(X%+4):$(X%+4)="0"+(A%31),2):$(X%+11)=($(X%+11)+(A%&E0)2-100*($(X%+11)<1981)):X%?6=32:X%?15=46:=$X% : H ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C FNTime - Return time&date or null string if none found A On-board RTC and fileserver RTC are checked 0 and day of week calculated : 6ݤTime:!X%=1:A%=14:&FFF1:A%=07:X%?A%=~X%?A%: time:year%=0:month%=0:day%=0:hour%=0:minute%=0:second%=0 A%=14:!X%=1:&FFF1:!X%=1: A%=07:X%?A%=~X%?A%: 2((y%4)=0(y%100)<>0y%=0))+3)7+1 : #ݤd0(A%,N%)="00000000"+A%,N%)