#!/bin/bash

ALLDEPS=

rechercheDependance()
{
if [[ $# -eq 0 ]]
then
	return
fi
DEPS=
for i in $*
do
	if [[ -e "$i" ]]
	then
		for j in `grep '^#include <' $i | grep '>$' | grep "\.h" | sed -e "s/#include ./\/usr\/include\//g" | sed -e "s/>*//g"`
		do
			RES=`expr \"${ALLDEPS}\" : $j`
			if [[ $RES -eq 0 ]]
			then
				DEPS="$j ${DEPS}"
				ALLDEPS="$j,${ALLDEPS}"
				echo $j
			fi
		done
	fi
#	echo "######### $i #########"
#	echo "$DEPS"
done
rechercheDependance ${DEPS}

}

echo $1
rechercheDependance $*


syntax highlighted by Code2HTML, v. 0.9.1