|
1 | 1 | :
|
2 | 2 | # remove extra #include's
|
3 | 3 |
|
4 |
| -# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.11 2006/07/11 20:12:29 momjian Exp $ |
| 4 | +# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.12 2006/07/11 20:51:25 momjian Exp $ |
5 | 5 |
|
6 | 6 | trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
|
7 | 7 | find . \( -name CVS -a -prune \) -o -type f -name '*.[ch]' -print |
|
|
35 | 35 | # preserve configure-specific includes
|
36 | 36 | # these includes are surrounded by #ifdef's
|
37 | 37 | grep -B1 '^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
|
38 |
| - egrep -q '^#if|^#else' && continue |
| 38 | + egrep -q '^#if|^#else' && continue |
39 | 39 | grep -A1 '^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
|
40 |
| - egrep -q '^#else|^#endif' && continue |
| 40 | + egrep -q '^#else|^#endif' && continue |
41 | 41 |
|
42 | 42 | # set up initial file contents
|
43 | 43 | cat /tmp/$$a |
|
|
61 | 61 | -o /tmp/$$.o >/tmp/$$ 2>&1
|
62 | 62 | if [ "$?" -eq 0 ]
|
63 | 63 | thenecho "$FILE $INCLUDE"
|
| 64 | +if [ "$1" = "-v" ] |
| 65 | +thencat /tmp/$$ |
| 66 | +cat /tmp/$$b |
| 67 | +cat /tmp/$$.c |
| 68 | +fi |
64 | 69 | grep -v '^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]' "$FILE" >/tmp/$$b
|
65 | 70 | mv /tmp/$$b "$FILE"
|
| 71 | +elif [ "$1" = "-v" ] |
| 72 | +thenecho "$FILE" |
66 | 73 | fi
|
67 |
| -if [ "$1" = "-v" ] |
68 |
| -thencat /tmp/$$ |
69 |
| -cat /tmp/$$.c |
70 |
| -fi |
| 74 | + |
71 | 75 | done
|
72 | 76 | done
|