/* DeArc.rexx  -  uses the ARC command to extract archive files */

/* ** Note **  This program assumes that you have the 'ARC' program located
               in your SYS:C directory */


if ~(Show('P', 'FileRequester')) then
	do
	ADDRESS COMMAND "Run >NIL: <NIL: DEVS:Freq >NIL: <NIL:"
	ADDRESS COMMAND "WaitForPort FileRequester"
	if ~(Show('P', 'FileRequester')) then
		do
		say "UnAble to Load FileRequester"
		exit
		end
	end

OPTIONS RESULTS
ADDRESS "FileRequester"
'SetPattern'		/* clear the pattern */
'SetFileName'		/* clear the filename */
more = "TRUE"
do while more = "TRUE"
	'SetTitle Select an Archive to Extract'
	'DisplayDef'
	'GETFILENAME'
	if (RC = 0) then
		ADDRESS COMMAND 'SYS:C/ARC -x' '"' || Result || '"'
	else
		do
		more = "FALSE"
		say 'Operation Canceled'
		end
	end
exit 0
