#!/bin/sh
# This is a demo of how easy it is to emulate other systems' help commands.
H=0
O=''
S=''
if [ $# -lt 1 ];then
	echo "If you know the chapter and name of a help topic, you may type:"
	echo "	help chapter name(s)"
	echo "You may omit the chapter, and you will get the entries from any"
	echo "chapter(s) that contain the topic(s).  If you would like a list"
	echo "of the topics in chapter N, type:"
	echo "	help N"
	echo "To scan the manuals for keywords, type:"
	echo "	help on topic(s)"
	echo "The chapters are:"
	echo "	1	Commands."
	echo "	2	System calls."
	echo "	3	Functions."
	echo "	4	Special files."
	echo "	5	File formats."
	echo "	6	Games."
	echo "	7	Macro packages and conventions."
	echo "	8	Maintenance."
	echo "	l	Local additions."
	exit 1
fi
for x
do	case $x in
	  [1-8l])	S=$x;;
		  -*)	O=$O $x;;
		  re)	O='-k';;
		  on)	O='-k';;
		   *)	man $O $S $x
				H=`expr $H + 1`;;
	esac
done
if [ $H -lt 1 ];then
	cd /usr/man/man$S
	ls -C | sed -e "s'\.[0-9a-zA-Z]*[ 	]*'	'g"
fi
