This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Man page in browser
- To: cygwin at cygwin dot com
- Subject: Man page in browser
- From: Michael Schaap <cygwin at mscha dot com>
- Date: Thu, 03 May 2001 17:26:09 +0200
Hi all,
I wrote a little script to open man pages in a web browser, and thought
that people might be interested
So here it is. It definitely works under Windows 2000/NT, and should work
under Win9x, but I haven't seen a Win9x box in a while, so I can't be sure. ;-)
Have fun with it,
- Michael
==========8<==========/usr/local/bin/bman==========8<==========
#!/bin/bash
if [[ -z $MANPATH ]]; then
manpath="/usr/local/man /usr/man"
else
manpath=${MANPATH//:/ }
fi
if [[ x$OS == xWindows_NT ]]; then
startcmd="cmd /c start"
else
startcmd="start"
fi
if [[ $# -gt 2 || $# -eq 0 ]]; then
echo
echo Usage: `basename $0` [section] topic
echo
exit 2
elif [[ $# -eq 2 ]]; then
section=$1
topic=$2
elif [[ $# -eq 1 ]]; then
section='?'
topic=$1
fi
tmpfile=/tmp/$topic.html
rm -f $tmpfile
manfile=
for m in $manpath; do
for d in $m/man$section; do
if [[ -d $d ]]; then
for f in [[ $d/$topic.* ]]; do
if [[ -f $f ]]; then
manfile=$f
break 3
fi
done
fi
done
done
if [[ -z $manfile ]]; then
echo
echo `basename $0`: no man page found for $topic
echo
exit 1
else
man2html $manfile > $tmpfile
chmod +x $tmpfile
$startcmd `cygpath -w $tmpfile`
fi
==========8<==========/usr/local/bin/bman==========8<==========
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple