~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/tools/pginclude/pgfixinclude

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
:
 
2
# change #include's to <> or ""
 
3
 
 
4
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
 
5
find . \( -name CVS -a -prune \) -o -type f -print |
 
6
while read FILE
 
7
do
 
8
        cat "$FILE" | grep "^#include" |
 
9
        sed 's/^#include[       ]*[<"]\([^>"]*\).*$/\1/g' |
 
10
        while read INCLUDE
 
11
        do
 
12
                if [ -s /usr/include/"$INCLUDE" ]
 
13
                then    cat "$FILE" |
 
14
                        sed 's;^#include[       ][      ]*[<"]'"$INCLUDE"'[>"]$;#include <'"$INCLUDE"'>;g' >/tmp/$$
 
15
                else    cat "$FILE" |
 
16
                        sed 's;^#include[       ][      ]*[<"]'"$INCLUDE"'[>"]$;#include "'"$INCLUDE"'";g' >/tmp/$$
 
17
                fi
 
18
                cat /tmp/$$ > "$FILE"
 
19
        done
 
20
done