postgresql/src/tools/pginclude/pgfixinclude

22 lines
627 B
Plaintext
Raw Normal View History

1999-07-15 22:32:30 +02:00
:
2000-06-15 00:28:16 +02:00
# change #include's to <> or ""
2010-09-20 22:08:53 +02:00
# src/tools/pginclude/pgfixinclude
1999-07-15 22:32:30 +02:00
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
2011-08-27 03:43:34 +02:00
find . \( -name .git -a -prune \) -o -type f -name '*.[chyls]' -print |
1999-07-15 22:32:30 +02:00
while read FILE
do
1999-07-16 00:40:16 +02:00
cat "$FILE" | grep "^#include" |
1999-07-15 22:32:30 +02:00
sed 's/^#include[ ]*[<"]\([^>"]*\).*$/\1/g' |
while read INCLUDE
do
if [ -s /usr/include/"$INCLUDE" ]
then cat "$FILE" |
1999-07-16 00:40:16 +02:00
sed 's;^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]$;#include <'"$INCLUDE"'>;g' >/tmp/$$
1999-07-15 22:32:30 +02:00
else cat "$FILE" |
1999-07-16 00:40:16 +02:00
sed 's;^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]$;#include "'"$INCLUDE"'";g' >/tmp/$$
1999-07-15 22:32:30 +02:00
fi
cat /tmp/$$ > "$FILE"
done
done