xref: /freebsd/contrib/ncurses/misc/tdlint (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
1#!/bin/sh
2##############################################################################
3# Copyright (c) 1998 Free Software Foundation, Inc.                          #
4#                                                                            #
5# Permission is hereby granted, free of charge, to any person obtaining a    #
6# copy of this software and associated documentation files (the "Software"), #
7# to deal in the Software without restriction, including without limitation  #
8# the rights to use, copy, modify, merge, publish, distribute, distribute    #
9# with modifications, sublicense, and/or sell copies of the Software, and to #
10# permit persons to whom the Software is furnished to do so, subject to the  #
11# following conditions:                                                      #
12#                                                                            #
13# The above copyright notice and this permission notice shall be included in #
14# all copies or substantial portions of the Software.                        #
15#                                                                            #
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
19# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
21# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
22# DEALINGS IN THE SOFTWARE.                                                  #
23#                                                                            #
24# Except as contained in this notice, the name(s) of the above copyright     #
25# holders shall not be used in advertising or otherwise to promote the sale, #
26# use or other dealings in this Software without prior written               #
27# authorization.                                                             #
28##############################################################################
29#
30# Author: Thomas E. Dickey <dickey@clark.net> 1996
31#
32# $Id: tdlint,v 1.4 1998/02/11 12:13:50 tom Exp $
33#
34# Lint-script that allows user's own lint libraries, in addition to the ones
35# installed in the system.
36#
37OPT=""
38DIRS=""
39LIBS=""
40FILES=""
41ARCH=`uname -s`
42if test -z "$ARCH" ; then
43	echo '? uname not found'
44	exit 1
45else
46	case $ARCH in
47	AIX)	set - $* -Nn4000
48		;;
49	IRIX)	set - $* -n -lc
50		;;
51	SunOS)
52		case `uname -r` in
53		5.*)	ARCH=Solaris
54			set - $* -n -lc
55			;;
56		esac
57		;;
58	esac
59fi
60# LIBDIR=$HOME/lib/$ARCH/lint ;export LIBDIR
61for p in $HOME/lib/$ARCH/lint /usr/lib/lint /usr/lib
62do
63	if [ -d $p ]
64	then
65		DIRS="$DIRS $p"
66	fi
67done
68#
69while [ $# != 0 ]
70do
71	case $1 in
72	-D*\"*)	;;
73	-L*)
74		DIRS="`echo $1|sed -e 's/^-L//'` $DIRS"
75		;;
76	-l*)
77		lib="llib-l`echo $1 | sed -e 's/^-l//'`.ln"
78		found=no
79		for p in $DIRS
80		do
81			echo -n testing $p/$lib
82			if [ -f $p/$lib ]
83			then
84				LIBS="$LIBS $p/$lib"
85				echo " (ok)"
86				found=yes
87				break
88			fi
89			echo
90		done
91		if [ $found = no ]
92		then
93			echo "ignored library $1"
94		fi
95		;;
96	-n)	if [ -z "$OPT" ]
97		then
98			OPT="-I."
99		fi
100		OPT="$OPT $1"
101		;;
102	-*)	OPT="$OPT $1"
103		;;
104	*)
105		FILES="$FILES $1"
106		;;
107	esac
108	shift
109done
110#
111eval lint $OPT $FILES $LIBS
112