[comp.sources.misc] v14i032: Apropos for SGI Iris workstations

root@naucse.cse.nau.edu (Paul Balyoz) (07/27/90)

Posting-number: Volume 14, Issue 32
Submitted-by: root@naucse.cse.nau.edu (Paul Balyoz)
Archive-name: apropos-sgi/part01

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README Makefile apropos makewhatis
# Wrapped by root@naucse.cse.nau.edu on Sun Jul 22 16:47:21 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1774 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
X
X				APROPOS
X
X		   A keyword lookup system for man-pages
X
X
XThis software distribution contains two programs that are a nice addition
Xto the existing on-line help system for the IRIX operating system used on
XSGI IRIS 4D workstations.  The concept of "apropos" is similar to that of
XBerkeley Unix operating systems.
X
X
Xmakewhatis		Usage:   makewhatis		(sysadmin access only)
X
X		Collect the header lines of all man-pages into one big
X		database file called "whatis".  This must be run once
X		before the apropos command will work.  Rerun it each time
X		you install new manual pages, or just tell cron to run it
X		every night, or every few days.
X
X
Xapropos			Usage:   apropos keyword	(general user access)
X
X		Search the "whatis" database file for a keyword or string.
X		Case insensitive (see "grep" command used internally.)
X		You will probably want to alias this to something like "ap",
X		since "apropos" is not easy to remember.
X
X
XThe "whatis" database should take up no more than 100K on an average Iris.
XIt is left uncompressed so that searching it will be speedy.  As distributed,
Xboth programs try to find the "whatis" file in /usr/local/lib, but this
Xcan be changed.
X
XThe programs are Bourne Shell scripts which were written from scratch by me,
Xand have been placed in the public domain.  You may copy them, use them,
Xand give them to anyone who wants it.  Just be sure to pass along the entire
Xpackage including both programs, the Makefile, and this README text file.
X
XThis software has been tested on IRIS hardware:
X	Personal Iris [4D20], Personal Iris [4D25GT/Turbo]
X
XThis software has been tested on IRIX versions:
X	3.2, 3.2.1, 3.2.3
X
XPlease send any comments, bug reports, corrections, and porting info to:
X	Internet:	pab@naucse.cse.nau.edu
X	UUCP:		arizona!naucse!pab
END_OF_FILE
if test 1774 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(755 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#
X# Makefile for APROPOS command for SGI IRIS 4D series workstations.
X#		By: Paul Balyoz   [pab@naucse.cse.nau.edu]
X#
X
X# Where these shell scripts should go.  The DESTROOT variable can be set
X# on the make command-line to be the root directory of other NFS clients.
XBIN=${DESTROOT}/usr/local/bin
X
Xall:
X	@echo 'All shell scripts; no building required.'
X	@echo 'See Makefile, then type "make install".'
X
Xinstall:
X	cp apropos ${BIN}
X	chmod 755 ${BIN}/apropos
X	chown bin ${BIN}/apropos
X	chgrp bin ${BIN}/apropos
X	cp makewhatis ${BIN}
X	chmod 755 ${BIN}/makewhatis
X	chown bin ${BIN}/makewhatis
X	chgrp bin ${BIN}/makewhatis
X	@echo 'Now that everything is installed, you should build the whatis'
X	@echo 'database by running makewhatis before trying out apropos.'
END_OF_FILE
if test 755 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'apropos' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'apropos'\"
else
echo shar: Extracting \"'apropos'\" \(293 characters\)
sed "s/^X//" >'apropos' <<'END_OF_FILE'
X#!/bin/sh
X#	Apropos - search a database of man-page headers for keywords
X#			Paul Balyoz   5/9/90
X#
XPATH=/usr/bin:/bin
X
XDATABASE=/usr/local/lib/whatis
X
Xif test $# -ne 1; then
X	echo "usage: apropos keyword" 1>&2
X	exit 1
Xfi
X
Xgrep -i "$1" $DATABASE  || echo "$1: nothing appropriate" 1>&2
Xexit 0
END_OF_FILE
if test 293 -ne `wc -c <'apropos'`; then
    echo shar: \"'apropos'\" unpacked with wrong size!
fi
chmod +x 'apropos'
# end of 'apropos'
fi
if test -f 'makewhatis' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makewhatis'\"
else
echo shar: Extracting \"'makewhatis'\" \(653 characters\)
sed "s/^X//" >'makewhatis' <<'END_OF_FILE'
X#!/bin/sh
X#	makewhatis - Build the whatis database of manpage headers
X#			Paul Balyoz   5/9/90
X#
XPATH=/usr/bsd:/usr/bin:/bin
X
XCATMAN=/usr/catman
X
XDATABASE=/usr/local/lib/whatis
XOWNER=bin
XGROUP=bin
XMODE=644
X
XTMP=/usr/tmp/whatis$$
X
Xecho > $TMP
Xfor i in `find $CATMAN -type d -print`; do
X	cd $i
X	SECT=`echo $i | sed -e 's/^.*\(.\)$/\1/'`
X	for j in *.z; do
X		pcat $j 2> /dev/null | grep '^     .* - .*$' | head -1 | sed -e "s/ - /(${SECT}) - /" >> $TMP
X	done
Xdone
X
Xsort $TMP | uniq | sed -e 's/^.....//' > $DATABASE.new
Xchown $OWNER $DATABASE.new
Xchgrp $GROUP $DATABASE.new
Xchmod $MODE $DATABASE.new
Xrm $DATABASE
Xmv $DATABASE.new $DATABASE
X
Xrm $TMP
X
Xexit 0
END_OF_FILE
if test 653 -ne `wc -c <'makewhatis'`; then
    echo shar: \"'makewhatis'\" unpacked with wrong size!
fi
chmod +x 'makewhatis'
# end of 'makewhatis'
fi
echo shar: End of shell archive.
exit 0