#!/bin/sh
# $Header: /tmp_mnt/export/home/devsys4/dickey/com/RCS/lint-unproto,v 1.1 1996/01/13 20:08:39 dickey Exp dickey $
#
# Lint-script that allows user's own lint libraries, in addition to the ones
# installed in the system.
#
OPT=""
DIRS=""
LIBS=""
FILES=""
for p in $HOME/lib/$ARCH/lint /usr/lib/lint /usr/lib
do
	if [ -d $p ]
	then
		DIRS="$DIRS $p"
	fi
done
#
while [ $# != 0 ]
do
	case $1 in
	-L*)
		DIRS="`echo $1|sed -e 's/^-L//'` $DIRS"
		;;
	-l*)
		lib="llib-l`echo $1 | sed -e 's/^-l//'`.ln"
		found=no
		for p in $DIRS
		do
		echo testing $p/$lib
			if [ -f $p/$lib ]
			then
				LIBS="$LIBS $p/$lib"
				found=yes
				break
			fi
		done
		if [ $found = no ]
		then
			echo "ignored library $1"
		fi
		;;
	-n)	if [ -z "$OPT" ]
		then
			OPT="-I."
		fi
		OPT="$OPT $1"
		;;
	-*)	OPT="$OPT $1"
		;;
	*)
		FILES="$FILES $1"
		;;
	esac
	shift
done
#
P=/usr/local/lib/unproto
CC_OPTS="-Qpath $P -I$P"
eval lint $CC_OPTS $OPT $FILES $LIBS
