Subject: bin/1062: makewhatis
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Robert Dobbs <banshee@gabriella.resort.com>
List: netbsd-bugs
Date: 05/18/1995 17:20:03
>Number: 1062
>Category: bin
>Synopsis: makewhatis fails to find MAN format files
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 18 17:20:02 1995
>Originator: Robert Dobbs
>Organization:
Resort.com
>Release: # $Header: /b/source/CVS/src/libexec/makewhatis/makewhatis.sh,v 1.4 1994/03/19 08:09:16 cgd Exp $
>Environment:
System: NetBSD gabriella.resort.com 1.0A NetBSD 1.0A (RESORT3) #2: Fri Mar 17 13:46:12 PST 1995 banshee@ns.cooltech.com:/usr/src/sys/arch/i386/compile/RESORT3 i386
>Description:
Many programs install man files that are in man nroff format. These
man files are named foo.1, foo.5, foo.8, etc. makewhatis only looks
for foo.0 and compressed versions.
>How-To-Repeat:
Install any man file in /usr/share/man/manX/file.X Run makewhatis
and note that they are not in the whatis.db file.
>Fix:
A fix requires a modification to /usr/libexec/makewhatis and a new
/usr/share/man/makewhatis.sed to deal with nroff man type files.
I hacked up a new makewhatis-man.sed and added to the makewhatis
script for 1..8.
# Get Man Files
find $MANDIR -type f -name '*.1' -print | while read file
do
sed -n -f /usr/share/man/makewhatis-man.sed $file;
done > /tmp/whatis$$
Here is my hack of the std makewhatis.sed to deal with man pages.
(I don't follow sed really well, so parts may be useless, but when
I ran this on /usr/local/man it produced correct results.)
==BEGIN==
#!/usr/bin/sed -nf
#
# Look for the manual page header .TH name number[ date]
/^.TH [a-zA-Z][a-zA-Z0-9\._+\-]* \([a-zA-Z0-9\._+\-]*\).*/ {
s;^.TH [a-zA-Z0-9\._+\-]* \([a-zA-Z0-9\._+\-]*\).*;\1;
# add a trailing space following the pattern space
s;[a-zA-Z0-9\._+\-]*;& ;
# save the manual number
h
d
}
# look for the program name
/^.SH NAME/!d
:name
s;.*;;
N
s;\n;;
# Convert "foo /- does bar" to "foo - does bar"
s;\\-;-;
# some twits underline the command name
s;;;g
/^[^a-zA-Z]/b print
H
b name
:print
x
s;\n;;g
/-/!d
s;;;g
s;\([a-z][A-z]\)-[ ][ ]*;\1;
s;\([a-zA-Z0-9,\._+\-]\)[ ][ ]*;\1 ;g
s;[^a-zA-Z0-9\._+\-]*\([a-zA-Z0-9\._+\-]*\)[^a-zA-Z0-9\._+\-]*\(.*\) - \(.*\);\2 (\1) - \3;
p
q
==END==
>Audit-Trail:
>Unformatted: