diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
*** bsd_indent/Makefile	Wed Oct 26 17:13:34 2011
--- pg_bsd_indent/Makefile	Wed Oct 12 12:17:12 2011
***************
*** 2,10 ****
  # Makefile
  #
  #
! TARGET = indent
  XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright="
! CFLAGS = -g 
  LIBS = 
  
  $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o
--- 2,10 ----
  # Makefile
  #
  #
! TARGET = pg_bsd_indent
  XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright="
! CFLAGS = -O
  LIBS = 
  
  $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o
***************
*** 31,37 ****
  clean:
  	rm -f *.o $(TARGET) log core
  
! install:
! 	make clean
! 	make CFLAGS=-O
  	install -s -o bin -g bin $(TARGET) /usr/local/bin
--- 31,35 ----
  clean:
  	rm -f *.o $(TARGET) log core
  
! 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 26 17:13:34 2011
--- pg_bsd_indent/README	Mon Nov 14 19:30:24 2005
***************
*** 1,3 ****
--- 1,13 ----
+ 
+ This patch is from NetBSD current, 2005-11-14.  It contains all the
+ patches need for its use in PostgreSQL.
+ 
+ bjm
+ 
+ ---------------------------------------------------------------------------
+ 
+ 
+ 
  This is the C indenter, it originally came from the University of Illinois
  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	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.1"
+ 
  /* profile types */
  #define	PRO_SPECIAL	1	/* special case */
  #define	PRO_BOOL	2	/* boolean */
***************
*** 99,106 ****
--- 101,113 ----
  #define	STDIN		3	/* use stdin */
  #define	KEY		4	/* type (keyword) */
  
+ #define	KEY_FILE		5	/* only used for args */
+ #define VERSION			6	/* only used for args */
+ 
  char   *option_source = "?";
  
+ void add_typedefs_from_file(char *str);
+ 
  /*
   * N.B.: because of the way the table here is scanned, options whose names are
   * substrings of other options must occur later; that is, with -lp vs -l, -lp
***************
*** 118,123 ****
--- 125,136 ----
  		"T", PRO_SPECIAL, 0, KEY, 0
  	},
  	{
+ 		"U", PRO_SPECIAL, 0, KEY_FILE, 0
+ 	},
+ 	{
+ 		"V", PRO_SPECIAL, 0, VERSION, 0
+ 	},
+ 	{
  		"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation
  	},
  	{
***************
*** 425,430 ****
--- 438,456 ----
  			}
  			break;
  
+ 		case KEY_FILE:
+ 			if (*param_start == 0)
+ 				goto need_param;
+ 			add_typedefs_from_file(param_start);
+ 			break;
+ 
+ 		case VERSION:
+ 			{
+ 				printf("pg_bsd_indent %s\n", INDENT_PG_VERSION);
+ 				exit(0);
+ 			}
+ 			break;
+ 
  		default:
  			fprintf(stderr, "\
  indent: set_option: internal error: p_special %d\n", p->p_special);
***************
*** 459,461 ****
--- 485,508 ----
  		exit(1);
  	}
  }
+ 
+ 
+ void
+ add_typedefs_from_file(char *str)
+ {
+ 	FILE *file;
+ 	char line[BUFSIZ];
+ 	
+ 	if ((file = fopen(param_start, "r")) == NULL)
+ 	{
+ 		fprintf(stderr, "indent: cannot open file %s\n", str);
+ 		exit(1);
+ 	}
+ 	while ((fgets(line, BUFSIZ, file)) != NULL)
+ 	{
+ 		/* Remove trailing whitespace */
+ 		*(line + strcspn(line, " \t\n\r")) = '\0';
+ 		addkey(strdup(line), 4);
+ 	}
+ 	fclose(file);
+ }
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 26 17:13:34 2011
--- pg_bsd_indent/indent_globs.h	Mon Nov 14 19:30:24 2005
***************
*** 239,245 ****
          scomf,			/* Same line comment font */
          bodyf;			/* major body font */
  
! #define STACK_SIZE 150
  
  EXTERN struct parser_state {
  	int     last_token;
--- 239,249 ----
          scomf,			/* Same line comment font */
          bodyf;			/* major body font */
  
! /*
!  * This controls the maximum number of 'else if' clauses supported.
!  * If it is exceeded, comments are placed in column 100.
!  */
! #define STACK_SIZE 1000
  
  EXTERN struct parser_state {
  	int     last_token;
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 26 17:13:34 2011
--- pg_bsd_indent/lexi.c	Mon Nov 14 19:30:24 2005
***************
*** 93,99 ****
  	int     rwcode;
  };
  
! struct templ specials[1000] =
  {
  	{"switch", 1},
  	{"case", 2},
--- 93,99 ----
  	int     rwcode;
  };
  
! struct templ specials[16384] =
  {
  	{"switch", 1},
  	{"case", 2},
***************
*** 622,629 ****
  		else
  			p++;
  	if (p >= specials + sizeof specials / sizeof specials[0])
! 		return;		/* For now, table overflows are silently
! 				 * ignored */
  	p->rwd = key;
  	p->rwcode = val;
  	p[1].rwd = 0;
--- 622,632 ----
  		else
  			p++;
  	if (p >= specials + sizeof specials / sizeof specials[0])
! 	{
! 		fprintf(stderr, "indent: typedef table overflow\n");
! 		exit(1);
! 	}
! 
  	p->rwd = key;
  	p->rwcode = val;
  	p[1].rwd = 0;
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 26 17:13:34 2011
--- pg_bsd_indent/parse.c	Mon Nov 14 19:30:24 2005
***************
*** 231,236 ****
--- 231,241 ----
  
  	}			/* end of switch */
  
+ 	if (ps.tos >= STACK_SIZE) {
+ 	    fprintf(stderr, "indent:  stack size overflow\n");
+ 	    exit(1);
+ 	}
+ 	
  	reduce();		/* see if any reduction can be done */
  
  #ifdef debug
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 26 17:13:34 2011
--- pg_bsd_indent/pr_comment.c	Mon Nov 14 19:30:24 2005
***************
*** 148,154 ****
  		ps.box_com = true;
  		ps.com_col = 1;
  	} else {
! 		if (*buf_ptr == '-' || *buf_ptr == '*' || *buf_ptr == '\n') {
  			ps.box_com = true;	/* a comment with a '-', '*'
  						 * or newline immediately
  						 * after the start comment is
--- 148,158 ----
  		ps.box_com = true;
  		ps.com_col = 1;
  	} else {
! 		/*
! 		 * Don't process '\n' or every comment is treated as a
! 		 * block comment, meaning there is no wrapping.
! 		 */
! 		if (*buf_ptr == '-' || *buf_ptr == '*') {
  			ps.box_com = true;	/* a comment with a '-', '*'
  						 * or newline immediately
  						 * after the start comment is
***************
*** 328,333 ****
--- 332,350 ----
  							goto end_of_comment;
  					}
  				} while (*buf_ptr == ' ' || *buf_ptr == '\t');
+ 
+ 				/*
+ 				 * If there is a blank comment line, we need to prefix
+ 				 * the line with the same three spaces that "/* " takes up.
+ 				 * Without this code, blank stared lines in comments have
+ 				 * three too-many characters on the line when wrapped.
+ 				 */
+ 				if (s_com == e_com) {
+ 				    *e_com++ = ' ';	/* add blanks for continuation */
+ 				    *e_com++ = ' ';
+ 				    *e_com++ = ' ';
+ 				    now_col += 3;
+ 				}
  			} else
  				if (++buf_ptr >= buf_end)
  					fill_buffer();
Only in pg_bsd_indent: pr_comment.o
