From 2c859c527acc0bb0a64f54253dd102538bc2547b Mon Sep 17 00:00:00 2001 From: wosch Date: Sun, 10 Mar 1996 18:52:33 +0000 Subject: share the code between apropos and whatis --- gnu/usr.bin/man/apropos/Makefile | 5 ++- gnu/usr.bin/man/apropos/apropos.man | 14 +++++--- gnu/usr.bin/man/apropos/apropos.sh | 8 ++++- gnu/usr.bin/man/whatis/Makefile | 6 ---- gnu/usr.bin/man/whatis/whatis.man | 27 --------------- gnu/usr.bin/man/whatis/whatis.sh | 66 ------------------------------------- 6 files changed, 21 insertions(+), 105 deletions(-) delete mode 100644 gnu/usr.bin/man/whatis/Makefile delete mode 100644 gnu/usr.bin/man/whatis/whatis.man delete mode 100644 gnu/usr.bin/man/whatis/whatis.sh (limited to 'gnu') diff --git a/gnu/usr.bin/man/apropos/Makefile b/gnu/usr.bin/man/apropos/Makefile index 0e986bb..c109d3c 100644 --- a/gnu/usr.bin/man/apropos/Makefile +++ b/gnu/usr.bin/man/apropos/Makefile @@ -1,6 +1,9 @@ -# $Id: Makefile,v 1.9 1995/07/25 00:33:07 bde Exp $ +# $Id: Makefile,v 1.1 1996/03/09 17:31:08 wosch Exp wosch $ SHPROG= apropos +MLINKS= apropos.1 whatis.1 +LINKS= ${BINDIR}/apropos ${BINDIR}/whatis + .include "../../Makefile.inc" .include "../Makefile.shprog" diff --git a/gnu/usr.bin/man/apropos/apropos.man b/gnu/usr.bin/man/apropos/apropos.man index 3bb3e17..62b7d7a 100644 --- a/gnu/usr.bin/man/apropos/apropos.man +++ b/gnu/usr.bin/man/apropos/apropos.man @@ -1,4 +1,4 @@ -.\" Man page for apropos +.\" Man page for apropos an whatis .\" .\" Copyright (c) 1990, 1991, John W. Eaton. .\" @@ -15,13 +15,19 @@ .TH apropos 1 "Jan 15, 1991" .LO 1 .SH NAME -apropos \- search the whatis database for strings +apropos, whatis \- search the whatis database .SH SYNOPSIS .BI apropos keyword ... + +.BI whatis +keyword ... .SH DESCRIPTION -apropos searches a set of database files containing short descriptions +.B apropos +searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. +.B whatis +display only complete word matches. .SH "SEE ALSO" -whatis(1), man(1). +man(1), makewhatis(1). diff --git a/gnu/usr.bin/man/apropos/apropos.sh b/gnu/usr.bin/man/apropos/apropos.sh index ed2f3f8..cb26c20 100644 --- a/gnu/usr.bin/man/apropos/apropos.sh +++ b/gnu/usr.bin/man/apropos/apropos.sh @@ -21,6 +21,7 @@ PATH=/bin:/usr/bin:$PATH db=whatis # name of whatis data base +grepopt='' # argument test case $# in 0) @@ -29,6 +30,11 @@ case $# in 0) ;; esac +case "$0" in + *whatis) grepopt='-w';; # run as whatis(1) + *) grepopt='';; # otherwise run as apropos(1) +esac + # test manpath manpath=`%bindir%/manpath -q | tr : '\040'` case X"$manpath" in X) @@ -62,7 +68,7 @@ esac for manpage do - if grep -hi "$manpage" $mandir; then : + if grep -hi $grepopt "$manpage" $mandir; then : else echo "$manpage: nothing appropriate" fi diff --git a/gnu/usr.bin/man/whatis/Makefile b/gnu/usr.bin/man/whatis/Makefile deleted file mode 100644 index 6fb62a2..0000000 --- a/gnu/usr.bin/man/whatis/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -SHPROG= whatis - -.include "../../Makefile.inc" -.include "../Makefile.shprog" diff --git a/gnu/usr.bin/man/whatis/whatis.man b/gnu/usr.bin/man/whatis/whatis.man deleted file mode 100644 index 9e5528d..0000000 --- a/gnu/usr.bin/man/whatis/whatis.man +++ /dev/null @@ -1,27 +0,0 @@ -.\" Man page for whatis -.\" -.\" 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 1.0 -.\" distribution. -.\" -.\" John W. Eaton -.\" jwe@che.utexas.edu -.\" Department of Chemical Engineering -.\" The University of Texas at Austin -.\" Austin, Texas 78712 -.\" -.TH whatis 1 "Jan 5, 1991" -.LO 1 -.SH NAME -whatis \- search the whatis database for complete words. -.SH SYNOPSIS -.BI whatis -keyword ... -.SH DESCRIPTION -whatis searches a set of database files containing short descriptions -of system commands for keywords and displays the result on the -standard output. Only complete word matches are displayed. -.SH "SEE ALSO" -apropos(1), man(1). diff --git a/gnu/usr.bin/man/whatis/whatis.sh b/gnu/usr.bin/man/whatis/whatis.sh deleted file mode 100644 index 34abaaa..0000000 --- a/gnu/usr.bin/man/whatis/whatis.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# -# whatis -- search the whatis database for keywords. Like apropos, -# but match only commands (as whole words). -# -# 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` name ..." - 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 -iw "^$1" $d/whatis - status=$? - if [ "$status" = "0" ] - then - found=1 - export found; - fi - fi - done - - if [ "$found" = "0" ] - then - echo "$1: nothing appropriate" - fi - - shift -done | $PAGER - -exit -- cgit v1.1