Subject: Re: What's the best (easiest) way to view man pages?
From: [email-masked] (Peter Dalgaard BSA)

31 Jan 1998 15:30:53 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: Text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
To: "Tim Fisher" <[email-masked]>
Cc: <[email-masked]>

"Tim Fisher" <[email-masked]> writes:

> (it's almost impossible to read them that way). The groff package was
> supposed to contain a man implementation, but alas there was none.
> Suggestions?
> 
> I would think man would be a high priority for CygWin. Emacs and vi be
> damned--we already have more text editors than we can handle under Win32. We
> need a man page viewer.

These are not in the same league... "man" is trivial to do, but
perhaps someone should take the time and put a version in a visible
place?

I'm getting a bit rusty on cygwin these days, mainly just listening in
on the conversations, but once upon a time I rolled up a simple shell
script doing essentially groff | less with the relevant
options stuffed in. It's somewhere in the mailing list archives, but I
can't locate it right now.

So was this more elaborate one, due to
"Charles S. Bowman" <[email-masked]>:

Quote>>

#! /bin/sh

#  Filename : man
#  Author   : Steve Bowman
#  Created  : 970323N
#  Modified : 970724R

#  crude - the following are known bugs/omissions:
#       doesn't handle multiple arguments (use shift)
#       doesn't break search when file found
#       doesn't check extension match
#       doesn't handle pager environment
#       doesn't handle flag to alter search path without resetting
#       MANPATH
#       assumes groff and less are in PATH

if [ $# -eq 0 ]; then
    echo "Usage: man <manpage>"
    exit 1
fi

if [ x$MANPATH = x ]; then
    MANPATH=/usr/man:/usr/gnuwin32/b18/man
fi

for i in `echo $MANPATH | sed s/:/\ /g`; do
    if [ -d $i ]; then
        cd $i
        if [ -f man?/$1.1 ]; then
            if [ $? -eq 0 ]; then
                groff -man -Tascii -Wall man?/$1.? | less
            fi
        fi
    fi
done

exit 0
--- cut ---

And finally, to launch it I put a function in /etc/profile:

man () { sh /usr/bin/man $@; }

Since that version of bash wouldn't recognize /usr/bin/man as
executable.  I don't know if that's still a problem or not.

<<endquote
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([email-masked])             FAX: (+45) 35327907

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".