aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-05-17 16:11:08 +0000
committerBruce Momjian <bruce@momjian.us>2001-05-17 16:11:08 +0000
commit8266e8a84be9593d2eb061492473cf0f1a7529e2 (patch)
treef2c471881485126b56feb7e8a08b117993f2df74
parent2d7795ebb4bd50ec668b221f532fb9aea3352ebc (diff)
downloadpostgresql-8266e8a84be9593d2eb061492473cf0f1a7529e2.tar.gz
postgresql-8266e8a84be9593d2eb061492473cf0f1a7529e2.zip
OK, now pgindent has blank lines before comment blocks, except when
there is a brace on the line above it.
-rwxr-xr-xsrc/tools/pgindent/pgindent32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index 3318b3fb8fd..53fe70d43b3 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -19,7 +19,7 @@ then echo "You appear to have GNU indent rather than BSD indent." >&2
echo "See the pgindent/README file for a description of its problems." >&2
EXTRA_OPTS="-ncdb -bli0 -npcs -cli4"
else echo "Hope you installed /src/tools/pgindent/indent.bsd.patch." >&2
- EXTRA_OPTS="-cli1"
+ EXTRA_OPTS="-bbb -cli1"
fi
for FILE
@@ -1343,6 +1343,36 @@ do
if (skips <= 2)
print line2;
}' |
+# remove blank line between opening brace and block comment
+ awk '
+ {
+ line3 = $0;
+ if (skips > 0)
+ skips--;
+ if (line1 ~ " *{$" &&
+ line2 ~ "^$" &&
+ line3 ~ " */\\*$")
+ {
+ print line1;
+ print line3;
+ line1 = "";
+ line2 = "";
+ line3 = "";
+ skips = 3;
+ }
+ else
+ if (skips == 0 && NR >= 3)
+ print line1;
+ line1 = line2;
+ line2 = line3;
+ line3 = "";
+ }
+ END {
+ if (skips <= 1)
+ print line1;
+ if (skips <= 2)
+ print line2;
+ }' |
# Move prototype names to the same line as return type. Useful for ctags.
# Indent should do this, but it does not. It formats prototypes just
# like real functions.