summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/man/apropos/apropos.sh
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1993-07-07 23:07:02 +0000
committerjkh <jkh@FreeBSD.org>1993-07-07 23:07:02 +0000
commit73606c73729da848d3173c01390dc2a78d2997e1 (patch)
treebe8b89723d6c423c5cae81f73a3ff71296581e51 /gnu/usr.bin/man/apropos/apropos.sh
downloadFreeBSD-src-73606c73729da848d3173c01390dc2a78d2997e1.zip
FreeBSD-src-73606c73729da848d3173c01390dc2a78d2997e1.tar.gz
Newer new man page reader.
Diffstat (limited to 'gnu/usr.bin/man/apropos/apropos.sh')
-rw-r--r--gnu/usr.bin/man/apropos/apropos.sh64
1 files changed, 64 insertions, 0 deletions
diff --git a/gnu/usr.bin/man/apropos/apropos.sh b/gnu/usr.bin/man/apropos/apropos.sh
new file mode 100644
index 0000000..070b848
--- /dev/null
+++ b/gnu/usr.bin/man/apropos/apropos.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# apropos -- search the whatis database for keywords.
+#
+# Copyright (c) 1990, 1991, John W. Eaton.
+#
+# You may distribute under the terms of the GNU General Public
+# License as specified in the README file that comes with the man
+# distribution.
+#
+# John W. Eaton
+# jwe@che.utexas.edu
+# Department of Chemical Engineering
+# The University of Texas at Austin
+# Austin, Texas 78712
+
+PATH=/usr/local/bin:/bin:/usr/ucb:/usr/bin
+
+libdir=%libdir%
+
+if [ $# = 0 ]
+then
+ echo "usage: `basename $0` keyword ..."
+ exit 1
+fi
+
+manpath=`%bindir%/manpath -q | tr : '\040'`
+
+if [ "$manpath" = "" ]
+then
+ echo "whatis: manpath is null"
+ exit 1
+fi
+
+if [ "$PAGER" = "" ]
+then
+ PAGER="%pager%"
+fi
+
+while [ $1 ]
+do
+ found=0
+ for d in $manpath /usr/lib
+ do
+ if [ -f $d/whatis ]
+ then
+ grep -i "$1" $d/whatis
+ status=$?
+ if [ "$status" = "0" ]
+ then
+ found=1
+ fi
+ fi
+ done
+
+ if [ "$found" = "0" ]
+ then
+ echo "$1: nothing appropriate"
+ fi
+
+ shift
+done | $PAGER
+
+exit
OpenPOWER on IntegriCloud