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