Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99ac1e6

Browse files
committed
Fix pgrminclude to work for stripping include files.
1 parentde7e81f commit99ac1e6

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

‎src/tools/pginclude/pgrminclude

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:
22
# remove extra #include's
33

4-
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.12 2006/07/11 20:51:25 momjian Exp $
4+
# $PostgreSQL: pgsql/src/tools/pginclude/pgrminclude,v 1.13 2006/07/12 16:28:27 momjian Exp $
55

66
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
77
find . \( -name CVS -a -prune \) -o -type f -name '*.[ch]' -print |
@@ -15,18 +15,15 @@ do
1515
elseIS_INCLUDE="N"
1616
fi
1717

18-
# remove defines
19-
if [ "$IS_INCLUDE" = "Y" ]
20-
thencat "$FILE" | grep -v "^#if" | grep -v "^#else" |
21-
grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
22-
elsecat "$FILE" >/tmp/$$a
23-
fi
24-
2518
# loop through all includes
26-
cat/tmp/$$a | grep "^#include" |
19+
cat"$FILE" | grep "^#include" |
2720
sed 's/^#include[ ]*[<"]\([^>"]*\).*$/\1/g' |
2821
while read INCLUDE
2922
do
23+
if [ "$1" = "-v" ]
24+
thenecho "checking $FILE $INCLUDE"
25+
fi
26+
3027
[ -s /usr/include/$INCLUDE ] && continue
3128
[ "$INCLUDE" = postgres.h ] && continue
3229
[ "$INCLUDE" = config.h ] && continue
@@ -39,9 +36,17 @@ do
3936
grep -A1 '^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]' "$FILE" |
4037
egrep -q '^#else|^#endif' && continue
4138

39+
# remove defines from include files
40+
if [ "$IS_INCLUDE" = "Y" ]
41+
thencat "$FILE" | grep -v "^#if" | grep -v "^#else" |
42+
grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
43+
elsecat "$FILE" >/tmp/$$a
44+
fi
45+
4246
# set up initial file contents
43-
cat /tmp/$$a |
44-
grep -v '^#include[ ]*[<"]'"$INCLUDE"'[>"]' >/tmp/$$b
47+
grep -v '^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]' \
48+
/tmp/$$a >/tmp/$$b
49+
4550
if [ "$IS_INCLUDE" = "Y" ]
4651
thenecho "#include \"postgres.h\"" >/tmp/$$.c
4752
else>/tmp/$$.c
@@ -66,11 +71,7 @@ do
6671
cat /tmp/$$b
6772
cat /tmp/$$.c
6873
fi
69-
grep -v '^#include[ ][ ]*[<"]'"$INCLUDE"'[>"]' "$FILE" >/tmp/$$b
7074
mv /tmp/$$b "$FILE"
71-
elif [ "$1" = "-v" ]
72-
thenecho "$FILE"
7375
fi
74-
7576
done
7677
done

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp