public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Man page in browser
@ 2001-05-03  8:26 Michael Schaap
  0 siblings, 0 replies; only message in thread
From: Michael Schaap @ 2001-05-03  8:26 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-03  8:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-03  8:26 Man page in browser Michael Schaap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).