#! /bin/sh
# 10/2001 by h-peter recktenwald <phpr@snafu.de>
# modify html glossaries to/from gzip-ed
# link this to <html-ungz> to enabling de-compression
EN="./util/extname"

s="${1}"
[ -n "${s}" ]||s='l4'

[ -n "$(pwd|grep -l lib4th)" ]&&cd ../doc 2>/dev/null

[ "$(${EN} ${0} --)" = "ungz" ]&&{
    find $(pwd) -name ${s}\*html\.gz -print|while read i
    do chmod a+rw ${i};zcat ${i}|sed -e 's/html.gz"/html"/g' -e 's/html.gz#/html#/g'>$(basename ${i} .gz);chmod a-w $(basename ${i} .gz) ${i};done
}||{
[ "$(${EN} ${0} --)" = "gz" ]&&{
    find $(pwd) -name ${s}\*html -print|while read i
    do chmod a+rw ${i};cat ${i}|sed -e 's/html"/html.gz"/g' -e 's/html#/html.gz#/g'|gzip -9c >${i}.gz;chmod a-w ${i} ${i}.gz;done
    }
}

#
# ----------------------------------------------------------------------------- #
# html-{un,}gz <eof>
