]> ncurses.scripts.mit.edu Git - ncurses.git/blob - misc/tdlint
287b8e1c163ad398acd1cf9b733cb2c14cf503cc
[ncurses.git] / misc / tdlint
1 #!/bin/sh
2 ################################################################################
3 # Copyright 1996 by Thomas E. Dickey <dickey@clark.net>                        #
4 # All Rights Reserved.                                                         #
5 #                                                                              #
6 # Permission to use, copy, modify, and distribute this software and its        #
7 # documentation for any purpose and without fee is hereby granted, provided    #
8 # that the above copyright notice appear in all copies and that both that      #
9 # copyright notice and this permission notice appear in supporting             #
10 # documentation, and that the name of the above listed copyright holder(s) not #
11 # be used in advertising or publicity pertaining to distribution of the        #
12 # software without specific, written prior permission. THE ABOVE LISTED        #
13 # COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,    #
14 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
15 # SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL,        #
16 # INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM   #
17 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE   #
18 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR    #
19 # PERFORMANCE OF THIS SOFTWARE.                                                #
20 ################################################################################
21 # $Id: tdlint,v 1.3 1996/07/15 00:47:21 tom Exp $
22 #
23 # Lint-script that allows user's own lint libraries, in addition to the ones
24 # installed in the system.
25 #
26 OPT=""
27 DIRS=""
28 LIBS=""
29 FILES=""
30 ARCH=`uname -s`
31 if test -z "$ARCH" ; then
32         echo '? uname not found'
33         exit 1
34 else
35         case $ARCH in
36         AIX)    set - $* -Nn4000
37                 ;;
38         IRIX)   set - $* -n -lc
39                 ;;
40         SunOS)
41                 case `uname -r` in
42                 5.*)    ARCH=Solaris
43                         set - $* -n -lc
44                         ;;
45                 esac
46                 ;;
47         esac
48 fi
49 # LIBDIR=$HOME/lib/$ARCH/lint ;export LIBDIR
50 for p in $HOME/lib/$ARCH/lint /usr/lib/lint /usr/lib
51 do
52         if [ -d $p ]
53         then
54                 DIRS="$DIRS $p"
55         fi
56 done
57 #
58 while [ $# != 0 ]
59 do
60         case $1 in
61         -D*\"*) ;;
62         -L*)
63                 DIRS="`echo $1|sed -e 's/^-L//'` $DIRS"
64                 ;;
65         -l*)
66                 lib="llib-l`echo $1 | sed -e 's/^-l//'`.ln"
67                 found=no
68                 for p in $DIRS
69                 do
70                         echo -n testing $p/$lib
71                         if [ -f $p/$lib ]
72                         then
73                                 LIBS="$LIBS $p/$lib"
74                                 echo " (ok)"
75                                 found=yes
76                                 break
77                         fi
78                         echo
79                 done
80                 if [ $found = no ]
81                 then
82                         echo "ignored library $1"
83                 fi
84                 ;;
85         -n)     if [ -z "$OPT" ]
86                 then
87                         OPT="-I."
88                 fi
89                 OPT="$OPT $1"
90                 ;;
91         -*)     OPT="$OPT $1"
92                 ;;
93         *)
94                 FILES="$FILES $1"
95                 ;;
96         esac
97         shift
98 done
99 #
100 eval lint $OPT $FILES $LIBS