Mercurial > notdcc
view misc/dccman2html @ 1:9b8d79ac0dc3
blindly adding debian patch for old version
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 14:25:08 +0100 |
parents | c7f6b056b673 |
children |
line wrap: on
line source
#! /bin/sh -e # elaborate man2html and do not depend on whether perl is in /usr/bin or # /usr/local/bin # Copyright (c) 2008 by Rhyolite Software, LLC # # This agreement is not applicable to any entity which sells anti-spam # solutions to others or provides an anti-spam solution as part of a # security solution sold to other entities, or to a private network # which employs the DCC or uses data provided by operation of the DCC # but does not provide corresponding data to other users. # # Permission to use, copy, modify, and distribute this software without # changes for any purpose with or without fee is hereby granted, provided # that the above copyright notice and this permission notice appear in all # copies and any distributed versions or copies are either unchanged # or not called anything similar to "DCC" or "Distributed Checksum # Clearinghouse". # # Parties not eligible to receive a license under this agreement can # obtain a commercial license to use DCC by contacting Rhyolite Software # at sales@rhyolite.com. # # A commercial license would be for Distributed Checksum and Reputation # Clearinghouse software. That software includes additional features. This # free license for Distributed ChecksumClearinghouse Software does not in any # way grant permision to use Distributed Checksum and Reputation Clearinghouse # software # # THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC # BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. # Rhyolite Software DCC 1.3.103-1.18 $Revision$ MAN2HTML=misc/man2html OFILE=/dev/null TFILE=/tmp/dccman2html.$$ USAGE="`basename $0`: [-x] [-m man2html] [-t name] [-o ofile]" while getopts "xm:t:o::" c; do case $c in x) set -x; DEBUG=-x;; m) MAN2HTML=$OPTARG;; t) Title="$OPTARG.8"; exec <"$OPTARG";; o) OFILE=$OPTARG;; *) echo "$USAGE" 1>&2; exit 1;; esac done shift `expr $OPTIND - 1 || true` if test "$#" -ne 0; then echo "$USAGE" 1>&2 exit 1 fi trap "/bin/rm -f $TFILE" 0 1 2 15 BURL=http://www.rhyolite.com/ perl $MAN2HTML -botm 0 -topm 0 -Title "$Title" \ -cgiurlexp '(($TITLE = ${title}) =~ tr/A-Z/a-z/, $TITLE).".html"' \ | sed \ -e '# remove stray page header not deleted by man2html' \ -e '/^FreeBSD [1-9]/d' \ -e '# remove HTTP references to non-DCC man pages' \ -e 's@<\(A HREF="cdcc.html"\)@<Z\1@g' \ -e 's@<\(A HREF="dbclean.html"\)@<Z\1@g' \ -e 's@<\(A HREF="dblist.html"\)@<Z\1@g' \ -e 's@<\(A HREF="dcc[dm]*.html"\)@<Z\1@g' \ -e 's@<\(A HREF="cdcc.html"\)@<Z\1@g' \ -e 's@<\(A HREF="dccproc.html"\)@<Z\1@g' \ -e 's@<\(A HREF="dccifd.html"\)@<Z\1@g' \ -e 's@<\(A HREF="dccsight.html"\)@<Z\1@g' \ -e 's@<A HREF="[^>]*>\([^<]*\)</A>@\1@g' \ -e 's@<ZA HREF=@<A HREF=@g' \ -e '# remove useless tags' \ -e 's@</B> <B>@ @g' \ -e '# add anchor names to sections' \ -e 's@^\( \)\(<B>\)\([^<]*\)</B>$@\1<A NAME="\3">\2\3</B></A>@' \ -e 's@\(<A NAME="[^"]*\)</*B>@\1@g' \ -e 's@\(<A NAME="[^"]*\)</*B>@\1@g' \ -e 's@^\(<H[0-9]>\)\([^<]*\)@\1<A NAME="\2">\2</A>@' \ -e '# add anchor names to option definitions' \ -e '/NAME="DESCRIPTION"/,/NAME="FILES""/s@^ <B>-\([-_a-zA-Z0-9]\)</B>@ <A NAME="OPTION-\1"><B>-\1</B></A>@' \ -e '# add anchor names to cdcc operations' \ -e '/NAME="OPERATIONS"/,/NAME="FILES"/s@^ <B>\([-_a-zA-Z0-9 ]*\)</B>@ <A NAME="OPERATION-\1"><B>\1</B></A>@' \ -e '# add anchor names to file descriptions' \ -e '/NAME="FILES"/,/^<H2>/s@^ \([a-zA-Z0-9_/.]\{1,\}\)@ <A NAME="FILE-\1">\1</A>@' \ -e '# convert blanks in anchor names to dashes' \ -e 's/\(<A NAME="[^"]*\) /\1-/g' \ -e 's/\(<A NAME="[^"]*\) /\1-/g' \ -e 's/\(<A NAME="[^"]*\) /\1-/g' \ -e 's/\(<A NAME="[^"]*\) /\1-/g' \ -e 's/\(<A NAME="[^"]*\) /\1-/g' \ -e 's/\(<A HREF="[^"]*\) /\1-/g' \ -e 's/\(<A HREF="[^"]*\) /\1-/g' \ -e 's/\(<A HREF="[^"]*\) /\1-/g' \ -e 's/\(<A HREF="[^"]*\) /\1-/g' \ -e 's/\(<A HREF="[^"]*\) /\1-/g' \ -e '# replace reference the Rhyolite Software with URL' \ -e 's@Rhyolite Software, LLC,@<A HREF="'$BURL'">&</A>@' \ -e 's@'$BURL'\(">[^<]*</A>\)[, ]*\('$BURL'[^ ]*\)@\2\1@' \ -e '# make references to HTML documents in .8 files into links' \ -e 's@INSTALL.html@<A HREF="&">&</A>@' \ > $TFILE cp $TFILE $OFILE