#!/bin/sh # Copyright (C) 1995, Mats Kindahl. All rights reserved. # This program is in the public domain, you can redistribute # it and/or modify it as long as this copyright notice is # kept. # # This software is delivered as-is. There is NO WARRANTY, neither # implicit nor explicit, for this code. # # E-mail: matkin@docs.uu.se # # %W% # %Z%CGI to retrieve a manual and deliver it to WWW. MANPATH=/usr/sup/misc/man:/usr/sup/tex/man:/usr/lang/man\ :/usr/local/man:/usr/man:/usr/share/X11/man PATH=/usr/local/bin:/usr/bin name="WWW Manual Pager" # QUERY_STRING contains the manual, with an optional section after, # separated from the name with a space. get_man () { IFS=: for path in $MANPATH; do for m in $path/man?/$1.$2*; do if [ -r "$m" ]; then echo "
"
	nroff -Tman -man $m 2>&1 | col -b
        echo "
" return fi done done echo "

Not found!

" echo "The manual for $1${2:+($2)} could not be retrieved." } htmlman () { IFS=+ read man section dump echo "$name - Manual for ${man:=man}${section:+($section)}" echo "

Manual for $man${section:+($section)}

" get_man $man $section } echo "Content-type: text/html" echo if [ -z "$QUERY_STRING" ]; then echo "" echo "$name - Instructions" echo "

Instructions

" echo " This service gives the manual entry for an on-line manual page. Please give the title for the manual you wish to see, followed by an optional section. " else echo $QUERY_STRING | htmlman fi