From saw@hallc1.cebaf.gov Wed Oct 20 16:03:21 1993
Date: Wed, 20 Oct 1993 03:32:44 GMT
From: "Stephen A. Wood"
Subject: WWW Linux man reader
I hacked up a script I found that can make your linux man pages World
Wide Web readable. You just need to add some lines to your /etc/services
and /etc/inetd.conf files, and put the following script in
/usr/local/htfiled (or whereever inetd.conf points.) Then from a WWW
browser such as xmosaic, open the URL http://yourhostname:1235/man
You do need to have networking up with at least loopback.
This way of reading man pages puts in a link wherever a man page refers to
another man page, so it is easy to jump around the man pages. I find it
more pleasant than using xman.
#!/bin/bash
#bogus http server functions, directory browser, man page reader, etc.
#install a service htfile in /etc/services and /etc/inetd.conf as follows:
#services:htfile 1235/tcp
#inetd.conf:htfile stream tcp nowait www /usr/local/htfiled htfiled
#(Make sure you have a www dummy account). makewhatis must have been run so
# that /usr/man/whatis exists and man -k works.
#
# To access, use the URL http://hostname:1235/man
#
# This file was modified by Stephen Wood (saw@cebaf.gov) from a ksh version for
# IRIX 4.0 man pages. It's copyright status is unknown.
exec 2>&1
#read get command line
read get path
#get rid of return character at end of get command
###path=`echo $path|sed s///`
path=`echo $path|sed s/.$//`
#parse arguments with / delimeter (this was a bad idea)
dir="$path"
cmd=`expr "$dir//" : '/\([^/]*\)/'`
args=`expr "$dir" : '/[^/]*/\(.*\)'`
dir=`expr "$dir" : '/[^/]*\(/.*\)'`
arg=`expr "$dir//" : '/\([^/]*\)/'`
dir=`expr "$dir" : '/[^/]*\(/.*\)'`
arg2=`expr "$dir//" : '/\([^/]*\)/'`
case $cmd in
date) echo "Date and Time now

linux

$2 Keyword search

"
echo "

"
### The big substitute a few lines below (and repeated later), attempts to get
### the first command mentioned on the line, since there may be only a man page for
### that command and not the others (since they are all covered in one man page.)
### This seems to work with the set of Linux man pages I have.
man -k $2|sed '
s/\&/\&/g
s/\</g
s/>/\>/g
s/^/