#/bin/sh
#
# 1999-02-02 -	This silly script, which should always be called
#		with exactly two arguments ($1 and $2), lists all
#		C source files in the current directory that call
#		the function $1 WITHOUT also including $2. This
#		is intended to help me #include <stdlib.h>. :)
#

ME=`basename $0`

if ! [ $# = '2' ]; then
	echo "  Usage: $ME FUNCTION DEFINITION"
	echo "Example: $ME malloc stdlib will list all C files that"
	echo "         contain calls to malloc without including stdlib.h."
	echo "(Written in February 1999 by Emil Brink, for gentoo)."
	exit
fi

grep -e "$1" *.c | cut -f 1 -d : | sort | uniq | xargs -n 1 grep -L $2\.h
