Subject: catman
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: current-users
Date: 09/12/1996 18:33:38
I notice the absence of catman under NetBSD.  For the NetBSD manpages
this is not a problem, because the catfiles are installed rather than
the manfiles.  But if you have any other manpages where the manfile
rather than the catfile gets installed, it can be a problem.  It's
particularly annoying since the NetBSD man doesn't know how to save the
catfile it generates.  (Someone did do a rather ugly kludge to man that
wired in a bunch of assumptions about how the directories were
organized, but I haven't seen it cleaned up nor taken into the main
sources.)

For people bothered by this, here's a Makefile that may prove useful.
As the comment header indicates, drop this into /usr/local/man or
/site/man or whatever has the man? and cat? subdirectories, then a
"make" will do the equivalent of traditional catman.

It does have some problems, notably that if nroff fails the catfile is
still created, usually empty or partially so.  This could of course be
changed by making the nroff command a little smarter.  Also, as the
comments indicate, makewhatis breaks when run by non-root, even if the
user does in fact have all the required access.

As the comment header indicates, we place this in the public domain.
Anyone may use it in any way for any purpose.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     01 EE 31 F6 BB 0C 34 36  00 F3 7C 5A C1 A0 67 1D

# Makefile to do the equivalent of "catman", i.e. build cat pages from
# man pages, and build the "whatis" database, under NetBSD.  Place this
# makefile in the appropriate man "source" directory, i.e. one which
# contains subdirectories man1,man2,... and cat1,cat2,....
#
# Authors: Anne Bennett <anne@rodents.montreal.qc.ca>
#          der Mouse   <mouse@rodents.montreal.qc.ca>
# Date:    1996/08/11
# We place this code in the public domain; enjoy.

CATPAGES != ls man?/* 2>/dev/null | sed -e 's/^man/cat/' -e 's/[1-9]$$/0/'

all: $(CATPAGES) whatis.db

# This astonishing expression translates "cat1/dig.0" to "man1/dig.1"
$(CATPAGES): $(.TARGET:S=^cat=man=:S=0$==)$(.TARGET:H:S=cat==)
	-nroff -mandoc $(.ALLSRC) > $(.TARGET)
	-chmod 664 $(.TARGET)

whatis.db: $(CATPAGES) cat?/*
	/usr/libexec/makewhatis .

# Note: makewhatis above expects to "install -o -g" the built file
# from /tmp, so this won't work if you're not running as root.