Subject: Re: "catman".
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 03/19/1997 18:28:19
> Does anything similar to "catman" exist on NetBSD?  I want to
> automatically build formatted man pages and whatis databases for a
> man tree which is not /usr/share/man.  Any interest in such a
> program?

Here's our /local/man/Makefile.  (The "astonishing expression" dates
from before :C went into make.)

# 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.

# The /:/d is because make botches $(CATPAGES) if CATPAGES contains colons;
# it mistakes the colons in the variable expansion for make-syntax colons.
CATPAGES != ls -1 man?/* 2>/dev/null | sed -e '/:/d' -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.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B