;; Read a (possibly gzip compressed) file indicated at the start of a line ;; Written for Indexed mbox files store-procedure l3-read-gzip-opt goto-bol set-variable %file &word 0 $line set-variable %buf &cat "[" &cat %file "]" write-message &cat "Existing buffer: " %buf ~force select-buffer %buf ~if $status ~return ~endif ~if &rd %file edit-file %file ~force rename-buffer %buf ~return ~endif set-variable %zfile &cat %file ".gz" write-message &cat "gzipping file: " %zfile ~if &rd %zfile ~force edit-file &cat "!gzip -dc " %zfile ~if not $status write-message &cat "** gzip &cat %zfile " failed." ~return ~endif ~force rename-buffer %buf ~return ~endif set-variable %zfile &cat %file ".bz2" write-message &cat "bzip2 file: " %zfile ~if &rd %zfile ~force edit-file &cat "!bzip2 -dc " %zfile ~if not $status write-message &cat "** bzip2 &cat %zfile " failed." ~return ~endif ~force rename-buffer %buf ~return ~endif ~endm