[net.sources] nicer lint output for cheap

day@kovacs.UUCP (Dave Yost) (09/30/85)

If you have old-style lint (v7, 4.2bsd), you may have
noticed as I have that the output from pass2 is a
jumble.  After years of living with this, it dawned on
me that I could fix it without source.  I modified the
/usr/bin/lint shell script to run pass2 through a new
filter called lint3 (which is also a shell script).
And here they are now:

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# usr/bin/lint usr/lib/lint/lint3

echo x - usr/bin/lint
cat > "usr/bin/lint" << '//E*O*F usr/bin/lint//'
#! /bin/sh
#
#	@(#)SHELL	1.5	(Berkeley)	4/9/83
#       $(@)modified to do lint3 fixup pass -- d yost 8/1/85
#
L=/usr/lib/lint/lint T=/usr/tmp/lint.$$ PATH=/bin:/usr/bin O="-C -Dlint"
X= P=unix LL=/usr/lib/lint C= W=fixup
trap "rm -f $T ${T}2 ${T}3 ; exit" 1 2 15
for A in $*
do
	case $A in
	-*n*)	P= ;;
	-*p*)	P=port ;;
	esac
	case $A in
	*.ln)	cat $A >>$T ;;
	-l*)	cat $LL/llib$A.ln >>$T ;;
	-C?*)   W=-C P= C=`echo $A | sed -e s/-C/llib-l/` ; X="$X -L -C$C" ;;
	-[IDOU]*)	O="$O $A" ;;
#	-X)	LL=/usr/scj/lint L=/usr/scj/lint/lpass ;;
	-X)	LL=/usr/src/usr.bin/lint L=/usr/src/usr.bin/lint/lpass ;;
	-F)     W=normal ;;
	-*)	X="$X $A" ;;
	*)	echo "$A:" ; (/lib/cpp $O $A | ${L}1 $X >>$T)2>&1
	esac
	done
case $P in
	unix)	cat $LL/llib-lc.ln >>$T ;;
	port)	cat $LL/llib-port.ln >>$T ;;
	"")	cat /dev/null >>$T ;;
	esac
case $W in
	fixup)  ${L}2 $T $X > ${T}2 ; ${L}3 ${T}2 ${T}3 ;;
	-C)     cp $T $C.ln ;;
	*)      ${L}2 $T $X ;;
	esac
rm -f $T ${T}2 ${T}3
//E*O*F usr/bin/lint//

echo x - usr/lib/lint/lint3
cat > "usr/lib/lint/lint3" << '//E*O*F usr/lib/lint/lint3//'
#!/bin/sh
#
# fixup pre-sys3 lint output -- Dave Yost <hollywood!day> 8/1/85
#
TMP=$2
fgrep -v 'multiply declared
used inconsistently
variable # of args
value declared inconsistently
value is used, but none returned
always ignored
sometimes ignored
but not defined
but never used' $1

fgrep 'multiply declared
used inconsistently
variable # of args
value declared inconsistently
value is used, but none returned
always ignored
sometimes ignored
but not defined
but never used' $1 > $TMP

echo
if fgrep 'multiply declared'                 $TMP | sort ; then echo ; fi
if fgrep 'used inconsistently'               $TMP | sort ; then echo ; fi
if fgrep 'variable # of args'                $TMP | sort ; then echo ; fi
if fgrep 'value declared inconsistently'     $TMP | sort ; then echo ; fi
if fgrep 'value is used, but none returned'  $TMP | sort ; then echo ; fi
if fgrep 'always ignored'                    $TMP | sort ; then echo ; fi
if fgrep 'sometimes ignored'                 $TMP | sort ; then echo ; fi
if fgrep 'but not defined'                   $TMP | sort ; then echo ; fi
   fgrep 'but never used'                    $TMP | sort ;
//E*O*F usr/lib/lint/lint3//

exit 0