| @@ -1,17 +1,17 @@ | | | @@ -1,17 +1,17 @@ |
1 | $NetBSD: patch-aa,v 1.9 2007/03/09 15:38:32 rillig Exp $ | | 1 | $NetBSD: patch-aa,v 1.10 2009/09/27 22:27:23 apb Exp $ |
2 | | | 2 | |
3 | --- cdecl.c.orig 1996-01-16 04:54:46.000000000 +0100 | | 3 | --- cdecl.c.orig 1996-01-16 03:54:46.000000000 +0000 |
4 | +++ cdecl.c 2007-03-09 16:36:18.000000000 +0100 | | 4 | +++ cdecl.c |
5 | @@ -59,7 +59,9 @@ | | 5 | @@ -59,7 +59,9 @@ |
6 | */ | | 6 | */ |
7 | | | 7 | |
8 | char cdeclsccsid[] = "@(#)cdecl.c 2.5 1/15/96"; | | 8 | char cdeclsccsid[] = "@(#)cdecl.c 2.5 1/15/96"; |
9 | - | | 9 | - |
10 | + | | 10 | + |
11 | +#include <sys/param.h> | | 11 | +#include <sys/param.h> |
12 | + | | 12 | + |
13 | #include <stdio.h> | | 13 | #include <stdio.h> |
14 | #include <ctype.h> | | 14 | #include <ctype.h> |
15 | #if __STDC__ || defined(DOS) | | 15 | #if __STDC__ || defined(DOS) |
16 | @@ -71,11 +73,12 @@ char cdeclsccsid[] = "@(#)cdecl.c 2.5 1/ | | 16 | @@ -71,11 +73,12 @@ char cdeclsccsid[] = "@(#)cdecl.c 2.5 1/ |
17 | # ifndef NOVARARGS | | 17 | # ifndef NOVARARGS |
| @@ -115,26 +115,35 @@ $NetBSD: patch-aa,v 1.9 2007/03/09 15:38 | | | @@ -115,26 +115,35 @@ $NetBSD: patch-aa,v 1.9 2007/03/09 15:38 |
115 | + else if (xrestrict == ANSI) | | 115 | + else if (xrestrict == ANSI) |
116 | { | | 116 | { |
117 | if (!RitchieFlag && !PreANSIFlag) | | 117 | if (!RitchieFlag && !PreANSIFlag) |
118 | notsupported(" (ANSI Compiler)", t1, t2); | | 118 | notsupported(" (ANSI Compiler)", t1, t2); |
119 | @@ -286,7 +292,7 @@ void mbcheck() | | 119 | @@ -286,7 +292,7 @@ void mbcheck() |
120 | { | | 120 | { |
121 | (void) fprintf (stderr, | | 121 | (void) fprintf (stderr, |
122 | "%s: Internal error in crosscheck[%d,%d]=%d!\n", | | 122 | "%s: Internal error in crosscheck[%d,%d]=%d!\n", |
123 | - progname, i, j, restrict); | | 123 | - progname, i, j, restrict); |
124 | + progname, i, j, xrestrict); | | 124 | + progname, i, j, xrestrict); |
125 | exit(1); /* NOTREACHED */ | | 125 | exit(1); /* NOTREACHED */ |
126 | } | | 126 | } |
127 | } | | 127 | } |
| | | 128 | @@ -375,7 +381,7 @@ char *options[] = { |
| | | 129 | static char *line_read = NULL; |
| | | 130 | |
| | | 131 | /* Read a string, and return a pointer to it. Returns NULL on EOF. */ |
| | | 132 | -char * getline () |
| | | 133 | +char * get_line () |
| | | 134 | { |
| | | 135 | /* If the buffer has already been allocated, return the memory |
| | | 136 | to the free pool. */ |
128 | @@ -399,12 +405,12 @@ char ** attempt_completion(char *text, i | | 137 | @@ -399,12 +405,12 @@ char ** attempt_completion(char *text, i |
129 | { | | 138 | { |
130 | char **matches = NULL; | | 139 | char **matches = NULL; |
131 | | | 140 | |
132 | - if (start == 0) matches = completion_matches(text, command_completion); | | 141 | - if (start == 0) matches = completion_matches(text, command_completion); |
133 | + if (start == 0) matches = rl_completion_matches(text, command_completion); | | 142 | + if (start == 0) matches = rl_completion_matches(text, command_completion); |
134 | | | 143 | |
135 | return matches; | | 144 | return matches; |
136 | } | | 145 | } |
137 | | | 146 | |
138 | -char * command_completion(char *text, int flag) | | 147 | -char * command_completion(char *text, int flag) |
139 | +char * command_completion(const char *text, int flag) | | 148 | +char * command_completion(const char *text, int flag) |
140 | { | | 149 | { |
| @@ -148,26 +157,35 @@ $NetBSD: patch-aa,v 1.9 2007/03/09 15:38 | | | @@ -148,26 +157,35 @@ $NetBSD: patch-aa,v 1.9 2007/03/09 15:38 |
148 | +char * keyword_completion(const char *text, int flag) | | 157 | +char * keyword_completion(const char *text, int flag) |
149 | { | | 158 | { |
150 | static int index, len, set, into; | | 159 | static int index, len, set, into; |
151 | char *keyword, *option; | | 160 | char *keyword, *option; |
152 | @@ -803,7 +809,7 @@ void prompt() | | 161 | @@ -803,7 +809,7 @@ void prompt() |
153 | } | | 162 | } |
154 | | | 163 | |
155 | /* Save away the name of the program from argv[0] */ | | 164 | /* Save away the name of the program from argv[0] */ |
156 | -void setprogname(argv0) | | 165 | -void setprogname(argv0) |
157 | +void mysetprogname(argv0) | | 166 | +void mysetprogname(argv0) |
158 | char *argv0; | | 167 | char *argv0; |
159 | { | | 168 | { |
160 | #ifdef DOS | | 169 | #ifdef DOS |
| | | 170 | @@ -887,7 +893,7 @@ int dostdin() |
| | | 171 | |
| | | 172 | if (!quiet) (void) printf("Type `help' or `?' for help\n"); |
| | | 173 | ret = 0; |
| | | 174 | - while ((line = getline())) { |
| | | 175 | + while ((line = get_line())) { |
| | | 176 | if (!strcmp(line, "quit") || !strcmp(line, "exit")) { |
| | | 177 | free(line); |
| | | 178 | return ret; |
161 | @@ -1252,10 +1258,10 @@ char **argv; | | 179 | @@ -1252,10 +1258,10 @@ char **argv; |
162 | #ifdef USE_READLINE | | 180 | #ifdef USE_READLINE |
163 | /* install completion handlers */ | | 181 | /* install completion handlers */ |
164 | rl_attempted_completion_function = (CPPFunction *)attempt_completion; | | 182 | rl_attempted_completion_function = (CPPFunction *)attempt_completion; |
165 | - rl_completion_entry_function = (Function *)keyword_completion; | | 183 | - rl_completion_entry_function = (Function *)keyword_completion; |
166 | + rl_completion_entry_function = keyword_completion; | | 184 | + rl_completion_entry_function = keyword_completion; |
167 | #endif | | 185 | #endif |
168 | | | 186 | |
169 | - setprogname(argv[0]); | | 187 | - setprogname(argv[0]); |
170 | + mysetprogname(argv[0]); | | 188 | + mysetprogname(argv[0]); |
171 | #ifdef DOS | | 189 | #ifdef DOS |
172 | if (strcmp(progname, "cppdecl") == 0) | | 190 | if (strcmp(progname, "cppdecl") == 0) |
173 | #else | | 191 | #else |