www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/01/31/15:30:53

From: p DOT dalgaard AT biostat DOT ku DOT dk (Peter Dalgaard BSA)
Subject: Re: What's the best (easiest) way to view man pages?
31 Jan 1998 15:30:53 -0800 :
Message-ID: <x2yazwjkl5.fsf.cygnus.gnu-win32@blueberry.kubism.ku.dk>
References: <001c01bd2e14$da720110$b2e2e3d0 AT caliban DOT teamparadigm DOT com>
Mime-Version: 1.0
To: "Tim Fisher" <tfisher AT teamparadigm DOT com>
Cc: <gnu-win32 AT cygnus DOT com>

"Tim Fisher" <tfisher AT teamparadigm DOT 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 AT goodnet DOT 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 DOT dalgaard AT biostat DOT ku DOT dk)             FAX: (+45) 35327907

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

- Raw text -


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