\ Deflate files of the gzip format needs comp/c io/core comp/sig unit ar/ungz cc<< ar/puff.c : _err abort"ungz error" ; : _assert not if _err then ; : _skiptonull ( rb -- ) begin dup getc# not until drop ; create hdr 10 allot \ Take a gzip file from reader and spit the deflated version in writer : ungz ( reader writer -- err ) swap hdr 10 oover read# hdr wbe@ $1f8b = _assert \ ID1+ID2 hdr 2+ c@ 8 = _assert \ CM hdr 3 + c@ dup $04 and if ( wr rb flg ) \ FLG.EXTRA over hdr 2 oover read# ( wr rb flg rb ) here hdr wle@ ( xlen ) rot read# then \ read extra dup $08 and if over _skiptonull then \ FLG.NAME $10 and if dup _skiptonull then ( wr rb ) \ FLG.COMMENT 2dup puff rot> close close ;