Subject: Re: updating whatis.db?
To: David Wetzel <dave@turbocat.de>
From: D. J. Vanecek <listread@bedford.net>
List: netbsd-help
Date: 01/07/1998 00:08:03
> > From: Jaromir Dolecek <dolecek@ics.muni.cz>
> > You have to add
> >
> > _whatdb /usr/local/man
> >
> > or something like this to /etc/man.conf
> 
> alice# /usr/libexec/makewhatis
> alice# apropos postgres
> postgres: nothing appropriate
> alice# apropos sql
> sql: nothing appropriate
> alice# man sql
> man: Formatting manual page...
> 
> Really bad.
> 
> ---
>    _  _
>  _(_)(_)_  David Wetzel, Turbocat's Development,
> (_) __ (_) Buchhorster Strasse, D-16567 Muehlenbeck/Berlin, FRG,
>   _/  \_   Fax +49 33056 82835 NeXTmail dave@turbocat.de
>  (______)  http://www.turbocat.de/
>            DEVELOPMENT * CONSULTING * ADMINISTRATION
>            WATCH OUT FOR TURBOFAX for OPENSTEP!
> 

The script (from 1.2.1) that does this (/usr/libexec/makewhatis) 
goes through its $1 arg to determine which directories to scan
to create the whatis database(s). 

So first, run  '/usr/libexec/makewhatis /usr/local/man'

Then, if /usr/local/man is in MANPATH, or is specified in /etc/man.conf,
(as Jaromir suggests), whatis will work.

*BUT* it won't work for unformatted man pages, (i.e. ones in troff
source under /usr/local/man/man?). 

You have at least three ways to go if you want it to handle unformatted
pages:  

Method I) Hack the script /usr/libexec/makewhatis, (see the script, which
is fairly simple.)

Example:  one stanza of makewhatis that handles xxx.0 pages is:

  find $MANDIR -type f -name '*.0' -print | while read file
  do
          sed -n -f /usr/share/man/makewhatis.sed $file;
  done > /tmp/whatis$$

To handle an unformatted page named .1, add a stanza something like:

  find $MANDIR -type f -name '*.1' -print | while read file
  do
          /usr/bin/nroff -man $file | sed -n -f /usr/share/man/makewhatis.sed; 
  done >> /tmp/whatis$$

This should at least approximately work...

Of course, we would want to change '*.1' in the find to an appropriate
regular expression to catch [1-9], and also other stuff:  '*.[1-9]*'
looks promising.

There are two other stanzas (stanzi?) in makewhatis, that handle compression.
The hacks are obvious.

Method II) Use a different makewhatis, such as the one used in Linux,
(which I'll mail you if you don't have one handy).  It would require
some hacking, too.  There may be a perl version somewhere, too.

Method III) Expand /usr/local/man/man? into /usr/local/man/cat?  and use
the existing script.

While we're doing all this, we might as well take care of the X man pages
too.

Dave