######
#
#		Copyright (c) 1984,1988 AT&T
#		  All Rights Reserved
#
#
#	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
#	The copyright notice above does not evidence any actual
#	or intended publication of such source code.
#
#
# ORIGINAL:SCCS @(#)man.sh	1.1
# MODIFIED:SCCS @(#)lman.sh	1.1
#
#ident "@(#)/usr/local/lman 1.0 03/28/90" Modifying Author: Milton Turner
# Office: HQ ATC/SCDAA, Randolph AFB, Texas 78150
# Phone: AV 487-8649  Comm: (512) 652-8649
#
#help# the man command MODIFIED TO WORK FROM files in current directory, 
#help# see also lprettyman. This is useful in troff formatted docs within
#help# a special directory, not the /usr/man area most commonly used.

BASE="."

fil=
sec=
TROFF=

#  parse options

if [ $# -eq 0 ]
then
  echo "No manual page title specified." >&2
  echo "Usage: man [-troff] [section] titles" >&2
  exit 1
fi

# See if the output is being sent to a printer capable
# of handling troff output
if [ "$1" = "-troff" ]
then
  TROFF=y
  shift
fi

case $1 in
  1|1a|1c|1g|fsd|[234578]|3c|3f|3m|3n|3s|3x)
  sec=$1
  shift ;;
esac

if [ $# -eq 0 ]
then
  echo "No manual page title specified." >&2
  exit 1
fi


# now print the pages

for i in $*
do
  if [ "$TROFF" = "y" ]
  then
    eval eqn $i | pic | tbl | troff -man -Tnrlj -rN2
  else
    eval "tbl $i | nroff -man | col -x"
  fi
done
