delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/03/11:32:02

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-Id: <5.1.0.14.2.20010503172059.04622e80@pop3.demon.nl>
X-Sender: dogbert AT pop3 DOT demon DOT nl
X-Mailer: QUALCOMM Windows Eudora Version 5.1
Date: Thu, 03 May 2001 17:26:09 +0200
To: cygwin AT cygwin DOT com
From: Michael Schaap <cygwin AT mscha DOT com>
Subject: Man page in browser
Mime-Version: 1.0
X-Virus-Scanned: at mscha.com by AMaViSd snapshot-20010407 (http://amavis.org/)

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019