#!/bin/sh

if [ $# = 0 ]
then
	echo "Usage: $0 path ..." >&2
	exit 1
fi

srchlib=libmytinfo

for i in "$@"
do
	printed=0
	for j in `find "$i" -type f \( -perm -2000 -o -perm -4000 \)`
	do
		ldd -f '%a|%o\n' 2>/dev/null| (
			IFS='|'
			while read file library
			do
				case $library in
				$srchlib.*)
					echo $file
					printed=1
					;;
				esac
			done
		)
		test $printed = 0 &&
			grep '@(#) mytinfo' $j > /dev/null &&
			echo "$j (STATIC)"
	done
done
