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
- *** README 9 Apr 1993 12:59:06 -0000 1.1
14
- --- README 15 Nov 2005 00:25:43 -0000
1
+ diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile
2
+ *** bsd_indent/Makefile Mon Nov 14 19:30:11 2005
3
+ --- pg_bsd_indent/Makefile Wed 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/README Wed Oct 12 11:51:58 2011
42
+ --- pg_bsd_indent/README Mon Nov 14 19:30:24 2005
15
43
***************
16
44
*** 1,3 ****
17
45
--- 1,13 ----
@@ -28,13 +56,107 @@ diff -c -r1.1 README
28
56
This is the C indenter, it originally came from the University of Illinois
29
57
via some distribution tape for PDP-11 Unix. It has subsequently been
30
58
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.h 7 Aug 2003 11:14:08 -0000 1.8
37
- --- indent_globs.h 15 Nov 2005 00:25:44 -0000
59
+ diff -c -r bsd_indent/args.c pg_bsd_indent/args.c
60
+ *** bsd_indent/args.c Mon Nov 14 19:30:00 2005
61
+ --- pg_bsd_indent/args.c Wed 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
+ #define PRO_SPECIAL 1 /* special case */
72
+ #define PRO_BOOL 2 /* boolean */
73
+ ***************
74
+ *** 99,106 ****
75
+ --- 101,113 ----
76
+ #define STDIN 3 /* use stdin */
77
+ #define KEY 4 /* type (keyword) */
78
+
79
+ + #define KEY_FILE 5 /* only used for args */
80
+ + #define VERSION 6 /* 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.h Wed Oct 12 11:51:58 2011
159
+ --- pg_bsd_indent/indent_globs.h Mon Nov 14 19:30:24 2005
38
160
***************
39
161
*** 239,245 ****
40
162
scomf, /* Same line comment font */
@@ -56,13 +178,10 @@ diff -c -r1.8 indent_globs.h
56
178
57
179
EXTERN struct parser_state {
58
180
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.c 7 Aug 2003 11:14:09 -0000 1.12
65
- --- lexi.c 15 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.c Wed Oct 12 11:51:58 2011
184
+ --- pg_bsd_indent/lexi.c Mon Nov 14 19:30:24 2005
66
185
***************
67
186
*** 93,99 ****
68
187
int rwcode;
@@ -102,13 +221,10 @@ diff -c -r1.12 lexi.c
102
221
p->rwd = key;
103
222
p->rwcode = val;
104
223
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.c 7 Aug 2003 11:14:09 -0000 1.7
111
- --- parse.c 15 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.c Wed Oct 12 11:51:58 2011
227
+ --- pg_bsd_indent/parse.c Mon Nov 14 19:30:24 2005
112
228
***************
113
229
*** 231,236 ****
114
230
--- 231,241 ----
@@ -123,13 +239,10 @@ diff -c -r1.7 parse.c
123
239
reduce(); /* see if any reduction can be done */
124
240
125
241
#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.c 7 Aug 2003 11:14:09 -0000 1.9
132
- --- pr_comment.c 15 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.c Wed Oct 12 11:51:58 2011
245
+ --- pg_bsd_indent/pr_comment.c Mon Nov 14 19:30:24 2005
133
246
***************
134
247
*** 148,154 ****
135
248
ps.box_com = true;
@@ -173,3 +286,4 @@ diff -c -r1.9 pr_comment.c
173
286
} else
174
287
if (++buf_ptr >= buf_end)
175
288
fill_buffer();
289
+ Only in pg_bsd_indent/: pr_comment.o
0 commit comments