home *** CD-ROM | disk | FTP | other *** search
- /*
- * A 'quick and dirty' script to gunzip archives from DirectoryOpus using
- * drag & drop (similar to LHA-archives).
- *
- * V1.0 (20.7.96) by David Lübbren.
- *
- * The source file should have the following format :
- * <file>.tar.gz or <file>.tgz
- *
- * Installation:
- * (Note: exact names may differ as I run the german DOpus version)
- *
- * Add a GZIP file type in the file type editor with the following:
- * Compare Name #?.(gz|tgz)
- *
- * Actions:
- * Drag&Drop Arexx DOpus5:Arexx/gunzip.dopus5 {Qp} {f} {d}
- * Attr. With all files
- * Rescan destination
- * DoubleClick AmigaDOS gzip -l {f}
- * Attr. Output in text viewer
- *
- * Optional:
- * Add a TAR file type in the file type editor:
- * Compare Name #?.tar
- *
- * Action:
- * DoubleClick AmigaDOS tar xf {o}
- * Attr. CD source
- * Rescan source
- *
- *
- * TODO:
- * Use more rigorous file identification. I don't know the internal
- * format of gzip files (apparently some kind of CRC-check).
- *
- */
-
- OPTIONS RESULTS
-
- PARSE ARG dopusport file dest .
- IF dopusport ~= "" THEN ADDRESS VALUE dopusport
- ELSE DO
- SAY "No DOpus running !"
- EXIT
- END
-
- file = STRIP(file, 'B', '"')
- dest = STRIP(dest, 'B', '"')
-
- divpos = MAX(LASTPOS(':', file), LASTPOS('/', file)) + 1
- filename = SUBSTR(file, divpos)
- lp = LASTPOS('.', filename)
- IF lp ~= 0 THEN DO
- unarch = dest || SUBSTR(filename, 1, lp - 1)
- /*
- * Hack to process '.tgz' archives.
- */
- IF RIGHT(unarch, 4) ~= ".tar" THEN DO
- unarch = unarch || ".tar"
- END
- ADDRESS COMMAND 'gunzip -c 'file' > 'unarch
- END
- ELSE DO
- dopus request '"Archive Name 'filename' not of required type" Ok'
- EXIT 5
- END
-
- EXIT
-
-
-