#! /bin/sh # 3/2004, h-peter recktenwald < lx -a- lxhp . in - berlin . de>     # modifies syscall html-docs & internal references to/from gzip-ed, # pass $1 = "*" for any other htm(l) files # link this to for conversion reversal [ -n "$(pwd|grep -l lib4th)" ]&&cd ../doc s="${1}" [ -n "${s}" ]||s='lhp' s=${s}'*htm' z= [ "${0##*-}" = "ungz" ]&&z='.gz' IFS=" " function f() { find $(pwd) \( -name index.html${z} -o -name "${s}l${z}" -o -name "${s}${z}" \) -print; } function g(){ local h i1 i2 r r="${1}" # r="${r//HTML/html}" # r="${r//}" h="${h%%\"*}" [ "x${h}" != "x${h/http}" -o "x${h}" != "x${h/ftp}" ]||{ h1="${h%%#*}";h2= [ "${h1}" == "${h}" ]||h2="#${h#*#}" r="${i1}${h1}.gz${h2}\">$(g "${i2}")" #e 2:${r} } } } echo "${r}" } function e () { echo "${@}" > /dev/stderr; } #function e () { return; } [ "${0##*-}" = "ungz" ]&&{ f|while read "i";do e ${i};zcat "${i}"|sed -e 's/html.gz/html/g;s/htm.gz/htm/g'>${i%.*};done }||{ [ "${0##*-}" = "gz" ]&&{ f|while read l do e ${l} cat ${l}|sed -e 's/\\/\\\\/g;s/\ ${l}.gz done } } # # ----------------------------------------------------------------------------- # # html-{un,}gz exit # alt: #! /bin/sh # 10/2001 by h-peter recktenwald # modify html glossaries to/from gzip-ed # link this to to enabling de-compression s="${1}" [ -n "${s}" ]||s='l4' [ -n "$(pwd|grep -l lib4th)" ]&&cd ../doc 2>/dev/null #[ "$(extname ${0} --)" = "ungz" ]&&{ [ "${0##*-}" = "ungz" ]&&{ find $(pwd) \( -name ${s}\*html\.gz -o -name ${s}\*htm\.gz \) -print|while read i do echo $i>/dev/tty;chmod a+rw ${i};zcat ${i}|sed -e 's/html.gz"/html"/g;s/html.gz#/html#/g;s/htm.gz"/htm"/g;s/htm.gz#/htm#/g'>$(basename ${i} .gz);chmod a-w $(basename ${i} .gz) ${i};done }||{ [ "${0##*-}" = "gz" ]&&{ find $(pwd) \( -name ${s}\*html -o -name ${s}\*htm \) -print|while read i do echo $i>/dev/tty;chmod a+rw ${i};cat ${i}|grep -v '^lhp'|sed -e 's/html"/html.gz"/g;s/html#/html.gz#/g;s/htm"/htm.gz"/g;s/htm#/htm.gz#/g;s/lhpf8.html.gz/lhpf8.html/g;s/lhpsyscal.html.gz/lhpsyscal.html/g'|gzip -9c >${i}.gz;chmod a-w ${i} ${i}.gz;done } } # # ----------------------------------------------------------------------------- # # html-{un,}gz