150276Speter#!/bin/sh
250276Speter##############################################################################
350276Speter# Copyright (c) 1998 Free Software Foundation, Inc.                          #
450276Speter#                                                                            #
550276Speter# Permission is hereby granted, free of charge, to any person obtaining a    #
650276Speter# copy of this software and associated documentation files (the "Software"), #
750276Speter# to deal in the Software without restriction, including without limitation  #
850276Speter# the rights to use, copy, modify, merge, publish, distribute, distribute    #
950276Speter# with modifications, sublicense, and/or sell copies of the Software, and to #
1050276Speter# permit persons to whom the Software is furnished to do so, subject to the  #
1150276Speter# following conditions:                                                      #
1250276Speter#                                                                            #
1350276Speter# The above copyright notice and this permission notice shall be included in #
1450276Speter# all copies or substantial portions of the Software.                        #
1550276Speter#                                                                            #
1650276Speter# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
1750276Speter# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
1850276Speter# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
1950276Speter# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
2050276Speter# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
2150276Speter# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
2250276Speter# DEALINGS IN THE SOFTWARE.                                                  #
2350276Speter#                                                                            #
2450276Speter# Except as contained in this notice, the name(s) of the above copyright     #
2550276Speter# holders shall not be used in advertising or otherwise to promote the sale, #
2650276Speter# use or other dealings in this Software without prior written               #
2750276Speter# authorization.                                                             #
2850276Speter##############################################################################
2950276Speter#
3050276Speter# Author: Thomas E. Dickey <dickey@clark.net> 1996
3150276Speter#
3276726Speter# $Id: tdlint,v 1.5 2000/10/28 20:53:36 tom Exp $
3350276Speter#
3450276Speter# Lint-script that allows user's own lint libraries, in addition to the ones
3550276Speter# installed in the system.
3650276Speter#
3750276SpeterOPT=""
3850276SpeterDIRS=""
3950276SpeterLIBS=""
4050276SpeterFILES=""
4150276SpeterARCH=`uname -s`
4250276Speterif test -z "$ARCH" ; then
4350276Speter	echo '? uname not found'
4450276Speter	exit 1
4550276Speterelse
4650276Speter	case $ARCH in
4750276Speter	AIX)	set - $* -Nn4000
4850276Speter		;;
4950276Speter	IRIX)	set - $* -n -lc
5050276Speter		;;
5176726Speter	FreeBSD) set - $* -g -p -u -v -z
5276726Speter		;;
5350276Speter	SunOS)
5450276Speter		case `uname -r` in
5550276Speter		5.*)	ARCH=Solaris
5650276Speter			set - $* -n -lc
5750276Speter			;;
5850276Speter		esac
5950276Speter		;;
6050276Speter	esac
6150276Speterfi
6250276Speter# LIBDIR=$HOME/lib/$ARCH/lint ;export LIBDIR
6350276Speterfor p in $HOME/lib/$ARCH/lint /usr/lib/lint /usr/lib
6450276Speterdo
6550276Speter	if [ -d $p ]
6650276Speter	then
6750276Speter		DIRS="$DIRS $p"
6850276Speter	fi
6950276Speterdone
7050276Speter#
7150276Speterwhile [ $# != 0 ]
7250276Speterdo
7350276Speter	case $1 in
7450276Speter	-D*\"*)	;;
7550276Speter	-L*)
7650276Speter		DIRS="`echo $1|sed -e 's/^-L//'` $DIRS"
7750276Speter		;;
7850276Speter	-l*)
7950276Speter		lib="llib-l`echo $1 | sed -e 's/^-l//'`.ln"
8050276Speter		found=no
8150276Speter		for p in $DIRS
8250276Speter		do
8350276Speter			echo -n testing $p/$lib
8450276Speter			if [ -f $p/$lib ]
8550276Speter			then
8650276Speter				LIBS="$LIBS $p/$lib"
8750276Speter				echo " (ok)"
8850276Speter				found=yes
8950276Speter				break
9050276Speter			fi
9150276Speter			echo
9250276Speter		done
9350276Speter		if [ $found = no ]
9450276Speter		then
9550276Speter			echo "ignored library $1"
9650276Speter		fi
9750276Speter		;;
9850276Speter	-n)	if [ -z "$OPT" ]
9950276Speter		then
10050276Speter			OPT="-I."
10150276Speter		fi
10250276Speter		OPT="$OPT $1"
10350276Speter		;;
10450276Speter	-*)	OPT="$OPT $1"
10550276Speter		;;
10650276Speter	*)
10750276Speter		FILES="$FILES $1"
10850276Speter		;;
10950276Speter	esac
11050276Speter	shift
11150276Speterdone
11250276Speter#
11350276Spetereval lint $OPT $FILES $LIBS
114