home *** CD-ROM | disk | FTP | other *** search
- /* */
-
- signal on halt
- signal on break_c
-
- call start
- call setDefaultConfig("GLOBAL",1)
- call readArguments
- call getStrings
- call openGui
- call readConfig(global.config,"GLOBAL")
- add=(global.file="")
- if global.url="" then call getUrl
- else call parseUrl
- if add then
- if global.file~="" & pathpart(global.file)="" then global.file=AddPart(global.saveDir,global.file)
- call setMainGadgets
- call copyConf("GLOBAL","GLOBAL.INUSE")
- call setConfGadgets
- call UnLockWindows("S")
- call handle
- exit
- /***************************************************************************/
- error: procedure expose global. sigl
- parse arg code
- if RXWIZERR~="RXWIZERR" then string = GetRxWizString(1001)":" RXWIZERR || d2c(10)
- else string=""
- string= string || GetRxWizString(code) || d2c(10) || GetRxWizString(1002)":" SIGL-1
- call EasyRequest(string,global.prg)
- exit
- /**************************************************************************/
- start: procedure expose global.
- l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
- if AddLibrary("rexxsupport.library","rxsocket.library","rxasl.library","rxwiz.library")~=0 then exit
- global.program="GetIt"
- res=0
- do i=1 while 1
- global.rexxPort=global.program"."i
- if OpenPort(global.rexxPort) then do
- res=1
- leave
- end
- end
- if ~res then exit
- global.filevalid=0
- global.ver="1.0"
- global.Author = "<alfier@iol.it>"
- global.prg=ProgramName("NOEXT")
- global.cat=global.prg".catalog"
- global.AppName=global.rexxPort
- global.AppIconName=global.rexxPort
- global.path=PathPart(ProgramName("FULL"))
- global.surface=AddPart(global.path,global.prg".wizard")
- global.catalog=global.prg".catalog"
- global.config=AddPart(global.path,global.prg".conf")
- global.ss=0
- global.aw=0
- global.ps=PortSignal(global.rexxPort)
- global.working=0
- global.fun=0
- global.host=""
- global.port=80
- global.remotefile=""
- global.file=""
- global.url=""
- global.invalidurl=0
- global.referer=""
- global.range=0
- global.login=""
- global.pass=""
- global.total=1
- global.current=0
- global.ns=0
- return
- /***************************************************************************/
- setDefaultConfig: procedure expose global.
- parse arg stem,first
-
- if first~=1 then do
- call copyConf("GLOBAL",stem)
- return
- end
- interpret stem".SAVEDIR=''"
- interpret stem".PROXY=''"
- interpret stem".PROXYPORT=8080"
- interpret stem".REFERER=''"
- interpret stem".RESUME=1"
- interpret stem".USEPROXY=0"
- interpret stem".WATCHCLIP=1"
- interpret stem".NOCACHE=0"
- interpret stem".IMS=0"
- interpret stem".TIMEOUT=0"
- return
- /***************************************************************************/
- readArguments: procedure expose global.
- parm.0.value=""
- parm.1.value=""
- parm.2.value=""
- if ~ReadArgs("FILE,URL,PUBSCREEN/K,NOGUI/S,START/S,CONF/K") then do
- call PrintFault(IoErr(),global.prg)
- exit
- end
- global.file=parm.0.value
- global.url=parm.1.value
- global.screen=parm.2.value
- global.nogui=parm.3.flag
- global.start=parm.4.flag
- if parm.5.flag then global.config=parm.5.value
- return
- /***************************************************************************/
- openAboutWin: procedure expose global.
- abw.noautoopen=1
- abw.id=4
- abw.gads=20
- res=OpenWindow("S","ABW")
- if res~=0 then call error(res)
- set.disabled=~exists("libs:openurl.library")
- call SetWizAttrs("S","ABW","ABPAGE","SET")
- return
- /***************************************************************************/
- closeMainWin: procedure expose global.
- call CloseWindow("S","MW","ONLYWIN")
- return
- /***************************************************************************/
- openAuthWin: procedure expose global.
- call LockWindows("S")
- aw.ID=3
- aw.Gads=20
- aw.noautoopen=1
- aw.noautoclose=1
- aw.iconified=0
- aw.SCREENTOFRONT=1
- res=OpenWindow("S","AW")
- if res~=0 then call error(res)
- set.text=global.remoteFile
- call SetWizAttrs("S","AW","AFILE","SET")
- set.text=global.realm
- call SetWizAttrs("S","AW","AREALM","SET")
- call ActivateGadget("S","AW","ALOGIN")
- return
- /***************************************************************************/
- setMainGadgets: procedure expose global.
- set.string=global.url
- set.ntype=3
- call SetWizAttrs("S","MW","URL","SET")
- set.string=global.file
- call SetWizAttrs("S","MW","FILE","SET")
- drop set.
- if global.working then set.page=1
- else set.page=0
- call SetWizAttrs("S","MW","URLPAGER","SET")
- call SetWizAttrs("S","MW","STOPPAGER","SET")
- drop set.
- set.current=global.current
- set.total=global.total
- call SetWizAttrs("S","MW","CANCEL","SET")
- call SetWizAttrs("S","MW","STATUS","SET")
- drop set.
- set.text=global.url
- call SetWizAttrs("S","MW","URLA","SET")
- set.text=global.file
- call SetWizAttrs("S","MW","FILEA","SET")
- return
- /***************************************************************************/
- setConfGadgets: procedure expose global.
- set.string=global.inuse.proxy
- call SetWizAttrs("S","CW","PROXY","SET")
- set.string=global.inuse.referer
- call SetWizAttrs("S","CW","REFERER","SET")
- set.string=global.inuse.saveDir
- call SetWizAttrs("S","CW","SAVEDIR","SET")
- drop set.
- set.integer=global.inuse.proxyport
- call SetWizAttrs("S","CW","PROXYPORT","SET")
- set.integer=global.inuse.timeout
- call SetWizAttrs("S","CW","TIMEOUT","SET")
- drop set.
- set.checked=global.inuse.useproxy
- call SetWizAttrs("S","CW","USEPROXY","SET")
- set.checked=global.inuse.nocache
- call SetWizAttrs("S","CW","NOCACHE","SET")
- set.checked=global.inuse.ims
- call SetWizAttrs("S","CW","IMS","SET")
- set.checked=global.inuse.resume
- call SetWizAttrs("S","CW","RESUME","SET")
- set.checked=global.inuse.watchclip
- call SetWizAttrs("S","CW","WATCHCLIP","SET")
- return
- /***************************************************************************/
- handle: procedure expose global.
- stop=0
- ctrl_c=2**12
- if global.start then call safeStart
- global.signals=or(global.ss,global.ps,ctrl_c,global.ns)
- do while ~stop
- mask=Wait(global.signals)
- if and(mask,ctrl_c)~=0 then call break_c
- if and(mask,global.ss)~=0 then if handleObj("") then leave
- if and(mask,global.ps)~=0 then call handlePort
- if and(mask,global.ns)~=0 then call handleClip
- end
- call safeQuit(1)
- return
- /**************************************************************************/
- handleObj: procedure expose global.
- parse arg o
- handle.wait=0
- if o~="" then res=HandleSurface("S","HANDLE",o)
- else res=HandleSurface("S","HANDLE")
- if res~=0 then call error(res)
- do i=0 to handle.imsg-1
- w=handle.i.window
- select
- when handle.i.class="CLOSEWINDOW" then do
- if w=="AW" then do
- call CloseWindow("S","W")
- call UnlockWindows("S","MW")
- end
- call CloseWindow("S",w,"ONLYWIN")
- end
- when handle.i.class="VANILLAKEY" then call GadgetKey("S",handle.i.window,handle.i.code,handle.i.qualifier)
- when handle.i.class="MENUPICK" then
- select
- when handle.i.ObjectID="MGETANOTHER" then do
- od=pragma("D",global.path)
- cmd = "run <NIL: >NIL: rx GetIt.rexx"
- shell command cmd
- call pragma("D",od)
- end
- when handle.i.ObjectID="CMSAVE" then do
- call copyConf("GLOBAL.INUSE","GLOBAL")
- call saveConfig
- call setMainGadgets
- call CloseWindow("S",w,"ONLYWIN")
- end
- when handle.i.ObjectID="CMSAVEAS" then do
- d=reqF(global.config,1)
- if d~="" then do
- global.config=d
- call copyConf("GLOBAL.INUSE","GLOBAL")
- call saveConfig
- call setMainGadgets
- call CloseWindow("S",w,"ONLYWIN")
- end
- end
- when handle.i.ObjectID="CMOPEN" then do
- d=reqF(global.config)
- if d~="" then
- if readConfig(d,"GLOBAL.INUSE")=0 then call setConfGadgets
- end
- when handle.i.ObjectID="CMUSE" then do
- call copyConf("GLOBAL.INUSE","GLOBAL")
- call setMainGadgets
- call CloseWindow("S",w,"ONLYWIN")
- call status global.str.CONFMODIFIED
- end
- when handle.i.ObjectID="CMLAST" then
- if readConfig(global.config,"GLOBAL.INUSE")=0 then call setConfGadgets
- when handle.i.ObjectID="CMRESTORE" then do
- call copyConf("GLOBAL","GLOBAL.INUSE")
- call setConfGadgets
- call setMainGadgets
- end
- otherwise if handle.i.ObjectID~="" & handle.i.config~="" then interpret handle.i.config
- end
- when handle.i.class="IDCMPUPDATE" then do
- select
- when handle.i.ObjectID="POPFILE" then do
- d=reqF(global.file)
- if d~="" then do
- global.file=d
- set.string=global.file
- call SetWizAttrs("S","MW","FILE","SET")
- end
- end
- when handle.i.ObjectID="URL" then do
- global.url=handle.i.string;
- call parseUrl
- end
- when handle.i.ObjectID="FILLFILE" then
- if global.file~="" then do
- call getUrl
- set.string=global.url
- call SetWizAttrs("S","MW","URL","SET")
- set.text=global.url
- call SetWizAttrs("S","MW","URLA","SET")
- end
- when handle.i.ObjectID="POPSAVEDIR" then do
- d=reqF(global.inuse.saveDir,0,1)
- if d~="" then do
- global.inuse.saveDir=d
- set.string=d
- call SetWizAttrs("S","CW","SAVEDIR","SET")
- end
- end
- when handle.i.ObjectID="CSAVE" then do
- call copyConf("GLOBAL.INUSE","GLOBAL")
- call saveConfig
- call CloseWindow("S",w,"ONLYWIN")
- end
- when handle.i.ObjectID="CUSE" then do
- call copyConf("GLOBAL.INUSE","GLOBAL")
- call CloseWindow("S",w,"ONLYWIN")
- call status global.str.CONFMODIFIED
- end
- otherwise if handle.i.ObjectID~="" & handle.i.config~="" then interpret handle.i.config
- end
- end
- otherwise nop
- end
- end
- return 0
- /**************************************************************************/
- reqF: procedure expose global.
- parse arg f,sm,dm
- call LockWindows("S")
- f.DoSaveMode=sm==1
- f.DrawersOnly=dm==1
- f.window="S/MW"
- f.Drawer=PathPart(f)
- f.File=FilePart(f)
- res=ReqFile("F")
- call UnLockWindows("S")
- if res=0 then
- if dm=1 then return f.drawer
- else
- if f.file~="" then return addpart(f.drawer,f.file)
- return ""
- /**************************************************************************/
- status: procedure expose global.
- parse arg msg
- set.format=msg
- call SetWizAttrs("S","MW","STATUS","SET")
- return
- /**************************************************************************/
- checkFile: procedure expose global.
- if global.file="" then do
- call status global.str.NOFILE
- return 0
- end
- s=statef(global.file)
- if s="" then
- if ioerr()=205 then do
- global.range=0
- return 1
- end
- else do
- call status global.str.CANTFIND "'"global.file"'"
- return 0
- end
- parse var s type size d d d d d comment
- if type~="FILE" then do
- call status "'"global.file"'" global.str.NOTVALIDFILE
- return 0
- end
- global.range=size
- return 1
- /**************************************************************************/
- getUrl: procedure expose global.
- if global.file~="" then do
- s=statef(global.file)
- if s~="" then do
- parse var s type size d d d d d comment
- if type="FILE" & upper(left(comment,8))=" HTTP://" then do
- global.url=word(comment,1)
- global.referer=word(comment,2)
- global.inuse.referer=global.referer
- set.strin=global.referer
- call SetWizAttrs("S","CW","REFERER","SET")
- call parseUrl
- call status global.str.URLFROMFILE
- return 1
- end
- end
- call status global.str.NTURLFROMFILE
- end
- return 0
- /**************************************************************************/
- parseUrlFun: procedure expose global.
- parse arg stem,u
-
- if u="" then return 0
-
- p=80
- f=""
- l=""
- pw=""
-
- pr=match("#?://#?",u)
- if pr then do
- parse var u proto "://" u
- if upper(left(proto,7))~="HTTP" then return 0
- end
-
- call SetStem(stem,"URL",u)
-
- if match("#?:#?@#?",u) then do
- parse var u l":"pw"@"u
- if l="" | pw="" | u="" then return 0
- end
-
- if match("#?/#?",u) then do
- parse var u u "/" f
- end
- if f="" then f = "/"
-
- if match("#?:#?",u) then do
- parse var u u ":" p
- if ~DataType(p,"N") then return 0
- if p<1 | p>65535 then return 0
- pr=1
- end
-
- if pr then if u="" then return 0
-
- interpret stem".HOST='"u"'"
- interpret stem".PORT='"p"'"
- interpret stem".REMOTEFILE='"f"'"
- interpret stem".LOGIN='"l"'"
- interpret stem".PASS='"pw"'"
- return 1
- /**************************************************************************/
- parseUrl: procedure expose global.
- if parseUrlFun("GLOBAL",global.url) then do
- if global.remotefile~="/" then new=FilePart(global.remotefile)
- else new=global.AppName
- if new~=global.AppIconName then do
- set.AppIconName=new
- call SetSurfaceAttrs("S","SET")
- global.AppIcoNname=new
- end
- if global.file="" then call parseFile
- global.invalidurl=0
- end
- else do
- call status global.str.INVALIDURL
- global.invalidurl=1
- end
- return
- /**************************************************************************/
- parseFile: procedure expose global.
- rf=filepart(global.remotefile)
- if rf~="" then do
- global.file=rf
- set.string=rf
- call SetWizAttrs("S","MW","FILE","SET")
- end
- return
- /**************************************************************************/
- resetGadgets: procedure expose global.
- set.page=0
- call SetWizAttrs("S","MW","URLPAGER","SET")
- call SetWizAttrs("S","MW","STOPPAGER","SET")
- return
- /**************************************************************************/
- startIt: procedure expose global.
- global.working=1
-
- if global.url="" then do
- call status global.str.NOURL
- return 0
- end
-
- if ~checkFile() then return 0
-
- if upper(left(global.url,7))~="HTTP://" then u="http://"global.url
- else u=global.url
-
- lfile=global.file
- if global.SaveDir~="" & PathPart(global.file)="" then lfile=AddPart(global.SaveDir,lfile)
-
- command="GetItFun.rexx" global.rexxPort u global.host global.remotefile lfile "HOSTPORT" global.port
- if global.useproxy & global.proxy~="" then command=command "PROXY" global.proxy PROXYPORT global.proxyport
- if global.resume & global.range>0 then command=command "RANGE" global.range
- if global.login~="" & global.pass ~="" then command=command "LOGIN" global.login "PASS" global.pass
- if global.nocache then command=command "NOCACHE"
- if global.ims then command=command "IMS" '"'GMTInetFileDate()'"'
- if global.timeout>0 then command=command "TIMEOUT" global.timeout
- if global.referer~="" then command=command "REFERER" global.referer
-
- set.page=1
- call SetWizAttrs("S","MW","URLPAGER","SET")
- call SetWizAttrs("S","MW","STOPPAGER","SET")
- drop set.
- set.text=global.url
- call SetWizAttrs("S","MW","URLA","SET")
- set.text=global.file
- call SetWizAttrs("S","MW","FILEA","SET")
-
- od=pragma("D",global.path)
- call RxsCall(command,-1)
- call pragma("D",od)
- return 1
- /**************************************************************************/
- handlePort: procedure expose global.
- res=1
- r=0
- pkt=GetPkt(global.rexxPort)
- if pkt~=null() then do
- comm=GetArg(pkt)
- parse var comm comm arg
- if comm="ASKOVER" then r = WizEasyRequest("S","MW",2)
- call Reply(pkt,r)
- if r=1 then return res
- select
- when upper(comm)="INFO" then call status arg
- when upper(comm)="MACRO" then global.fun=arg
- when upper(comm)="TOTAL" then do
- global.total=arg
- set.Total=arg
- call SetWizAttrs("S","MW","STATUS","SET")
- end
- when upper(comm)="CURRENT" then do
- global.current=arg
- set.current=arg
- call SetWizAttrs("S","MW","STATUS","SET")
- end
- when upper(comm)="ERR" | upper(comm)="END" then do
- if upper(comm)="ERR" then call status arg
- global.working=0
- call resetGadgets
- global.fun=0
- res=0
- end
- when upper(comm)="AUTH" then do
- parse var arg "Basic realm=" '"'global.realm'"'
- global.working=0
- call resetGadgets
- global.fun=0
- res=0
- call openAuthWin
- end
- when upper(comm)="MOVED" then do
- parse var arg nurl nhost .
- if nhost="" then do
- if left(nurl,1)="/" then
- global.url="http://"global.host":"global.port || nurl
- else global.url=nurl
- end
- else global.url=AddPart(nhost,nurl)
- call parseurl
- call status "Moved:" arg
- call delay 10
- global.working=0
- call resetGadgets
- global.fun=0
- res=0
- call safeStart
- end
- otherwise nop
- end
- end
- return res
- /**************************************************************************/
- copyConf: procedure expose global.
- parse arg from,to
- interpret to".SAVEDIR="from".SAVEDIR"
- interpret to".PROXY="from".PROXY"
- interpret to".PROXYPORT="from".PROXYPORT"
- interpret to".REFERER="from".REFERER"
- interpret to".RESUME="from".RESUME"
- interpret to".USEPROXY="from".USEPROXY"
- interpret to".WATCHCLIP="from".WATCHCLIP"
- interpret to".NOCACHE="from".NOCACHE"
- interpret to".IMS="from".IMS"
- interpret to".TIMEOUT="from".TIMEOUT"
- return
- /**************************************************************************/
- readConfig: procedure expose global.
- parse arg file,stem
- lines=ParseConfig(file,"CONF")
- if lines==-1 then do
- call status global.str.CONFIGFILE "'"file"'" global.str.NTFOUND
- return 1
- end
-
- call setDefaultConfig("GLOBAL.LOCAL")
-
- err=0
- do i=0 to lines-1 while err=0
- opt=conf.i
- arg=conf.i.value
- argu=upper(arg)
- select
- when opt=="SAVEDIR" then
- if arg="" then err=5
- else global.local.savedir=arg
- when opt=="PROXY" then
- if arg="" then err=5
- else global.local.proxy=arg
- when opt=="PROXYPORT" then
- if arg="" then err=5
- else if ~DataType(arg,"N") then err=2
- else if arg<1 | arg>65535 then err=2
- else global.local.proxyport=arg
- when opt=="TIMEOUT" then
- if arg="" then err=5
- else if ~DataType(arg,"N") then err=2
- else if arg<0 then err=2
- else global.local.timeout=arg
- when opt=="RESUME" then global.local.resume=1
- when opt=="USEPROXY" then global.local.useproxy=1
- when opt=="WATCHCLIP" then global.local.watchclip=1
- when opt=="NOCACHE" then global.local.nocache=1
- when opt=="IFMODIFIED" then global.local.ims=1
- otherwise err=3
- end
- end
- i=i-1
-
- select
- when err==0 then do
- call copyConf("GLOBAL.LOCAL",stem)
- call status global.str.CONFREAD
- end
- when err==1 then call status global.str.BADOPT "'"arg"'" global.str.INLINE conf.i.line
- when err==2 then call status global.str.BADNUM "'"arg"'" global.str.INLINE conf.i.line
- when err==3 then call status global.str.UNKNOWNOPT "'"opt"'" global.str.INLINE conf.i.line
- when err==4 then call status global.str.BADARG "'"arg"'" global.str.INLINE conf.i.line
- when err==5 then call status global.str.OPT "'"opt"'" global.str.NEEDARG global.str.INLINE conf.i.line
- otherwise nop
- end
- drop global.local.
- return err
- /***************************************************************************/
- saveConfig: procedure expose global.
- call status global.str.SAVINGCONF
- if ~Open("OUT",global.config,"W") then do
- call status global.str.CANTWRITE "'"global.config"'"
- return
- end
- string="## " global.program global.ver "configuration file" || "A"x || "##" || "A"x
- if global.saveDir~="" then string=string||"SAVEDIR" global.savedir || "A"x
- if global.proxy~="" then do
- string=string||"PROXY" global.proxy || "A"x
- string=string||"PROXYPORT" global.proxyport || "A"x
- end
- if global.timeout~=0 then string=string||"TIMEOUT" global.timeout || "A"x
- if global.resume then string=string||"RESUME"|| "A"x
-
- if global.useproxy then string=string||"USEPROXY"|| "A"x
- if global.watchclip then string=string||"WATCHCLIP"|| "A"x
- if global.nocache then string=string||"NOCACHE"|| "A"x
- if global.ims then string=string||"IFMODIFIED"|| "A"x
- if Writech("OUT",string)~=length(string) then sta=global.str.CANTWRITE "'"global.config"'"
- else sta=global.str.CONFSAVED
- call close("OUT")
- call status sta
- return
- /**************************************************************************/
- safeQuit: procedure expose global.
- parse arg e
- if global.working & global.fun~=0 then do
- call LockWindows("S")
- call Signal(global.fun,2**12)
- go=1
- do while go
- go=handlePort()
- if (go) then do
- call Wait(global.ps)
- end
- end
- call UnlockWindows("S")
- end
- if e then exit
- return
- /**************************************************************************/
- safeStart: procedure expose global.
-
- if ~IsLibOn("SOCKET") then do
- call status global.str.NOTCP
- return 0
- end
-
- if global.invalidurl then do
- call status global.str.INVALIDURL
- return 0
- end
-
- call LockWindows("S")
- global.current=0
- set.current=0
- global.total=1
- set.total=1
- call SetWizAttrs("S","MW","CANCEL","SET")
- call SetWizAttrs("S","MW","STATUS","SET")
-
- if ~startIt() then do
- call UnlockWindows("S")
- call resetgadgets
- global.working=0
- return
- end
- call Wait(global.ps)
- call handlePort()
- call UnlockWindows("S")
- return
- /**************************************************************************/
- GMTInetFileDate: procedure expose global.
- parse arg file
- call GetDate("NOW","GMT")
- date="NOW"
- if GetFileDate(global.file,"FD") then do
- call date2gmt("FD")
- if CompareDates("NOW","FD")<0 then date="FD"
- end
- d.0="Sun";d.1="Mon";d.2="Tue";d.3="Wed";d.4="Thu";d.5="Fri";d.6="Sat"
- m.1="Jan";m.2="Feb";m.3="Mar";m.4="Apr";m.5="May";m.6="Jun";m.7="Jul";m.8="Aug";m.9="Sep";m.10="Oct";m.11="Nov";m.12="Dec"
- date=formatdate(date,"%m %w %d %Y %H:%M:%S GMT")
- parse var date i j rest
- i=i%1
- return d.j"," m.i || rest
- /**************************************************************************/
- openGui: procedure expose global.
- s.pubscreen=global.screen
- s.fallback=1
- s.snapshot=1
- s.catalog=global.catalog
- s.AppName=global.rexxPort
- s.AppIcon=AddPart(global.path,global.program)
- global.AppIcoNname=global.AppIconName
- s.CxTitle=global.program global.ver global.author
- s.CxDescr=global.str.CXDESCR
- s.MasterWin="MW"
- s.AutoClose=1
- s.Iconified=global.nogui
- res=OpenSurface(global.surface,"S")
- if res~=0 then call error(res)
- global.ss=SurfaceSignal("S")
- mw.ID=1
- mw.Gads=30
- mw.Iconified=global.nogui
- res=OpenWindow("S","MW")
- call LockWindows("S")
- cw.ID=2
- cw.Gads=70
- cw.maxheight=0
- cw.NoWindow=1
- cw.Iconified=0
- res=OpenWindow("S","CW")
- if res~=0 then call error(res)
- call copyConf("GLOBAL","GLOBAL.INUSE")
- global.noti=StartNotify("CLIP")
- global.ns=NotifySignal(global.noti)
- return
- /***************************************************************************/
- halt:
- call safeQuit(1)
- exit
- break_c:
- call safeQuit(1)
- exit
- /**************************************************************************/
- handleclip: procedure expose global.
- if ~global.watchclip then return
- if ReadTextClip("C")~=0 then do
- parse upper var c "HTTP://"u .
- cu=upper(c)
- p=pos("HTTP://",cu,1)
- if p>0 then do
- p=p-1
- parse var c +p u d "A"x
- if parseUrlFun("GLOBAL.FAKEURL",u) then do
- od=pragma("D",global.path)
- cmd = "run <NIL: >NIL: rx GetIt.rexx URL" global.fakeurl.url
- shell command cmd
- call pragma("D",od)
- end
- end
- end
- return
- /**************************************************************************/
- openConfWin: procedure expose global.
- parse arg p
- call copyConf("GLOBAL","GLOBAL.INUSE")
- pw.ID=2
- pw.Gads=70
- res=OpenWindow("S","PW")
- if res~=0 then call error(res)
- return
- /**************************************************************************/
- getStrings: procedure expose global.
- catalog=OpenCatalog(global.cat,"english",0)
- global.str.NOFILE=GetCatalogStr(catalog,1000,"No file specified")
- global.str.CANTFIND=GetCatalogStr(catalog,1001,"Can't find")
- global.str.NOTVALIDFILE=GetCatalogStr(catalog,1002,"is not a valid file name")
- global.str.URLFROMFILE=GetCatalogStr(catalog,1003,"URL derived from file")
- global.str.NTURLFROMFILE=GetCatalogStr(catalog,1004,"Can't derive URL from file")
- global.str.NOURL=GetCatalogStr(catalog,1005,"No URL specified")
- global.str.CONFIGFILE=GetCatalogStr(catalog,1006,"Config file")
- global.str.NTFOUND=GetCatalogStr(catalog,1007,"not found")
- global.str.INLINE=GetCatalogStr(catalog,1008,"in line")
- global.str.BADOPT=GetCatalogStr(catalog,1009,"Bad option")
- global.str.BADNUM=GetCatalogStr(catalog,1010,"Bad number")
- global.str.UNKNOWNOPT=GetCatalogStr(catalog,1011,"Unknown option")
- global.str.BADARG=GetCatalogStr(catalog,1012,"Bad argument")
- global.str.OPT=GetCatalogStr(catalog,1013,"Option")
- global.str.NEEDARG=GetCatalogStr(catalog,1014,"needs an argument")
- global.str.NOTCP=GetCatalogStr(catalog,1015,"No TCP/IP stack is running")
- global.str.CXDESCR=GetCatalogStr(catalog,1016,"ARexx http dowloader")
- global.str.SAVINGCONF=GetCatalogStr(catalog,1017,"Saving configuration...")
- global.str.CANTWRITE=GetCatalogStr(catalog,1018,"Can't write to")
- global.str.CONFSAVED=GetCatalogStr(catalog,1019,"Configuration saved")
- global.str.CONFREAD=GetCatalogStr(catalog,1020,"Configuration read")
- global.str.CONFMODIFIED=GetCatalogStr(catalog,1021,"Configuration modified")
- global.str.INVALIDURL=GetCatalogStr(catalog,1022,"invalid URL")
- call CloseCatalog(catalog);
- return
- /**************************************************************************/
- sameFile: procedure
- parse arg a,b
- o=pragma("D",PathPart(a))
- o=pragma("D",o)
- a=AddPart(o,FilePart(a))
- o=pragma("D",PathPart(b))
- o=pragma("D",o)
- b=AddPart(o,FilePart(b))
- return upper(a)==upper(b)
- /**************************************************************************/
- /* $VER: GetIt.rexx 4.5 (17.5.99) */