projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5ef74fe
)
Add code to trip trailing newlines in a file.
author
Bruce Momjian
Sat, 27 Oct 2001 13:54:45 +0000
(13:54 +0000)
committer
Bruce Momjian
Sat, 27 Oct 2001 13:54:45 +0000
(13:54 +0000)
src/tools/pgindent/pgindent
patch
|
blob
|
blame
|
history
diff --git
a/src/tools/pgindent/pgindent
b/src/tools/pgindent/pgindent
index 614d93ae427e3d51cf7a2e5de57a06183a919b07..5321876d8a42876ccc2e9c314f99800b13c48ea1 100755
(executable)
--- a/
src/tools/pgindent/pgindent
+++ b/
src/tools/pgindent/pgindent
@@
-1531,6
+1531,19
@@
do
if (NR >= 1 && skips <= 2)
print line2;
}' |
+# remove trailing blank lines, helps with adding blank before trailing #endif
+ awk ' BEGIN {blank_lines = 0;}
+ {
+ line1 = $0;
+ if (line1 ~ /^$/)
+ blank_lines++;
+ else
+ {
+ for (; blank_lines > 0; blank_lines--)
+ printf "\n";
+ print line1;
+ }
+ }' |
# remove blank line before #endif
awk ' BEGIN {line1 = ""; line2 = ""; skips = 0}
{