Skip to content
Snippets Groups Projects
Commit 8e6697fc authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Update include scripts

parent 7fe87222
No related branches found
No related tags found
No related merge requests found
These utilities help clean up #include file usage:
pgfixinclude change #include's to <> or ""
pgrminclude remove extra #include's
pginclude [-v] report which #include files can not compile on their own
pgdefine create macro calls for all defines in the file (used by
the above routines)
:
# create macro calls for all defines in the file
trap "rm -f /tmp/$$" 0 1 2 3 15
for FILE
do
......
:
# mark includes as <> or ""
# change #include's to <> or ""
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
find . \( -name CVS -a -prune \) -o -type f -print |
......
:
# report which include files can not compile on their own
# report which #include files can not compile on their own
# takes -v option to display compile failure message and line numbers
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a" 0 1 2 3 15
find . \( -name CVS -a -prune \) -o -name '*.[ch]' -type f -print | while read FILE
......
:
# report which files have extra includes
# remove extra #include's
trap "rm -f /tmp/$$.c /tmp/$$.o /tmp/$$ /tmp/$$a /tmp/$$b" 0 1 2 3 15
find . \( -name CVS -a -prune \) -o -type f -print |
......@@ -52,7 +52,7 @@ do
mv /tmp/$$b "$FILE"
# reload after #include removal
if [ "$IS_INCLUDE" = "Y" ]
then cat "$FILE" | grep -v "^#if" | grep -v "^#else" |
then cat "$FILE" | grep -v "^#if" | grep -v "^#else" |
grep -v "^#endif" | sed 's/->[a-zA-Z0-9_\.]*//g' >/tmp/$$a
else cat "$FILE" >/tmp/$$a
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment