--- gcc/fixincludes 2018/04/24 16:42:10 1.1.1.3 +++ gcc/fixincludes 2018/04/24 16:48:31 1.1.1.8 @@ -8,40 +8,53 @@ # Directory in which to store the results. LIB=/usr/local/lib/gcc-include -mkdir ${LIB} -for dir in sys sun sundev sunwindow; do - if [ -d /usr/include/$dir ]; then - mkdir ${LIB}/$dir +mkdir $LIB > /dev/null 2>&1 + +echo 'Finding header files:' +cd /usr/include +files=`find . -type f -print` +echo 'Checking header files:' +for file in $files; do + if egrep -s '[ ]_IO[A-Z]*\(|#define._IO|CTRL' $file; then + echo Fixing $file + if [ -r $file ]; then + cp $file ${LIB}/$file >/dev/null 2>&1 \ + || (mkdir `dirname ${LIB}/$file` \ + && cp $file ${LIB}/$file) \ + || echo "Can't copy $file" + chmod +w ${LIB}/$file + ex ${LIB}/$file </dev/null 2>&1; then + echo Deleting ${LIB}/$file\; no fixes were needed. + rm ${LIB}/$file + fi + fi fi done -cp /usr/include/sys/ioctl.h ${LIB}/sys/ioctl.h -chmod +w ${LIB}/sys/ioctl.h -ex ${LIB}/sys/ioctl.h </dev/null 2>&1 \ + || (mkdir `dirname ${LIB}/$file` \ + && cp $file ${LIB}/$file) \ + || echo "Can't copy $file" chmod +w ${LIB}/$file - ex ${LIB}/$file <