:
#
#	%Z% %M% %I% %D% %Q%
#
#	Copyright (C) Microsoft Corporation, 1983
#
#	This Module contains Proprietary Information of Microsoft
#	Corporation and AT&T, and should be treated as Confidential.
#
T=/usr/tmp/lint.$$				#intermediate file
H=/usr/tmp/hlint$$				#header buffer file
L=/usr/lib	LL=/usr/lib			#directories
PATH=/bin:/usr/bin 
O="-E -C -Dlint"  X=  P=xenix			#default parameters
trap "rm -f $T $H; exit" 0 1 2 3 15		#trap on exit

set --  `getopt abchl:npuvxI:D:U: $*`

if [ $? != 0 ]
then
	echo "Usage: lint -abchnpuvxIDUl [library]"
	exit 2
fi
				
while test -n "$1"				 #process arguments
do
	case $1 in
	-[IDU]) O="$O $1$2"; shift;; 		#option(s) for C preprocessor
	-l)	cat $LL/llib$2.ln >>$T; shift ;;  # '-l ' param specified
	-*n*)	P=""  X="$X$1" ;; 		# '-n' option specified
	-*p*)	P="port"  X="$X$1" ;;		# '-p' option specified
	--)	shift; break;;
	-*)	X="$X$1" ;;			#other lint parameter(s)
	esac
	shift
done

while test -n "$1"
do
	(/bin/cc $O $1 | $L/lint1 $X -H$H $1 >>$T)2>&1
					#feed file through preprocessor
					#then through lint first pass
					#note that file name is passed
					#to lint1 as an argument
	shift
done

case $P in					#select appropriate library
	xenix)	cat $LL/llibc.ln >>$T ;;
	port)	cat $LL/llibport.ln >>$T ;;
esac

if [ -s $H ]
then
	$L/lint2 -T$T $X -H$H			#lint second pass
fi
