Fix pg_bsd_indent bug where newlines were not being trimmed from typedef
authorBruce Momjian <bruce@momjian.us>
Wed, 26 Oct 2011 21:23:33 +0000 (17:23 -0400)
committerBruce Momjian <bruce@momjian.us>
Wed, 26 Oct 2011 21:24:19 +0000 (17:24 -0400)
lines.  Update pg_bsd_indent required version to 1.1 (and update ftp
site).

Problem reported by Magnus.

src/bin/pg_basebackup/pg_basebackup.c
src/tools/pgindent/indent.bsd.patch
src/tools/pgindent/pgindent

index 68e40f478ffe43f52ac15c15cee81193dcfe3ea9..9100d75fb6fd3419ce7186115b94ff044314b89c 100644 (file)
@@ -379,11 +379,10 @@ progress_report(int tablespacenum, const char *filename)
    char        totalsize_str[32];
 
    /*
-    * Avoid overflowing past 100% or the full size. This may make the
-    * total size number change as we approach the end of the backup
-    * (the estimate will always be wrong if WAL is included), but
-    * that's better than having the done column be bigger than the
-    * total.
+    * Avoid overflowing past 100% or the full size. This may make the total
+    * size number change as we approach the end of the backup (the estimate
+    * will always be wrong if WAL is included), but that's better than having
+    * the done column be bigger than the total.
     */
    if (percent > 100)
        percent = 100;
@@ -391,9 +390,9 @@ progress_report(int tablespacenum, const char *filename)
        totalsize = totaldone / 1024;
 
    /*
-    * Separate step to keep platform-dependent format code out of translatable
-    * strings.  And we only test for INT64_FORMAT availability in snprintf,
-    * not fprintf.
+    * Separate step to keep platform-dependent format code out of
+    * translatable strings.  And we only test for INT64_FORMAT availability
+    * in snprintf, not fprintf.
     */
    snprintf(totaldone_str, sizeof(totaldone_str), INT64_FORMAT, totaldone / 1024);
    snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize);
@@ -410,7 +409,7 @@ progress_report(int tablespacenum, const char *filename)
                    ngettext("%s/%s kB (100%%), %d/%d tablespace %35s",
                             "%s/%s kB (100%%), %d/%d tablespaces %35s",
                             tablespacecount),
-                   totaldone_str, totalsize_str, tablespacenum, tablespacecount, "");
+           totaldone_str, totalsize_str, tablespacenum, tablespacecount, "");
        else
            fprintf(stderr,
                    ngettext("%s/%s kB (%d%%), %d/%d tablespace (%-30.30s)",
index a7d145338957d77995ab62d9c2a5266bfb829cd1..1d7f64bc3d81f3a74f25b775d9086a7eb82af480 100644 (file)
@@ -1,5 +1,5 @@
 diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
-*** bsd_indent/Makefile    Mon Nov 14 19:30:11 2005
+*** bsd_indent/Makefile    Wed Oct 26 17:13:34 2011
 --- pg_bsd_indent/Makefile Wed Oct 12 12:17:12 2011
 ***************
 *** 2,10 ****
@@ -38,7 +38,7 @@ diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
 ! install: $(TARGET)
    install -s -o bin -g bin $(TARGET) /usr/local/bin
 diff -c -r bsd_indent/README pg_bsd_indent/README
-*** bsd_indent/README  Wed Oct 12 11:51:58 2011
+*** bsd_indent/README  Wed Oct 26 17:13:34 2011
 --- pg_bsd_indent/README   Mon Nov 14 19:30:24 2005
 ***************
 *** 1,3 ****
@@ -57,15 +57,15 @@ diff -c -r bsd_indent/README pg_bsd_indent/README
   via some distribution tape for PDP-11 Unix.  It has subsequently been
   hacked upon by James Gosling @ CMU.  It isn't very pretty, and really needs
 diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
-*** bsd_indent/args.c  Mon Nov 14 19:30:00 2005
---- pg_bsd_indent/args.c   Wed Oct 12 12:30:06 2011
+*** bsd_indent/args.c  Wed Oct 26 17:13:34 2011
+--- pg_bsd_indent/args.c   Wed Oct 26 17:16:56 2011
 ***************
 *** 83,88 ****
 --- 83,90 ----
   #include <string.h>
   #include "indent_globs.h"
   
-+ #define INDENT_PG_VERSION    "1.0"
++ #define INDENT_PG_VERSION    "1.1"
 + 
   /* profile types */
   #define  PRO_SPECIAL 1   /* special case */
@@ -125,7 +125,7 @@ diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
   indent: set_option: internal error: p_special %d\n", p->p_special);
 ***************
 *** 459,461 ****
---- 485,509 ----
+--- 485,508 ----
        exit(1);
    }
   }
