TIP: Click on subject to list as thread! ANSI
echo: os2rexx
to: Mike Ruskai
from: Eddy Thilleman
date: 1999-09-27 21:45:19
subject: hstart wget?

Hello Mike,

24 Sep 99 13:15, MIKE RUSKAI wrote to EDDY THILLEMAN:

MR> You shouldn't depend on this.  Opening files should always be done
MR> with the stream() function (or with a Stream object in OREXX),

I would like to know why.

MR> like this:
MR> check=stream(InFile,'c','open read') if check='' then /* couldn't
MR> open the file, act appropriately */

So I changed my REXX file into this:

------------------- begin of wgetmir.cmd -------------------
/* start wget mirroring each website/file listed in wget.mir */
arg InFile

if InFile = '' then
  InFile = 'wget.mir'

dir = directory( 'c:\www' )
'@set wgetrc=c:\www\wget.cfg'

cmd1 = 'wget.exe -m -c -np --tries=1 -k '
cmd2 = ' -a '
LogFile = "wget.mir.log"
filler = copies('-',30)

signal on notready

LineNr = 0

check = stream( InFile, 'c', 'open read' )
if check != 'READY' then  /* couldn't open the file, act appropriately */
  do
    say "Cannot open file" InFile check
    ch = SysGetKey( NoEcho )
  end
else
  do while stream( InFile, 'state' ) = 'READY'
    LineNr = LineNr + 1
    Line = LineIn( InFile )
    LogFile = "wget.mir"LineNr".log"
    say LineNr': 'Line
    cmd = cmd1 || Line || cmd2 || LogFile
    written = LineOut( LogFile, filler date('W') date() Time() filler )
    "@start /win /c /b "cmd
  end

check = stream( InFile, 'c', 'close' )

return

NotReady:
  if LineNr = 0 then
    say 'NotReady' InFile

return
-------------------- end of wgetmir.cmd --------------------

  Greetings   -=Eddy=-        email: eddy.thilleman@net.hcc.nl

... WindowError:00E Window open, do not look in.
--- GoldED/2 3.0.1
* Origin: Windows95 is a graphic DOS extender (2:500/143.7)

SOURCE: echoes via The OS/2 BBS

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.