This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: What's the best (easiest) way to view man pages?


"Tim Fisher" <tfisher@teamparadigm.com> 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" <sbowman@goodnet.com>:

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
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]