Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2002-06-15 19:13:04 +0000
committerBruce Momjian2002-06-15 19:13:04 +0000
commitd54ae2aff24c3aa9df605e5ec3d09042b7458a6c (patch)
tree8e142b9490810072ee64ea6841a7375e2f6a2346 /src/tools/pgindent/pgcppindent
parent2e58024066e1ddf63d729ffb42077938fe25a9bf (diff)
Add C++ indent tool.
Diffstat (limited to 'src/tools/pgindent/pgcppindent')
-rwxr-xr-xsrc/tools/pgindent/pgcppindent27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/pgindent/pgcppindent b/src/tools/pgindent/pgcppindent
new file mode 100755
index 00000000000..ee27cf5295f
--- /dev/null
+++ b/src/tools/pgindent/pgcppindent
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
+entab </dev/null >/dev/null
+if [ "$?" -ne 0 ]
+then echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2
+ echo "This will put the 'entab' command in your path." >&2
+ echo "Then run $0 again."
+ exit 1
+fi
+astyle --version </dev/null >/dev/null 2>&1
+if [ "$?" -eq 0 ]
+then echo "You do not appear to have 'astyle' installed on your system." >&2
+ exit 1
+fi
+
+for FILE
+do
+ astyle --style=ansi -b -p -S < "$FILE" >/tmp/$$ 2>/tmp/$$a
+ if [ "$?" -ne 0 -o -s /tmp/$$a ]
+ then echo "$FILE"
+ cat /tmp/$$a
+ fi
+ cat /tmp/$$ |
+ entab -t4 -qc |
+ cat >/tmp/$$a && cat /tmp/$$a >"$FILE"
+done