#!/bin/sh

# find redundant #include directives in *.c and *.h
# conditional includes are not considered

find . -type f -name '*.[ch]' -print | while read file
do
	result=`grep '^#include' $file | sort | uniq -c | grep -v ' 1 '`
	if [ "$result" ]; then
		echo "$file"
		echo "$result"
	fi
done
