summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@openbsd.org>1999-09-19 23:15:02 +0000
committeralex <alex@openbsd.org>1999-09-19 23:15:02 +0000
commit616493b7d22030b580c3a46a336ec54f39294df7 (patch)
tree05492bdf82dfd83dc55c565c850611c12e27ca8c
parentRemove umass to avoid problems since the driver is not yet in the tree. (diff)
downloadwireguard-openbsd-616493b7d22030b580c3a46a336ec54f39294df7.tar.xz
wireguard-openbsd-616493b7d22030b580c3a46a336ec54f39294df7.zip
When invoked without arguments, extract manpaths from /etc/man.conf.
Allow multiple paths to be specified on the command line. millert@ ok
-rw-r--r--libexec/makewhatis/makewhatis.813
-rw-r--r--libexec/makewhatis/makewhatis.sh49
2 files changed, 32 insertions, 30 deletions
diff --git a/libexec/makewhatis/makewhatis.8 b/libexec/makewhatis/makewhatis.8
index c7c79c786d6..9663c8e9554 100644
--- a/libexec/makewhatis/makewhatis.8
+++ b/libexec/makewhatis/makewhatis.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: makewhatis.8,v 1.4 1999/07/07 10:50:11 aaron Exp $
+.\" $OpenBSD: makewhatis.8,v 1.5 1999/09/19 23:15:02 alex Exp $
.\" $NetBSD: makewhatis.8,v 1.2.2.1 1997/11/10 19:57:45 thorpej Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
.Nd create a whatis.db database
.Sh SYNOPSIS
.Nm makewhatis
-.Op Ar manpath
+.Op Ar manpath ...
.Sh DESCRIPTION
.Nm
strips the NAME lines from compiled or raw
@@ -60,8 +60,9 @@ If
.Ar manpath
is unspecified,
.Nm
-by default creates a database for
-.Pa /usr/share/man .
+by default creates databases for each directory prefixed by
+the _whatdb keyword in
+.Pa /etc/man.conf .
Man pages compressed with
.Xr compress 1
and
@@ -69,10 +70,6 @@ and
are uncompressed before processing, unformatted man pages
will be processed by
.Xr getNAME 8 .
-.Sh BUGS
-.Nm
-should find its search paths using
-.Pa /etc/man.conf .
.Sh SEE ALSO
.Xr man 1 ,
.Xr man.conf 5 ,
diff --git a/libexec/makewhatis/makewhatis.sh b/libexec/makewhatis/makewhatis.sh
index e8cda8d8232..0b33d93b75a 100644
--- a/libexec/makewhatis/makewhatis.sh
+++ b/libexec/makewhatis/makewhatis.sh
@@ -6,7 +6,7 @@
#
# Public domain.
#
-# $OpenBSD: makewhatis.sh,v 1.6 1997/11/18 06:13:57 millert Exp $
+# $OpenBSD: makewhatis.sh,v 1.7 1999/09/19 23:15:02 alex Exp $
#
PATH=/usr/bin:/bin; export PATH
@@ -19,31 +19,36 @@ WHATIS=`mktemp ${TMPDIR=/tmp}/whatis.XXXXXXXXXX` || {
}
trap "rm -f $LIST $WHATIS; exit 1" 1 2 15
-MANDIR=${1-/usr/share/man}
-if test ! -d "$MANDIR"; then
- echo "makewhatis: $MANDIR: not a directory"
- rm -f $LIST $WHATIS
- exit 1
-fi
+MANDIRS=${*-`perl -ne 'print "$1 " if ( /^_whatdb\s+(.*)\/whatis.db\s*$/ );' \
+ /etc/man.conf`}
+
+for MANDIR in $MANDIRS; do
+ if test ! -d "$MANDIR"; then
+ echo "makewhatis: $MANDIR: not a directory"
+ rm -f $LIST $WHATIS
+ exit 1
+ fi
+
+ find $MANDIR \( -type f -o -type l \) -name '*.[0-9]*' -ls | \
+ sort -n | awk '{if (u[$1]) next; u[$1]++ ; print $11}' > $LIST
+
+ egrep '\.[1-9]$' $LIST | xargs /usr/libexec/getNAME | \
+ sed -e 's/ [a-zA-Z0-9]* \\-/ -/' > $WHATIS
-find $MANDIR \( -type f -o -type l \) -name '*.[0-9]*' -ls | \
- sort -n | awk '{if (u[$1]) next; u[$1]++ ; print $11}' > $LIST
-
-egrep '\.[1-9]$' $LIST | xargs /usr/libexec/getNAME | \
- sed -e 's/ [a-zA-Z0-9]* \\-/ -/' > $WHATIS
+ egrep '\.0$' $LIST | while read file
+ do
+ sed -n -f /usr/share/man/makewhatis.sed $file;
+ done >> $WHATIS
-egrep '\.0$' $LIST | while read file
-do
- sed -n -f /usr/share/man/makewhatis.sed $file;
-done >> $WHATIS
+ egrep '\.[0].(gz|Z)$' $LIST | while read file
+ do
+ gzip -fdc $file | sed -n -f /usr/share/man/makewhatis.sed;
+ done >> $WHATIS
-egrep '\.[0].(gz|Z)$' $LIST | while read file
-do
- gzip -fdc $file | sed -n -f /usr/share/man/makewhatis.sed;
-done >> $WHATIS
+ sort -u -o $WHATIS $WHATIS
-sort -u -o $WHATIS $WHATIS
+ install -o root -g bin -m 444 $WHATIS "$MANDIR/whatis.db"
+done
-install -o root -g bin -m 444 $WHATIS "$MANDIR/whatis.db"
rm -f $LIST $WHATIS
exit 0