home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
compress
/
lhd100.lha
/
LHD.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1993-02-14
|
5KB
|
116 lines
/*
$VER: LHD 1.00 (13-FEB-93)
© 1993 Robert Hofmann
2:2400/24@fidonet.org
39:171/100@amiganet.ftn
*/
LHA = 'c:lha' /* path & name of LHA */
La_Opt = '-I2xrYe a' /* LHA-options for arcing */
Lx_Opt = '-Ia e' /* LHA-options for unarcing */
Assign = 'c:assign' /* path & name of ASSIGN -command */
Format = 'Sys:system/format' /* path & name of FORMAT -command */
F_Opt = 'Quick Noicons FFS' /* format-options */
Info = 'c:info' /* path & name of INFO -command */
Install = 'c:install' /* path & name of INSTALL-command */
Relabel = 'c:relabel' /* path & name of RELABEL-command */
TmpDir = 'T:' /* temporary directory */
parse arg mode in out DiskName .; mode = upper(mode); DiskName = strip(strip(DiskName),'b','"')
call Init; call Header; if mode = '?' then call Usage
if ~show(l, "rexxsupport.library") then; if ~addlib("rexxsupport.library", 0, -30, 0) then do
say LF" *** Break: Couldn't access rexxsupport.library!"LF; exit; end
if right(TmpDir,1) ~= ':' & right(TmpDir,1) ~= '/' then TmpDir = TmpDir'/'
call delete(TmpFile); call delete(NTP)
address command; select
when mode = 'READ' then do; if ~exists(in) then do; say LF' *** Break: No valide device or path' upper('"'in'"')LF; exit; end
if DiskName = '' then do; info '>'TmpFile in; call open(tmp, TmpFile, 'R')
do until eof(tmp); line = readln(tmp); parse var line left . . . . . . right
left = strip(left); right = strip(right)
if upper(left) = upper(in) then do; DiskName = right
if upper(word(DiskName,1)) = 'ONLY' then DiskName = subword(DiskName,2)
leave; end; end; call close(tmp)
if DiskName = '' then do; temp = translate(translate(out,' ',':'),' ','/'); temp = word(temp, words(temp))
parse var temp DiskName '.' .; say LF' *** Info: Can not find DiskName.'LF
options prompt ' Shall I use' upper('"'DiskName'"')' (Y/N)?' ); pull ask; say
if ask ~= 'Y' & ask ~= '' then do; options prompt ' Enter name to be used: '; parse pull DiskName; say
if DiskName = '' then exit; end; end; end
if ~open(tmp, NTP, 'W') then do; say LF' *** Break: Can not open TempFile' upper(NTP)LF; exit; end
call writeln(tmp, DiskName); call close(tmp)
if index(out,'.') = 0 then out = out'.LHD'
if exists(out) then do; say ' 'upper(out) 'already exists.'LF
options prompt ' Shall I overwrite it (Y/N)? '; pull ask; say
if ask = 'Y' then call delete(out); else exit; end
say ' Archiving datas from' upper('"'in'"') 'to' upper('"'out'"')'...'LF
if right(in,1) ~= ':' & right(in,1) ~= '/' then in = in'/'; if exists('c:filenote') then 'c:filenote >nil:' NTP '"'LHD'"'
lha '>nil: -2Ia a' out NTP; lha con La_Opt out in; length = word(statef(out),2)
say ' New archive successfully created. Length:' length 'Bytes.'LF LF
end
when mode = 'WRITE' then do; if index(in,'.') = 0 then in = in'.LHD'
if right(out,1) ~= ':' & right(out,1) ~= '/' then out = out'/'
if word(statef(in),2) ~> 0 then do; say ' *** Break: Can not open input-file' upper(in)LF; exit; end
if DiskName = '' then do; lha '>nil: -I e' in NT TmpDir
if ~open(tmp, NTP, 'R') | word(statef(NTP),2) = 0 then do; parse var in DiskName '.' .
say ' *** Info: No diskname found in' upper(in)'!!!'LF' => Using archivename: "'upper(DiskName)'".'LF; end
else do; DiskName = readln(tmp); call close(tmp); end; end
if upper(left(out,2)) = 'DF' then
if format = '' then do; relabel out '"'DiskName'"'; install out; end
else do; format con 'drive' out 'name' '"'DiskName'"' F_Opt; install out; end
else do; assign '"'DiskName':"' out; say ' Assigned' upper('"'DiskName':"') 'to' upper('"'out'"')LF; end
say ' Extracting datas from' upper('"'in'"') 'to' upper('"'out'"')'...'LF
lha con Lx_Opt in '~('NT')' out; say LF' All done!'LF
end
when mode = 'TEST' then do; if index(in,'.') = 0 then in = in'.LHD'; lha 't' in; end
when mode = 'VIEW' then do; if index(in,'.') = 0 then in = in'.LHD'; lha 'v' in '~('NT')'; end
otherwise do; say ' *** Break: Unknown mode' mode'!!!'LF LF; call Usage; end
end
call delete(TmpFile); call delete(NTP)
exit
Header:
say LF LF LHD; say ' ~~~~~~~~~'LF
return
Init:
interpret 'LHD = "'reverse("7627F6E24756E6F6469666044323F203034323A32302E6E616D666F6840247275626F6250233939313029A02C20303E21367024484C4")'"x'
Con = '<>Con:///100/DiskLHA'
LF = 'a'x
NT = 'DISKNAME.TXT'
NTP = TmpDir || NT
TmpFile = TmpDir'DiskLHA.tmp'
return
Usage:
say ' RX LHD READ <DFx:|{inpath}> <{outfile}[.LHD]> [DiskName]'LF
say ' WRITE <{infile}[.LHD]> <DFx:|{outpath}> [DiskName]'LF
say ' TEST <{file}[.LHD]>'LF
say ' VIEW <{file}[.LHD]>'LF LF; exit