From 8a28f50f8a3a5b014730b88cf5e965db2bb71b52 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 7 Oct 2004 13:45:51 +0000
Subject: [PATCH] Improve pgindent processing of comment after 'else'. Improve
 comment of pg_dump Win32 link workaround.

---
 src/bin/pg_dump/Makefile    | 5 +++--
 src/tools/pgindent/pgindent | 6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile
index fe260ca1fcc..6fe3af18dc6 100644
--- a/src/bin/pg_dump/Makefile
+++ b/src/bin/pg_dump/Makefile
@@ -5,7 +5,7 @@
 # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.56 2004/10/05 19:30:23 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.57 2004/10/07 13:45:48 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -22,7 +22,8 @@ OBJS=	pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
 
 EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
 
-# not sure why MinGW needs this but it prevents a link failure
+# Not sure why MinGW needs this but it prevents a link failure
+# of duplicate definitions for pg_tolower().  2004-10-06
 ifeq ($(PORTNAME), win32)
 EXTRA_OBJS += $(top_builddir)/src/port/exec.o
 endif
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index eb0ce1590b5..e85a6723b72 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -38,8 +38,10 @@ do
 # mark some comments for special treatment later
 	sed 's;/\*  *---;/*---X_X;g' |
 # workaround for indent bug with 'else' handling
-	sed 's;\([} 	]\)else\([ 	]*\)\(/\*.*\)$;\1else\
-\2\3;g' |
+	sed 's;\([ 	]*\)else[ 	]*\(/\*.*\)$;\1else\
+\1\2;g' |
+	sed 's;\([ 	]*\)\(}[ 	]\)else[ 	]*\(/\*.*\)$;\1\2else\
+\1\3;g' |
 	detab -t4 -qc |
 # work around bug where function that defines no local variables misindents
 # switch() case lines and line after #else.  Do not do for struct/enum.
-- 
GitLab