fix a kconfig usage bug
[openwrt/openwrt.git] / package / keynote / patches / 001-build.patch
1 Index: keynote-2.3/configure.in
2 ===================================================================
3 --- keynote-2.3.orig/configure.in 2007-06-04 13:22:41.284579072 +0200
4 +++ keynote-2.3/configure.in 2007-06-04 13:22:41.389563112 +0200
5 @@ -21,19 +21,13 @@
6 AC_PATH_PROG(ECHO, echo, /bin/echo)
7 AC_PATH_PROG(SED, sed, /usr/bin/sed)
8
9 -dnl Checks for libraries.
10 -LIBS="-L/usr/lib -L/usr/local/lib -L/usr/ssl/lib -L/usr/openssl/lib\
11 - -L/usr/local/ssl/lib -L/usr/local/openssl/lib -L/usr/pkg/lib -L/pkg/lib"
12 -
13 AC_CHECK_LIB(m, floor, LIBS="$LIBS -lm")
14 AC_CHECK_LIB(rsaref, RSAPrivateDecrypt, LIBS="$LIBS -lrsaref")
15 AC_CHECK_LIB(crypto, i2a_ASN1_STRING, LIBS="$LIBS -lcrypto")
16 AC_CHECK_LIB(RSAglue, RSA_ref_private_encrypt, LIBS="$LIBS -lRSAglue")
17
18 dnl Checks for header files.
19 -CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/ssl/include\
20 - -I/usr/local/ssl/include -I/usr/openssl/include -I/usr/pkg/include\
21 - -I/usr/local/openssl/include -I/pkg/include"
22 +CPPFLAGS="-I/usr/include/openssl"
23
24 AC_HEADER_STDC
25 AC_HEADER_TIME
26 Index: keynote-2.3/keynote-keygen.c
27 ===================================================================
28 --- keynote-2.3.orig/keynote-keygen.c 2007-06-04 13:22:41.290578160 +0200
29 +++ keynote-2.3/keynote-keygen.c 2007-06-04 13:22:41.389563112 +0200
30 @@ -161,7 +161,7 @@
31 if (strlen(algname) + 2 > prlen)
32 {
33 fprintf(stderr, "Parameter ``print-length'' should be larger "
34 - "than the length of AlgorithmName (%d)\n", strlen(algname));
35 + "than the length of AlgorithmName (%lu)\n", strlen(algname));
36 exit(-1);
37 }
38
39 Index: keynote-2.3/keynote.l
40 ===================================================================
41 --- keynote-2.3.orig/keynote.l 2007-06-04 13:22:41.295577400 +0200
42 +++ keynote-2.3/keynote.l 2007-06-04 13:22:41.390562960 +0200
43 @@ -61,7 +61,8 @@
44 static struct lex_list *keynote_lex_list = (struct lex_list *) NULL;
45 static int keynote_max_lex_list = 32;
46 static int keynote_lex_counter = 0;
47 -static int first_tok = 0;
48 +extern int first_tok;
49 +int first_tok = 0;
50 %}
51 digit [0-9]
52 specnumber [1-9][0-9]*
53 @@ -766,7 +767,7 @@
54 if (0)
55 {
56 yyunput(0, NULL);
57 - yy_flex_realloc(0, NULL);
58 + yy_flex_realloc(NULL, 0);
59 }
60
61 return en;
62 Index: keynote-2.3/keynote-ver.l
63 ===================================================================
64 --- keynote-2.3.orig/keynote-ver.l 2007-06-04 13:22:41.301576488 +0200
65 +++ keynote-2.3/keynote-ver.l 2007-06-04 13:22:41.390562960 +0200
66 @@ -267,7 +267,7 @@
67 if (0)
68 {
69 yyunput(0, NULL);
70 - yy_flex_realloc(0, NULL);
71 + yy_flex_realloc(NULL, 0);
72 }
73 }
74
75 Index: keynote-2.3/keynote-ver.y
76 ===================================================================
77 --- keynote-2.3.orig/keynote-ver.y 2007-06-04 13:22:41.306575728 +0200
78 +++ keynote-2.3/keynote-ver.y 2007-06-04 13:22:41.390562960 +0200
79 @@ -49,7 +49,7 @@
80 return keynote_errno;
81 free($1);
82 }
83 -
84 + ;
85 expr: VSTRING EQ STRING { int i = kn_add_action(sessid, $1, $3, 0);
86
87 if (i != 0)
88 @@ -64,6 +64,7 @@
89 free($1);
90 free($3);
91 } expr
92 + ;
93 %%
94 void
95 kverror(char *s)
96 Index: keynote-2.3/keynote.y
97 ===================================================================
98 --- keynote-2.3.orig/keynote.y 2007-06-04 13:22:41.311574968 +0200
99 +++ keynote-2.3/keynote.y 2007-06-04 13:22:41.391562808 +0200
100 @@ -73,8 +73,7 @@
101 %}
102 %%
103
104 -grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; }
105 - localinit
106 +grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; } localinit
107 | ACTSTR { keynote_exceptionflag = keynote_donteval = 0; } program
108 | KEYPRE { keynote_exceptionflag = keynote_donteval = 0; }
109 keypredicate
110 @@ -91,17 +90,17 @@
111 STRING { keynote_lex_remove($3);
112 keynote_privkey = $3;
113 }
114 -
115 + ;
116 keypredicate: /* Nothing */ { keynote_returnvalue = 0;
117 return 0;
118 }
119 | notemptykeypredicate { keynote_returnvalue = $1;
120 return 0;
121 }
122 -
123 + ;
124 notemptykeypredicate: key { $$ = $1; }
125 | keyexp { $$ = $1; }
126 -
127 + ;
128 keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord)
129 keynote_donteval = 1;
130 } notemptykeypredicate
131 @@ -138,7 +137,7 @@
132 else
133 $$ = 0;
134 } /* K-th */
135 -
136 + ;
137 keylist: key
138 { /* Don't do anything if we're just recording */
139 if (!keynote_justrecord && !keynote_donteval)
140 @@ -155,7 +154,7 @@
141
142 keylistcount++;
143 }
144 -
145 + ;
146 key: str {
147 if (keynote_donteval)
148 $$ = 0;
149 @@ -193,10 +192,10 @@
150 }
151 }
152 }
153 -
154 + ;
155 localinit: /* Nothing */
156 | localconstants
157 -
158 + ;
159 localconstants: VARIABLE EQQ STRING
160 {
161 int i;
162 @@ -265,12 +264,12 @@
163 if (i != RESULT_TRUE)
164 return -1;
165 } localconstants
166 -
167 + ;
168 program: prog {
169 keynote_returnvalue = $1;
170 return 0;
171 }
172 -
173 + ;
174 prog: /* Nada */ { $$ = 0; }
175 | notemptyprog {
176 /*
177 @@ -285,7 +284,7 @@
178 else
179 $$ = $4;
180 }
181 -
182 + ;
183 notemptyprog: expr HINT afterhint
184 {
185 if (checkexception($1))
186 @@ -300,7 +299,7 @@
187 else
188 $$ = 0;
189 }
190 -
191 + ;
192 afterhint: str { if (keynote_exceptionflag || keynote_donteval)
193 $$ = 0;
194 else
195 @@ -315,7 +314,7 @@
196 }
197 }
198 | OPENBLOCK prog CLOSEBLOCK { $$ = $2; }
199 -
200 + ;
201
202 expr: OPENPAREN expr CLOSEPAREN { $$ = $2; }
203 | expr AND { if ($1 == 0)
204 @@ -334,19 +333,19 @@
205 | stringexp { $$ = $1; }
206 | TRUE { $$ = 1; }
207 | FALSE { $$ = 0; }
208 -
209 + ;
210 numexp: numex LT numex { $$ = $1 < $3; }
211 | numex GT numex { $$ = $1 > $3; }
212 | numex EQ numex { $$ = $1 == $3; }
213 | numex LE numex { $$ = $1 <= $3; }
214 | numex GE numex { $$ = $1 >= $3; }
215 | numex NE numex { $$ = $1 != $3; }
216 -
217 + ;
218 floatexp: floatex LT floatex { $$ = $1 < $3; }
219 | floatex GT floatex { $$ = $1 > $3; }
220 | floatex LE floatex { $$ = $1 <= $3; }
221 | floatex GE floatex { $$ = $1 >= $3; }
222 -
223 + ;
224 numex: numex PLUS numex { $$ = $1 + $3; }
225 | numex MINUS numex { $$ = $1 - $3; }
226 | numex MULT numex { $$ = $1 * $3; }
227 @@ -384,7 +383,7 @@
228 free($2);
229 }
230 }
231 -
232 + ;
233 floatex: floatex PLUS floatex { $$ = ($1 + $3); }
234 | floatex MINUS floatex { $$ = ($1 - $3); }
235 | floatex MULT floatex { $$ = ($1 * $3); }
236 @@ -418,7 +417,7 @@
237 free($2);
238 }
239 }
240 -
241 + ;
242 stringexp: str EQ str {
243 if (keynote_exceptionflag || keynote_donteval)
244 $$ = 0;
245 @@ -529,9 +528,9 @@
246 if (i == 0)
247 {
248 #if !defined(HAVE_SNPRINTF)
249 - sprintf(grp, "%d", preg.re_nsub);
250 + sprintf(grp, "%d", (int)preg.re_nsub);
251 #else /* !HAVE_SNPRINTF */
252 - snprintf(grp, 3, "%d", preg.re_nsub);
253 + snprintf(grp, 3, "%d", (int)preg.re_nsub);
254 #endif /* !HAVE_SNPRINTF */
255 if (keynote_env_add("_0", grp, &keynote_temp_list,
256 1, 0) != RESULT_TRUE)
257 @@ -579,7 +578,7 @@
258 }
259 }
260 }
261 -
262 + ;
263 str: str DOTT str { if (keynote_exceptionflag || keynote_donteval)
264 $$ = (char *) NULL;
265 else
266 @@ -605,7 +604,7 @@
267 }
268 }
269 | strnotconcat { $$ = $1; }
270 -
271 + ;
272 strnotconcat: STRING { $$ = $1; }
273 | OPENPAREN str CLOSEPAREN { $$ = $2; }
274 | VARIABLE { if (keynote_exceptionflag || keynote_donteval)
275 @@ -660,6 +659,7 @@
276 return -1;
277 }
278 }
279 + ;
280 %%
281
282 /*
283 Index: keynote-2.3/Makefile.in
284 ===================================================================
285 --- keynote-2.3.orig/Makefile.in 2007-06-04 13:22:41.317574056 +0200
286 +++ keynote-2.3/Makefile.in 2007-06-04 13:22:41.391562808 +0200
287 @@ -41,7 +41,8 @@
288 YACCFLAGS = -d -p kn -b k
289 LEXFLAGS2 = -Pkv -s -i
290 LEXFLAGS = -Cr -Pkn -s -i
291 -CFLAGS = -O2 -Wall # -g
292 +CFLAGS = -O2 -Wall -fno-strict-aliasing # -g
293 +LDFLAGS = @LDFLAGS@
294 RMFLAGS2 = -rf
295 RMFLAGS = -f
296 NROFFFLAGS = -mandoc
297 @@ -83,7 +84,7 @@
298 $(RANLIB) $(TARGET)
299
300 $(TARGET2): $(TARGET) $(OBJS2)
301 - $(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LIBS)
302 + $(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LDFLAGS) $(LIBS)
303
304 k.tab.c: keynote.y header.h keynote.h assertion.h config.h
305 $(YACC) $(YACCFLAGS) keynote.y
306 Index: keynote-2.3/signature.c
307 ===================================================================
308 --- keynote-2.3.orig/signature.c 2007-06-04 13:22:41.323573144 +0200
309 +++ keynote-2.3/signature.c 2007-06-04 13:22:41.392562656 +0200
310 @@ -515,7 +515,7 @@
311 kk = dc->dec_key;
312 if (keytype == KEYNOTE_PRIVATE_KEY)
313 {
314 - if (d2i_DSAPrivateKey((DSA **) &kk, &decoded, len) == (DSA *) NULL)
315 + if (d2i_DSAPrivateKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL)
316 {
317 if (ptr != (unsigned char *) NULL)
318 free(ptr);
319 @@ -526,7 +526,7 @@
320 }
321 else
322 {
323 - if (d2i_DSAPublicKey((DSA **) &kk, &decoded, len) == (DSA *) NULL)
324 + if (d2i_DSAPublicKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL)
325 {
326 if (ptr != (unsigned char *) NULL)
327 free(ptr);
328 @@ -556,7 +556,7 @@
329 kk = dc->dec_key;
330 if (keytype == KEYNOTE_PRIVATE_KEY)
331 {
332 - if (d2i_RSAPrivateKey((RSA **) &kk, &decoded, len) == (RSA *) NULL)
333 + if (d2i_RSAPrivateKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL)
334 {
335 if (ptr != (unsigned char *) NULL)
336 free(ptr);
337 @@ -567,7 +567,7 @@
338 }
339 else
340 {
341 - if (d2i_RSAPublicKey((RSA **) &kk, &decoded, len) == (RSA *) NULL)
342 + if (d2i_RSAPublicKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL)
343 {
344 if (ptr != (unsigned char *) NULL)
345 free(ptr);