This script is obsolete, the new one is here.

#!/bin/ksh

inputfile=$1
stdinc=`grep '#.*include.*<.*>' $inputfile | sed 's/[^<]*<//' | sed 's/>[^>]*//'`
nstinc=`grep '#.*include.*".*"' $inputfile | sed 's/[^"]*"//' | sed 's/"[^"]*//'`

isStandard()
{
    if [[ ( -f /usr/include/$1 ) ||
                ( -f /usr/include/g3/$1 ) ||
                ( -f /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/$1 ) ]] then
        echo 1
    else
        echo 0
    fi
}

for f in $stdinc
do
    if [[ `isStandard $f` -eq 0 ]] then
        echo "cannot find standard $f ($inputfile)"
    fi
done

for f in $nstinc
do
    if [[ `isStandard $f` -eq 1 ]] then
        echo "cannot find non-standard $f ($inputfile)"
    fi
done