@@ -145,17 +145,16 @@ diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
 +  while ((fgets(line, BUFSIZ, file)) != NULL)
 +  {
 +      /* Remove trailing whitespace */
-+      if (strstr(line, " \t\n\r") != NULL)
-+          *strstr(line, " \t\n\r") = '\0';
++      *(line + strcspn(line, " \t\n\r")) = '\0';
 +      addkey(strdup(line), 4);
 +  }
 +  fclose(file);
 + }
-Only in pg_bsd_indent/: args.o
-Only in bsd_indent/: indent.bsd.patch
-Only in pg_bsd_indent/: indent.o
+Only in pg_bsd_indent: args.o
+Only in pg_bsd_indent: indent.bsd.patch
+Only in pg_bsd_indent: indent.o
 diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h
-*** bsd_indent/indent_globs.h  Wed Oct 12 11:51:58 2011
+*** bsd_indent/indent_globs.h  Wed Oct 26 17:13:34 2011
 --- pg_bsd_indent/indent_globs.h   Mon Nov 14 19:30:24 2005
 ***************
 *** 239,245 ****
@@ -178,9 +177,9 @@ diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h
   
   EXTERN struct parser_state {
    int     last_token;
-Only in pg_bsd_indent/: io.o
+Only in pg_bsd_indent: io.o
 diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c
-*** bsd_indent/lexi.c  Wed Oct 12 11:51:58 2011
+*** bsd_indent/lexi.c  Wed Oct 26 17:13:34 2011
 --- pg_bsd_indent/lexi.c   Mon Nov 14 19:30:24 2005
 ***************
 *** 93,99 ****
@@ -221,9 +220,9 @@ diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c
    p->rwd = key;
    p->rwcode = val;
    p[1].rwd = 0;
-Only in pg_bsd_indent/: lexi.o
+Only in pg_bsd_indent: lexi.o
 diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c
-*** bsd_indent/parse.c Wed Oct 12 11:51:58 2011
+*** bsd_indent/parse.c Wed Oct 26 17:13:34 2011
 --- pg_bsd_indent/parse.c  Mon Nov 14 19:30:24 2005
 ***************
 *** 231,236 ****
@@ -239,9 +238,9 @@ diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c
    reduce();       /* see if any reduction can be done */
   
   #ifdef debug
-Only in pg_bsd_indent/: parse.o
+Only in pg_bsd_indent: parse.o
 diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c
-*** bsd_indent/pr_comment.c    Wed Oct 12 11:51:58 2011
+*** bsd_indent/pr_comment.c    Wed Oct 26 17:13:34 2011
 --- pg_bsd_indent/pr_comment.c Mon Nov 14 19:30:24 2005
 ***************
 *** 148,154 ****
@@ -286,4 +285,4 @@ diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c
            } else
                if (++buf_ptr >= buf_end)
                    fill_buffer();
-Only in pg_bsd_indent/: pr_comment.o
+Only in pg_bsd_indent: pr_comment.o
index eeb6f5d2a28e35b20bc0c1d27da05c9643ef5dc5..e4ff5a53e5fe755048f5c68533f1acb4642dd9d6 100755 (executable)
@@ -22,6 +22,7 @@ TYPEDEFS="$1"
 shift
 
 [ -z "$INDENT" ] && INDENT=pg_bsd_indent
+INDENT_VERSION="1.1"
 
 trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15
 
@@ -39,8 +40,8 @@ if [ "$?" -ne 1 ]
 then   echo "You do not appear to have '$INDENT' installed on your system." >&2
    exit 1
 fi
-if [ "`$INDENT -V`" != "$INDENT 1.0" ]
-then   echo "You do not appear to have $INDENT version 1.0 installed on your system." >&2
+if [ "`$INDENT -V`" != "$INDENT $INDENT_VERSION" ]
+then   echo "You do not appear to have $INDENT version $INDENT_VERSION installed on your system." >&2
    exit 1
 fi
 $INDENT -gnu </dev/null >/dev/null 2>&1