/* ARexx script to get a range of FF disks from ftp site */ /* THIS CODE NEEDS MODIFICATION (PERSONALIZATION) TO WORK FOR YOU!! */ /* Modify the variables below (where indicated--search for "/***" to get there quickly). The delete the lines below that section that abort this script until you have made these adjustments. READ THE NOTE BELOW. */ /* Written by Nickey MacDonald (i6t4@jupiter.sun.csd.unb.ca) February 24, 1993 - First released to public (Term 2.4a version) April 2, 1993 - Updated for Term 3.1 April 7, 1993 - Updated for Term 3.2 This script is written in AREXX for the AREXX port of TERM (3.2). This should also work with TERM 3.1 as well (but not versions before that) and it has a fix or two to make it work correctly. (As I said in the 3.1 version, I could not get TERM 3.1 to work correctly and so I had trouble testing it. It seems to work okay on TERM 3.2, so I assume it would also work with a well working copy of 3.1 (if there ever was one :-) ) ) I use the CSH shell (on my Unix account) and there is at least one dependancy in this code on that fact... (The line that checks for and creates the "WHEREDIR") **** NOTE WELL **** When this script exits from AREXX (like if you cancle one of the disk number requesters or it completes normally, etc.) TERM seems to wait indefinately (with a busy mouse pointer) for the AREXX command to come back, although the output window closed. (There used to be a 'Hit RETURN to continue prompt there...' it appears to be lost in TERM 3.1). I have added a requestor (it is fixed since the 3.1 version) if there is a timeout on the wait during the transfer of one of the FF disk dirs (this type of code should be added in other places, but odds are this is the most critical location if you have *really* slow links). If will offer you the choice of "Keep waiting", "Skip the current wait" (forge on as if the last wait had be satisfied) or "Quit" the script. I was leary of adding anything to prevent the script form being completely automatic, but I felt that in this case, if you timeout after 10 minutes, its probably failed anyway... and so I added it... *** End Note *** This script was written to work with the ux1.cso.uiuc.edu anonymous ftp archive of the Fred Fish Disks. Its directories are as follows: /amiga /fishdoc /f3 Contents.3xx /f4 Contents.4xx /fy Contents.yxx /fish /f5 /ff5xx *.lzh /f6 /f6xx *.lzh /fy /fyxx *.lzh This script should be easily modified to handle another site with a similar organization... especially if its just changing a few of the defined variables at the start. */ /*** Some configurable values - You will have to change some of these ***/ /*** Probably at least the last three ***/ FTPSITE='ux1.cso.uiuc.edu' /* The site to use */ DOCDIR='/amiga/fishdoc' /* Where the contents files are */ DISKDIR='/amiga/fish' /* Where the fish disks are */ TIMEOUT='SEC 600' /* How long to WAIT (10 min) */ ANONPWD='dumb@user' /* Mail address - Anon ftp pass */ USERPROMPT='%' /* part of users csh prompt */ WHEREDIR='/tmp/fish' /* Where to put fish disks */ /* Remove these lines (2 comment lines, SAY and exit) once you */ /* personalize the above values */ SAY 'You need to modify (personalize) this AREXX program...' exit /* Allow results to be returned */ OPTIONS RESULTS ADDRESS TERM SAY 'What range of FF disks do you want to fetch?' /* Get starting disk number */ RESULT="" 'REQUESTNUMBER PROMPT "Starting FF disk number?"' if RC ~= 0 then do SAY 'You must enter the starting disk number.' exit end startval=RESULT /* Get ending disk number */ RESULT="" 'REQUESTNUMBER PROMPT "Ending FF disk number?"' if RC ~= 0 then do SAY 'You must enter the endinf disk number.' exit end endval=RESULT /* Lets make sure its worth starting... */ IF startval > endval then do SAY 'Start disk number must be less than end disk number!' exit end SAY 'Getting FF disks' startval 'to' endval'...' 'TIMEOUT' TIMEOUT /* Get into ftp */ SAY 'Starting ftp...' 'SEND' 'if ( ! -d' WHEREDIR ') mkdir' WHEREDIR'\r' 'WAIT' USERPROMPT 'SEND' 'cd' WHEREDIR'\r' 'WAIT' USERPROMPT 'SEND' 'ftp -n\r' 'WAIT ftp>' /* Connect to host */ SAY 'Connecting...' 'SEND' 'open' FTPSITE'\r' 'WAIT ftp>' 'SEND' 'user anonymous\r' 'WAIT pass' 'SEND' ANONPWD'\r' 'WAIT ftp>' /* Set mode */ SAY 'Setting up ftp...' 'SEND' 'bin\r' 'WAIT ftp>' 'SEND' 'prompt\r' 'WAIT ftp>' 'SEND' 'hash\r' 'WAIT ftp>' /* Get the contents files */ SAY 'Getting contents files...' 'SEND' 'cd' DOCDIR'\r' 'WAIT ftp>' do dnum=startval to endval SAY ' Getting Contents.' || dnum || '...' ddir='f' || TRUNC(dnum/100) 'SEND' 'cd' ddir '\r' 'WAIT ftp>' 'SEND' 'get Contents.' || dnum '\r' 'WAIT ftp>' 'SEND' 'cd ..\r' 'WAIT ftp>' end /* Get the directories */ SAY 'Getting FF disks by dir...' 'SEND' 'cd' DISKDIR'\r' 'WAIT ftp>' do dnum=startval to endval ddir='f' || TRUNC(dnum/100) dname='ff' || dnum SAY ' Getting' dname'...' 'SEND' 'cd' ddir '\r' 'WAIT ftp>' 'SEND' '!mkdir 'dname'\r' 'WAIT ftp>' 'SEND' 'lcd 'dname'\r' 'WAIT ftp>' 'SEND' 'cd 'dname'\r' 'WAIT ftp>' 'SEND' 'mget *\r' waitlp=0 do while waitlp=0 'WAIT ftp>' if RC ~= 0 then do 'REQUESTRESPONSE' 'OPTIONS "Wait Again|Skip|No" PROMPT "Timeout waiting for files... Continue?"' if RC ~= 0 then exit if RESULT = 2 then waitlp=1 end else waitlp=1 end 'SEND' 'cd ../..\r' 'WAIT ftp>' 'SEND' 'lcd ..\r' 'WAIT ftp>' end /* All done finish up */ SAY 'All done... quitting ftp.' 'SEND ' 'close\r' 'WAIT ftp>' 'SEND' 'quit\r' 'WAIT' USERPROMPT /* Create an LHA archive SAY 'Archiving the directories...' 'SEND' 'lha c fishes' || startval || '-' || endval || '.lzh' do dnum=startval to endval 'SEND' ' ff' || dnum end 'SEND' '\r' 'WAIT' USERPROMPT */ /* Create LHA archive archives SAY 'Archiving the directories...' do dnum=startval to endval 'SEND' 'lha c ' || dnum '.lzh ' || dnum '\r' 'WAIT' USERPROMPT end */ SAY 'Macro exiting.' exit