1- src/tools/pgindent/indent.bsd.patch
2-
3- This patch contains several fixes to NetBSD's indent and should be
4- applied before using pgindent.
5-
6- - --------------------------------------------------------------------------
7-
8- Index: README
9- ===================================================================
10- RCS file: /cvsroot/src/usr.bin/indent/README,v
11- retrieving revision 1.1
12- diff -c -r1.1 README
13- *** README9 Apr 1993 12:59:06 -00001.1
14- --- README15 Nov 2005 00:25:43 -0000
1+ diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
2+ *** bsd_indent/MakefileMon Nov 14 19:30:11 2005
3+ --- pg_bsd_indent/MakefileWed Oct 12 12:17:12 2011
4+ ***************
5+ *** 2,10 ****
6+ # Makefile
7+ #
8+ #
9+ ! TARGET = indent
10+ XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright="
11+ ! CFLAGS = -g
12+ LIBS =
13+
14+ $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o
15+ --- 2,10 ----
16+ # Makefile
17+ #
18+ #
19+ ! TARGET = pg_bsd_indent
20+ XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright="
21+ ! CFLAGS = -O
22+ LIBS =
23+
24+ $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o
25+ ***************
26+ *** 31,37 ****
27+ clean:
28+ rm -f *.o $(TARGET) log core
29+
30+ ! install:
31+ ! make clean
32+ ! make CFLAGS=-O
33+ install -s -o bin -g bin $(TARGET) /usr/local/bin
34+ --- 31,35 ----
35+ clean:
36+ rm -f *.o $(TARGET) log core
37+
38+ ! install: $(TARGET)
39+ install -s -o bin -g bin $(TARGET) /usr/local/bin
40+ diff -c -r bsd_indent/README pg_bsd_indent/README
41+ *** bsd_indent/READMEWed Oct 12 11:51:58 2011
42+ --- pg_bsd_indent/READMEMon Nov 14 19:30:24 2005
1543***************
1644*** 1,3 ****
1745--- 1,13 ----
@@ -28,13 +56,107 @@ diff -c -r1.1 README
2856 This is the C indenter, it originally came from the University of Illinois
2957 via some distribution tape for PDP-11 Unix. It has subsequently been
3058 hacked upon by James Gosling @ CMU. It isn't very pretty, and really needs
31- Index: indent_globs.h
32- ===================================================================
33- RCS file: /cvsroot/src/usr.bin/indent/indent_globs.h,v
34- retrieving revision 1.8
35- diff -c -r1.8 indent_globs.h
36- *** indent_globs.h7 Aug 2003 11:14:08 -00001.8
37- --- indent_globs.h15 Nov 2005 00:25:44 -0000
59+ diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
60+ *** bsd_indent/args.cMon Nov 14 19:30:00 2005
61+ --- pg_bsd_indent/args.cWed Oct 12 12:30:06 2011
62+ ***************
63+ *** 83,88 ****
64+ --- 83,90 ----
65+ #include <string.h>
66+ #include "indent_globs.h"
67+
68+ + #define INDENT_PG_VERSION"1.0"
69+ +
70+ /* profile types */
71+ #definePRO_SPECIAL1/* special case */
72+ #definePRO_BOOL2/* boolean */
73+ ***************
74+ *** 99,106 ****
75+ --- 101,113 ----
76+ #defineSTDIN3/* use stdin */
77+ #defineKEY4/* type (keyword) */
78+
79+ + #defineKEY_FILE5/* only used for args */
80+ + #define VERSION6/* only used for args */
81+ +
82+ char *option_source = "?";
83+
84+ + void add_typedefs_from_file(char *str);
85+ +
86+ /*
87+ * N.B.: because of the way the table here is scanned, options whose names are
88+ * substrings of other options must occur later; that is, with -lp vs -l, -lp
89+ ***************
90+ *** 118,123 ****
91+ --- 125,136 ----
92+ "T", PRO_SPECIAL, 0, KEY, 0
93+ },
94+ {
95+ + "U", PRO_SPECIAL, 0, KEY_FILE, 0
96+ + },
97+ + {
98+ + "V", PRO_SPECIAL, 0, VERSION, 0
99+ + },
100+ + {
101+ "bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation
102+ },
103+ {
104+ ***************
105+ *** 425,430 ****
106+ --- 438,456 ----
107+ }
108+ break;
109+
110+ + case KEY_FILE:
111+ + if (*param_start == 0)
112+ + goto need_param;
113+ + add_typedefs_from_file(param_start);
114+ + break;
115+ +
116+ + case VERSION:
117+ + {
118+ + printf("pg_bsd_indent %s\n", INDENT_PG_VERSION);
119+ + exit(0);
120+ + }
121+ + break;
122+ +
123+ default:
124+ fprintf(stderr, "\
125+ indent: set_option: internal error: p_special %d\n", p->p_special);
126+ ***************
127+ *** 459,461 ****
128+ --- 485,509 ----
129+ exit(1);
130+ }
131+ }
132+ +
133+ +
134+ + void
135+ + add_typedefs_from_file(char *str)
136+ + {
137+ + FILE *file;
138+ + char line[BUFSIZ];
139+ +
140+ + if ((file = fopen(param_start, "r")) == NULL)
141+ + {
142+ + fprintf(stderr, "indent: cannot open file %s\n", str);
143+ + exit(1);
144+ + }
145+ + while ((fgets(line, BUFSIZ, file)) != NULL)
146+ + {
147+ + /* Remove trailing whitespace */
148+ + if (strstr(line, " \t\n\r") != NULL)
149+ + *strstr(line, " \t\n\r") = '\0';
150+ + addkey(strdup(line), 4);
151+ + }
152+ + fclose(file);
153+ + }
154+ Only in pg_bsd_indent/: args.o
155+ Only in bsd_indent/: indent.bsd.patch
156+ Only in pg_bsd_indent/: indent.o
157+ diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h
158+ *** bsd_indent/indent_globs.hWed Oct 12 11:51:58 2011
159+ --- pg_bsd_indent/indent_globs.hMon Nov 14 19:30:24 2005
38160***************
39161*** 239,245 ****
40162 scomf,/* Same line comment font */
@@ -56,13 +178,10 @@ diff -c -r1.8 indent_globs.h
56178
57179 EXTERN struct parser_state {
58180 int last_token;
59- Index: lexi.c
60- ===================================================================
61- RCS file: /cvsroot/src/usr.bin/indent/lexi.c,v
62- retrieving revision 1.12
63- diff -c -r1.12 lexi.c
64- *** lexi.c7 Aug 2003 11:14:09 -00001.12
65- --- lexi.c15 Nov 2005 00:25:44 -0000
181+ Only in pg_bsd_indent/: io.o
182+ diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c
183+ *** bsd_indent/lexi.cWed Oct 12 11:51:58 2011
184+ --- pg_bsd_indent/lexi.cMon Nov 14 19:30:24 2005
66185***************
67186*** 93,99 ****
68187 int rwcode;
@@ -102,13 +221,10 @@ diff -c -r1.12 lexi.c
102221 p->rwd = key;
103222 p->rwcode = val;
104223 p[1].rwd = 0;
105- Index: parse.c
106- ===================================================================
107- RCS file: /cvsroot/src/usr.bin/indent/parse.c,v
108- retrieving revision 1.7
109- diff -c -r1.7 parse.c
110- *** parse.c7 Aug 2003 11:14:09 -00001.7
111- --- parse.c15 Nov 2005 00:25:44 -0000
224+ Only in pg_bsd_indent/: lexi.o
225+ diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c
226+ *** bsd_indent/parse.cWed Oct 12 11:51:58 2011
227+ --- pg_bsd_indent/parse.cMon Nov 14 19:30:24 2005
112228***************
113229*** 231,236 ****
114230--- 231,241 ----
@@ -123,13 +239,10 @@ diff -c -r1.7 parse.c
123239 reduce();/* see if any reduction can be done */
124240
125241 #ifdef debug
126- Index: pr_comment.c
127- ===================================================================
128- RCS file: /cvsroot/src/usr.bin/indent/pr_comment.c,v
129- retrieving revision 1.9
130- diff -c -r1.9 pr_comment.c
131- *** pr_comment.c7 Aug 2003 11:14:09 -00001.9
132- --- pr_comment.c15 Nov 2005 00:25:44 -0000
242+ Only in pg_bsd_indent/: parse.o
243+ diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c
244+ *** bsd_indent/pr_comment.cWed Oct 12 11:51:58 2011
245+ --- pg_bsd_indent/pr_comment.cMon Nov 14 19:30:24 2005
133246***************
134247*** 148,154 ****
135248 ps.box_com = true;
@@ -173,3 +286,4 @@ diff -c -r1.9 pr_comment.c
173286 } else
174287 if (++buf_ptr >= buf_end)
175288 fill_buffer();
289+ Only in pg_bsd_indent/: pr_comment.o