; $VER: rearc 1.2 (15-Dec-93)
; Script to convert ZOO, ARJ and LHARC archives into LHA archives. Handy
; for BBSs. It _does_ work - I've redone 50Mb of assorted archives with this!
; This script uses some of the funny things in the 2.04 shell. You really
; need to understand the tricks to use the commands properly!

.key Archive/A
.bra [
.ket ]

set fullname `fullpath "[Archive]"`
set ext `extpart "$fullname"`
set stem `stempart "$fullname"`
set cd `cd`

if exists ram:temp
  delete ram:temp all force quiet
endif
makedir ram:temp
cd ram:temp

set archiver ""

if $ext eq .zoo
  set archiver "zoo x//"
endif

if $ext eq .arj
  set archiver "unarj x"
endif

if $ext eq .lzh
  set archiver "lha -r x"
endif

if "$archiver" eq ""
  echo "$fullname is not a recognised archive"
else
; delete "$stem.lha"
  echo "Depacking from $stem$ext"
  $archiver "$stem"
  echo "Repacking to $stem.lha"
  lha -r a "$stem.lha"
  filenote "$stem.lha" "`list "$fullname" lformat "%C"`"
  setdate "$stem.lha" `list dates "$fullname" lformat "%D %T"`
  delete "$stem$ext"
endif

cd "$cd"
delete ram:temp all force quiet
