Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ############################################################################## |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 3 | # Copyright 2020,2021 Thomas E. Dickey # |
| 4 | # Copyright 1998,2000 Free Software Foundation, Inc. # |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | # |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 33 | # $Id: tdlint,v 1.8 2021/09/04 15:55:29 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 34 | # |
| 35 | # Lint-script that allows user's own lint libraries, in addition to the ones |
| 36 | # installed in the system. |
| 37 | # |
| 38 | OPT="" |
| 39 | DIRS="" |
| 40 | LIBS="" |
| 41 | FILES="" |
| 42 | ARCH=`uname -s` |
| 43 | if test -z "$ARCH" ; then |
| 44 | echo '? uname not found' |
| 45 | exit 1 |
| 46 | else |
| 47 | case $ARCH in |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 48 | AIX) set - "$@" -Nn4000 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 49 | ;; |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 50 | IRIX) set - "$@" -n -lc |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 51 | ;; |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 52 | FreeBSD) set - "$@" -g -p -u -v -z |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 53 | ;; |
| 54 | SunOS) |
| 55 | case `uname -r` in |
| 56 | 5.*) ARCH=Solaris |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 57 | set - "$@" -n -lc |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 58 | ;; |
| 59 | esac |
| 60 | ;; |
| 61 | esac |
| 62 | fi |
| 63 | # LIBDIR=$HOME/lib/$ARCH/lint ;export LIBDIR |
| 64 | for p in $HOME/lib/$ARCH/lint /usr/lib/lint /usr/lib |
| 65 | do |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 66 | if [ -d "$p" ] |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 67 | then |
| 68 | DIRS="$DIRS $p" |
| 69 | fi |
| 70 | done |
| 71 | # |
| 72 | while [ $# != 0 ] |
| 73 | do |
| 74 | case $1 in |
| 75 | -D*\"*) ;; |
| 76 | -L*) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 77 | DIRS="`echo "$1"|sed -e 's/^-L//'` $DIRS" |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 78 | ;; |
| 79 | -l*) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 80 | lib="llib-l`echo "$1" | sed -e 's/^-l//'`.ln" |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 81 | found=no |
| 82 | for p in $DIRS |
| 83 | do |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 84 | printf "testing %s" "$p/$lib" |
| 85 | if [ -f "$p/$lib" ] |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
| 112 | done |
| 113 | # |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 114 | exec lint $OPT $FILES $LIBS |