Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA
Path: utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!hplabs!hao!seismo!brl-tgr!tgr!Dan Hoey 
From: Dan Hoey 
Newsgroups: net.unix-wizards
Subject: 4.2BSD catman(8) fails on large manual +FIX
Message-ID: <6320@brl-tgr.ARPA>
Date: Tue, 4-Dec-84 07:42:51 EST
Article-I.D.: brl-tgr.6320
Posted: Tue Dec  4 07:42:51 1984
Date-Received: Thu, 6-Dec-84 06:38:44 EST
Sender: news@brl-tgr.ARPA
Organization: Ballistic Research Lab
Lines: 43

PROBLEM:
    /etc/catman -w gives message "?TMP" and creates an empty
    /usr/lib/whatis.

REPEAT-BY:
    /etc/catman -w did it for us.  It is dependent on the number of
    manual entries, and the size of their NAME sections.

DIAGNOSIS:
    Catman runs /usr/lib/makewhatis, which uses ed(1) to massage a
    bunch of header lines from the manuals.  Ed is running out of buffer
    space somewhere.  "?TMP" is one of those `self-explanatory message's
    from ed.

FIX:
    The same function can be performed with sed(1), and doesn't need to
    use a buffer.  I have also made it include the "local" and "new"
    manual sections in the whatis database, though I'm not sure I
    should.  In the diff listing below, replace "" with a tab
    character.

3c3
< for i in man1 man2 man3 man4 man5 man6 man7 man8
---
> for i in man1 man2 man3 man4 man5 man6 man7 man8 manl mann
9,17c9,11
< ed - /tmp/whatis <<\!
< g/\\-/s//-/
< g/\\\*-/s//-/
< g/ VAX-11/s///
< 1,$s/.TH [^ ]* \([^ ]*\).*\([^-]*\)/\2(\1)/
< g/ /s///g
< w /tmp/whatis2
< q
< !
---
> sed -e 's/\\-/-/g' -e 's/\\\*-/-/g' -e 's/ VAX-11 / /g' \
>     -e 's/^\.TH [^ ]* \([^ ]*\).*\([^-]*\)/\2(\1)/' \
>     -e 's/ //g' /tmp/whatis >/tmp/whatis2

Dan Hoey
Navy Center for Applied Research in Artificial Intelligence
Hoey@NRL-AIC.ARPA