1 |
commit: 46cd57a736c30bafd41406781e7b1c6532e6a97d |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 21 00:27:14 2011 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 21 00:46:38 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=46cd57a7 |
7 |
|
8 |
fix up unused variable warnings |
9 |
|
10 |
Some of these are unused, so drop them. Others are only used in debug |
11 |
code, so refactor those so things are always compiled. |
12 |
|
13 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
14 |
|
15 |
--- |
16 |
lib/arcnet.c | 32 ++++++++++++++------------------ |
17 |
lib/ax25.c | 27 +++++++++++++++------------ |
18 |
lib/ether.c | 32 ++++++++++++++------------------ |
19 |
lib/eui64.c | 37 +++++++++++++++++-------------------- |
20 |
lib/fddi.c | 32 ++++++++++++++------------------ |
21 |
lib/hippi.c | 32 ++++++++++++++------------------ |
22 |
lib/ib.c | 10 +++++++--- |
23 |
lib/inet6_gr.c | 8 +++----- |
24 |
lib/ipx.c | 2 -- |
25 |
lib/netrom.c | 27 +++++++++++++++------------ |
26 |
lib/rose.c | 11 ----------- |
27 |
lib/tr.c | 32 ++++++++++++++------------------ |
28 |
12 files changed, 127 insertions(+), 155 deletions(-) |
29 |
|
30 |
diff --git a/lib/arcnet.c b/lib/arcnet.c |
31 |
index 35a2b9a..10b59e5 100644 |
32 |
--- a/lib/arcnet.c |
33 |
+++ b/lib/arcnet.c |
34 |
@@ -43,6 +43,11 @@ static const char *pr_arcnet(const char *ptr) |
35 |
return (buff); |
36 |
} |
37 |
|
38 |
+#ifdef DEBUG |
39 |
+#define _DEBUG 1 |
40 |
+#else |
41 |
+#define _DEBUG 0 |
42 |
+#endif |
43 |
|
44 |
/* Input an ARCnet address and convert to binary. */ |
45 |
static int in_arcnet(char *bufp, struct sockaddr *sap) |
46 |
@@ -66,9 +71,8 @@ static int in_arcnet(char *bufp, struct sockaddr *sap) |
47 |
else if (c >= 'A' && c <= 'F') |
48 |
val = c - 'A' + 10; |
49 |
else { |
50 |
-#ifdef DEBUG |
51 |
- fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig); |
52 |
-#endif |
53 |
+ if (_DEBUG) |
54 |
+ fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig); |
55 |
errno = EINVAL; |
56 |
return (-1); |
57 |
} |
58 |
@@ -81,9 +85,8 @@ static int in_arcnet(char *bufp, struct sockaddr *sap) |
59 |
else if (c >= 'A' && c <= 'F') |
60 |
val |= c - 'A' + 10; |
61 |
else { |
62 |
-#ifdef DEBUG |
63 |
- fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig); |
64 |
-#endif |
65 |
+ if (_DEBUG) |
66 |
+ fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig); |
67 |
errno = EINVAL; |
68 |
return (-1); |
69 |
} |
70 |
@@ -92,28 +95,21 @@ static int in_arcnet(char *bufp, struct sockaddr *sap) |
71 |
|
72 |
/* We might get a semicolon here - not required. */ |
73 |
if (*bufp == ':') { |
74 |
- if (i == ETH_ALEN) { |
75 |
-#ifdef DEBUG |
76 |
+ if (_DEBUG && i == ETH_ALEN) |
77 |
fprintf(stderr, _("in_arcnet(%s): trailing : ignored!\n"), |
78 |
- orig) |
79 |
-#endif |
80 |
- ; /* nothing */ |
81 |
- } |
82 |
+ orig); |
83 |
bufp++; |
84 |
} |
85 |
} |
86 |
|
87 |
/* That's it. Any trailing junk? */ |
88 |
- if ((i == ETH_ALEN) && (*bufp != '\0')) { |
89 |
-#ifdef DEBUG |
90 |
+ if (_DEBUG && (i == ETH_ALEN) && (*bufp != '\0')) { |
91 |
fprintf(stderr, _("in_arcnet(%s): trailing junk!\n"), orig); |
92 |
errno = EINVAL; |
93 |
return (-1); |
94 |
-#endif |
95 |
} |
96 |
-#ifdef DEBUG |
97 |
- fprintf(stderr, "in_arcnet(%s): %s\n", orig, pr_arcnet(sap->sa_data)); |
98 |
-#endif |
99 |
+ if (_DEBUG) |
100 |
+ fprintf(stderr, "in_arcnet(%s): %s\n", orig, pr_arcnet(sap->sa_data)); |
101 |
|
102 |
return (0); |
103 |
} |
104 |
|
105 |
diff --git a/lib/ax25.c b/lib/ax25.c |
106 |
index 209e479..afc035b 100644 |
107 |
--- a/lib/ax25.c |
108 |
+++ b/lib/ax25.c |
109 |
@@ -76,6 +76,11 @@ static const char * |
110 |
return (AX25_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call)); |
111 |
} |
112 |
|
113 |
+#ifdef DEBUG |
114 |
+#define _DEBUG 1 |
115 |
+#else |
116 |
+#define _DEBUG 0 |
117 |
+#endif |
118 |
|
119 |
static int AX25_input(int type, char *bufp, struct sockaddr *sap) |
120 |
{ |
121 |
@@ -95,9 +100,8 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap) |
122 |
c = toupper(c); |
123 |
if (!(isupper(c) || isdigit(c))) { |
124 |
safe_strncpy(AX25_errmsg, _("Invalid callsign"), sizeof(AX25_errmsg)); |
125 |
-#ifdef DEBUG |
126 |
- fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig); |
127 |
-#endif |
128 |
+ if (_DEBUG) |
129 |
+ fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig); |
130 |
errno = EINVAL; |
131 |
return (-1); |
132 |
} |
133 |
@@ -108,9 +112,8 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap) |
134 |
/* Callsign too long? */ |
135 |
if ((i == 6) && (*bufp != '-') && (*bufp != '\0')) { |
136 |
strcpy(AX25_errmsg, _("Callsign too long")); |
137 |
-#ifdef DEBUG |
138 |
- fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig); |
139 |
-#endif |
140 |
+ if (_DEBUG) |
141 |
+ fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig); |
142 |
errno = E2BIG; |
143 |
return (-1); |
144 |
} |
145 |
@@ -128,12 +131,12 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap) |
146 |
} |
147 |
|
148 |
/* All done. */ |
149 |
-#ifdef DEBUG |
150 |
- fprintf(stderr, "ax25_input(%s): ", orig); |
151 |
- for (i = 0; i < sizeof(ax25_address); i++) |
152 |
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); |
153 |
- fprintf(stderr, "\n"); |
154 |
-#endif |
155 |
+ if (_DEBUG) { |
156 |
+ fprintf(stderr, "ax25_input(%s): ", orig); |
157 |
+ for (i = 0; i < sizeof(ax25_address); i++) |
158 |
+ fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); |
159 |
+ fprintf(stderr, "\n"); |
160 |
+ } |
161 |
|
162 |
return (0); |
163 |
} |
164 |
|
165 |
diff --git a/lib/ether.c b/lib/ether.c |
166 |
index ddd1598..9bf8a55 100644 |
167 |
--- a/lib/ether.c |
168 |
+++ b/lib/ether.c |
169 |
@@ -46,6 +46,11 @@ static const char *pr_ether(const char *ptr) |
170 |
return (buff); |
171 |
} |
172 |
|
173 |
+#ifdef DEBUG |
174 |
+#define _DEBUG 1 |
175 |
+#else |
176 |
+#define _DEBUG 0 |
177 |
+#endif |
178 |
|
179 |
/* Input an Ethernet address and convert to binary. */ |
180 |
static int in_ether(char *bufp, struct sockaddr *sap) |
181 |
@@ -70,9 +75,8 @@ static int in_ether(char *bufp, struct sockaddr *sap) |
182 |
else if (c >= 'A' && c <= 'F') |
183 |
val = c - 'A' + 10; |
184 |
else { |
185 |
-#ifdef DEBUG |
186 |
- fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig); |
187 |
-#endif |
188 |
+ if (_DEBUG) |
189 |
+ fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig); |
190 |
errno = EINVAL; |
191 |
return (-1); |
192 |
} |
193 |
@@ -87,9 +91,8 @@ static int in_ether(char *bufp, struct sockaddr *sap) |
194 |
else if (c == ':' || c == 0) |
195 |
val >>= 4; |
196 |
else { |
197 |
-#ifdef DEBUG |
198 |
- fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig); |
199 |
-#endif |
200 |
+ if (_DEBUG) |
201 |
+ fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig); |
202 |
errno = EINVAL; |
203 |
return (-1); |
204 |
} |
205 |
@@ -100,28 +103,21 @@ static int in_ether(char *bufp, struct sockaddr *sap) |
206 |
|
207 |
/* We might get a semicolon here - not required. */ |
208 |
if (*bufp == ':') { |
209 |
- if (i == ETH_ALEN) { |
210 |
-#ifdef DEBUG |
211 |
+ if (_DEBUG && i == ETH_ALEN) |
212 |
fprintf(stderr, _("in_ether(%s): trailing : ignored!\n"), |
213 |
- orig) |
214 |
-#endif |
215 |
- ; /* nothing */ |
216 |
- } |
217 |
+ orig); |
218 |
bufp++; |
219 |
} |
220 |
} |
221 |
|
222 |
/* That's it. Any trailing junk? */ |
223 |
- if ((i == ETH_ALEN) && (*bufp != '\0')) { |
224 |
-#ifdef DEBUG |
225 |
+ if (_DEBUG && (i == ETH_ALEN) && (*bufp != '\0')) { |
226 |
fprintf(stderr, _("in_ether(%s): trailing junk!\n"), orig); |
227 |
errno = EINVAL; |
228 |
return (-1); |
229 |
-#endif |
230 |
} |
231 |
-#ifdef DEBUG |
232 |
- fprintf(stderr, "in_ether(%s): %s\n", orig, pr_ether(sap->sa_data)); |
233 |
-#endif |
234 |
+ if (_DEBUG) |
235 |
+ fprintf(stderr, "in_ether(%s): %s\n", orig, pr_ether(sap->sa_data)); |
236 |
|
237 |
return (0); |
238 |
} |
239 |
|
240 |
diff --git a/lib/eui64.c b/lib/eui64.c |
241 |
index 6ab7d26..32822a3 100644 |
242 |
--- a/lib/eui64.c |
243 |
+++ b/lib/eui64.c |
244 |
@@ -60,6 +60,12 @@ static const char *pr_eui64(const char *ptr) |
245 |
return (buff); |
246 |
} |
247 |
|
248 |
+#ifdef DEBUG |
249 |
+#define _DEBUG 1 |
250 |
+#else |
251 |
+#define _DEBUG 0 |
252 |
+#endif |
253 |
+ |
254 |
/* Start the PPP encapsulation on the file descriptor. */ |
255 |
static int in_eui64( char *bufp, struct sockaddr *sap ) |
256 |
{ |
257 |
@@ -84,10 +90,9 @@ static int in_eui64( char *bufp, struct sockaddr *sap ) |
258 |
else if (c >= 'A' && c <= 'F') |
259 |
val = c - 'A' + 10; |
260 |
else { |
261 |
-#ifdef DEBUG |
262 |
- fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"), |
263 |
- orig ); |
264 |
-#endif |
265 |
+ if (_DEBUG) |
266 |
+ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"), |
267 |
+ orig ); |
268 |
errno = EINVAL; |
269 |
return (-1); |
270 |
} |
271 |
@@ -103,10 +108,9 @@ static int in_eui64( char *bufp, struct sockaddr *sap ) |
272 |
else if (c == ':' || c == 0) |
273 |
val >>= 4; |
274 |
else { |
275 |
-#ifdef DEBUG |
276 |
- fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"), |
277 |
- orig ); |
278 |
-#endif |
279 |
+ if (_DEBUG) |
280 |
+ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"), |
281 |
+ orig ); |
282 |
errno = EINVAL; |
283 |
return (-1); |
284 |
} |
285 |
@@ -119,28 +123,21 @@ static int in_eui64( char *bufp, struct sockaddr *sap ) |
286 |
|
287 |
/* We might get a semicolon here - not required. */ |
288 |
if (*bufp == ':') { |
289 |
- if (i == EUI64_ALEN) { |
290 |
-#ifdef DEBUG |
291 |
+ if (_DEBUG && i == EUI64_ALEN) |
292 |
fprintf(stderr, _("in_eui64(%s): trailing : ignored!\n"), |
293 |
- orig) |
294 |
-#endif |
295 |
- ; /* nothing */ |
296 |
- } |
297 |
+ orig); |
298 |
bufp++; |
299 |
} |
300 |
} |
301 |
|
302 |
/* That's it. Any trailing junk? */ |
303 |
- if ((i == EUI64_ALEN) && (*bufp != '\0')) { |
304 |
-#ifdef DEBUG |
305 |
+ if (_DEBUG && (i == EUI64_ALEN) && (*bufp != '\0')) { |
306 |
fprintf(stderr, _("in_eui64(%s): trailing junk!\n"), orig); |
307 |
errno = EINVAL; |
308 |
return (-1); |
309 |
-#endif |
310 |
} |
311 |
-#ifdef DEBUG |
312 |
- fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data)); |
313 |
-#endif |
314 |
+ if (_DEBUG) |
315 |
+ fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data)); |
316 |
|
317 |
return (0); |
318 |
} |
319 |
|
320 |
diff --git a/lib/fddi.c b/lib/fddi.c |
321 |
index 75adddd..750cc2d 100644 |
322 |
--- a/lib/fddi.c |
323 |
+++ b/lib/fddi.c |
324 |
@@ -57,6 +57,11 @@ static const char *pr_fddi(const char *ptr) |
325 |
return (buff); |
326 |
} |
327 |
|
328 |
+#ifdef DEBUG |
329 |
+#define _DEBUG 1 |
330 |
+#else |
331 |
+#define _DEBUG 0 |
332 |
+#endif |
333 |
|
334 |
/* Input an FDDI address and convert to binary. */ |
335 |
static int in_fddi(char *bufp, struct sockaddr *sap) |
336 |
@@ -80,9 +85,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap) |
337 |
else if (c >= 'A' && c <= 'F') |
338 |
val = c - 'A' + 10; |
339 |
else { |
340 |
-#ifdef DEBUG |
341 |
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig); |
342 |
-#endif |
343 |
+ if (_DEBUG) |
344 |
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig); |
345 |
errno = EINVAL; |
346 |
return (-1); |
347 |
} |
348 |
@@ -95,9 +99,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap) |
349 |
else if (c >= 'A' && c <= 'F') |
350 |
val |= c - 'A' + 10; |
351 |
else { |
352 |
-#ifdef DEBUG |
353 |
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig); |
354 |
-#endif |
355 |
+ if (_DEBUG) |
356 |
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig); |
357 |
errno = EINVAL; |
358 |
return (-1); |
359 |
} |
360 |
@@ -106,28 +109,21 @@ static int in_fddi(char *bufp, struct sockaddr *sap) |
361 |
|
362 |
/* We might get a semicolon here - not required. */ |
363 |
if (*bufp == ':') { |
364 |
- if (i == FDDI_K_ALEN) { |
365 |
-#ifdef DEBUG |
366 |
+ if (_DEBUG && i == FDDI_K_ALEN) |
367 |
fprintf(stderr, _("in_fddi(%s): trailing : ignored!\n"), |
368 |
- orig) |
369 |
-#endif |
370 |
- ; /* nothing */ |
371 |
- } |
372 |
+ orig); |
373 |
bufp++; |
374 |
} |
375 |
} |
376 |
|
377 |
/* That's it. Any trailing junk? */ |
378 |
- if ((i == FDDI_K_ALEN) && (*bufp != '\0')) { |
379 |
-#ifdef DEBUG |
380 |
+ if (_DEBUG && (i == FDDI_K_ALEN) && (*bufp != '\0')) { |
381 |
fprintf(stderr, _("in_fddi(%s): trailing junk!\n"), orig); |
382 |
errno = EINVAL; |
383 |
return (-1); |
384 |
-#endif |
385 |
} |
386 |
-#ifdef DEBUG |
387 |
- fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data)); |
388 |
-#endif |
389 |
+ if (_DEBUG) |
390 |
+ fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data)); |
391 |
|
392 |
return (0); |
393 |
} |
394 |
|
395 |
diff --git a/lib/hippi.c b/lib/hippi.c |
396 |
index bd73ea1..ae6e31b 100644 |
397 |
--- a/lib/hippi.c |
398 |
+++ b/lib/hippi.c |
399 |
@@ -57,6 +57,11 @@ static const char *pr_hippi(const char *ptr) |
400 |
return (buff); |
401 |
} |
402 |
|
403 |
+#ifdef DEBUG |
404 |
+#define _DEBUG 1 |
405 |
+#else |
406 |
+#define _DEBUG 0 |
407 |
+#endif |
408 |
|
409 |
/* Input an HIPPI address and convert to binary. */ |
410 |
static int in_hippi(char *bufp, struct sockaddr *sap) |
411 |
@@ -80,9 +85,8 @@ static int in_hippi(char *bufp, struct sockaddr *sap) |
412 |
else if (c >= 'A' && c <= 'F') |
413 |
val = c - 'A' + 10; |
414 |
else { |
415 |
-#ifdef DEBUG |
416 |
- fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig); |
417 |
-#endif |
418 |
+ if (_DEBUG) |
419 |
+ fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig); |
420 |
errno = EINVAL; |
421 |
return (-1); |
422 |
} |
423 |
@@ -95,9 +99,8 @@ static int in_hippi(char *bufp, struct sockaddr *sap) |
424 |
else if (c >= 'A' && c <= 'F') |
425 |
val |= c - 'A' + 10; |
426 |
else { |
427 |
-#ifdef DEBUG |
428 |
- fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig); |
429 |
-#endif |
430 |
+ if (_DEBUG) |
431 |
+ fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig); |
432 |
errno = EINVAL; |
433 |
return (-1); |
434 |
} |
435 |
@@ -106,27 +109,20 @@ static int in_hippi(char *bufp, struct sockaddr *sap) |
436 |
|
437 |
/* We might get a semicolon here - not required. */ |
438 |
if (*bufp == ':') { |
439 |
- if (i == HIPPI_ALEN) { |
440 |
-#ifdef DEBUG |
441 |
- fprintf(stderr, _("in_hippi(%s): trailing : ignored!\n"), orig) |
442 |
-#endif |
443 |
- ; /* nothing */ |
444 |
- } |
445 |
+ if (_DEBUG && i == HIPPI_ALEN) |
446 |
+ fprintf(stderr, _("in_hippi(%s): trailing : ignored!\n"), orig); |
447 |
bufp++; |
448 |
} |
449 |
} |
450 |
|
451 |
/* That's it. Any trailing junk? */ |
452 |
- if ((i == HIPPI_ALEN) && (*bufp != '\0')) { |
453 |
-#ifdef DEBUG |
454 |
+ if (_DEBUG && (i == HIPPI_ALEN) && (*bufp != '\0')) { |
455 |
fprintf(stderr, _("in_hippi(%s): trailing junk!\n"), orig); |
456 |
errno = EINVAL; |
457 |
return (-1); |
458 |
-#endif |
459 |
} |
460 |
-#ifdef DEBUG |
461 |
- fprintf(stderr, "in_hippi(%s): %s\n", orig, pr_hippi(sap->sa_data)); |
462 |
-#endif |
463 |
+ if (_DEBUG) |
464 |
+ fprintf(stderr, "in_hippi(%s): %s\n", orig, pr_hippi(sap->sa_data)); |
465 |
|
466 |
return (0); |
467 |
} |
468 |
|
469 |
diff --git a/lib/ib.c b/lib/ib.c |
470 |
index e05bd3e..98f3446 100644 |
471 |
--- a/lib/ib.c |
472 |
+++ b/lib/ib.c |
473 |
@@ -56,6 +56,11 @@ static const char *pr_ib(const char *ptr) |
474 |
return (buff); |
475 |
} |
476 |
|
477 |
+#ifdef DEBUG |
478 |
+#define _DEBUG 1 |
479 |
+#else |
480 |
+#define _DEBUG 0 |
481 |
+#endif |
482 |
|
483 |
/* Input an Infiniband address and convert to binary. */ |
484 |
static int in_ib(char *bufp, struct sockaddr *sap) |
485 |
@@ -80,9 +85,8 @@ static int in_ib(char *bufp, struct sockaddr *sap) |
486 |
else if (c >= 'A' && c <= 'F') |
487 |
val = c - 'A' + 10; |
488 |
else { |
489 |
-#ifdef DEBUG |
490 |
- fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); |
491 |
-#endif |
492 |
+ if (_DEBUG) |
493 |
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); |
494 |
errno = EINVAL; |
495 |
return (-1); |
496 |
} |
497 |
|
498 |
diff --git a/lib/inet6_gr.c b/lib/inet6_gr.c |
499 |
index 7f1bc20..2b055f6 100644 |
500 |
--- a/lib/inet6_gr.c |
501 |
+++ b/lib/inet6_gr.c |
502 |
@@ -92,10 +92,8 @@ int rprint_fib6(int ext, int numeric) |
503 |
naddr6p[0], naddr6p[1], naddr6p[2], naddr6p[3], |
504 |
naddr6p[4], naddr6p[5], naddr6p[6], naddr6p[7], |
505 |
&metric, &refcnt, &use, &iflags, iface); |
506 |
-#if 0 |
507 |
- if (num < 23) |
508 |
+ if (0 && num < 23) |
509 |
continue; |
510 |
-#endif |
511 |
if (iflags & RTF_CACHE) { |
512 |
if (!(numeric & RTF_CACHE)) |
513 |
continue; |
514 |
@@ -163,7 +161,7 @@ int rprint_cache6(int ext, int numeric) |
515 |
char buff[4096], iface[16], flags[16]; |
516 |
char addr6[128], haddr[20], statestr[20]; |
517 |
struct sockaddr_in6 saddr6; |
518 |
- int type, num, refcnt, prefix_len, location, state, gc; |
519 |
+ int type, refcnt, prefix_len, location, state, gc; |
520 |
long tstamp, expire, ndflags, reachable, stale, delete; |
521 |
FILE *fp = fopen(_PATH_PROCNET_NDISC, "r"); |
522 |
char addr6p[8][5], haddrp[6][3]; |
523 |
@@ -184,7 +182,7 @@ int rprint_cache6(int ext, int numeric) |
524 |
|
525 |
|
526 |
while (fgets(buff, 1023, fp)) { |
527 |
- num = sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %08lx %08lx %08lx %04x %04x %04lx %8s %2s%2s%2s%2s%2s%2s\n", |
528 |
+ sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %08lx %08lx %08lx %04x %04x %04lx %8s %2s%2s%2s%2s%2s%2s\n", |
529 |
addr6p[0], addr6p[1], addr6p[2], addr6p[3], |
530 |
addr6p[4], addr6p[5], addr6p[6], addr6p[7], |
531 |
&location, &prefix_len, &type, &state, &expire, &tstamp, &reachable, &gc, &refcnt, |
532 |
|
533 |
diff --git a/lib/ipx.c b/lib/ipx.c |
534 |
index 1359f5f..f90c96c 100644 |
535 |
--- a/lib/ipx.c |
536 |
+++ b/lib/ipx.c |
537 |
@@ -87,12 +87,10 @@ static int IPX_getsock(char *bufp, struct sockaddr *sap) |
538 |
{ |
539 |
char *sp = bufp, *bp; |
540 |
unsigned int i; |
541 |
- unsigned char val; |
542 |
struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) sap; |
543 |
|
544 |
sipx->sipx_port = 0; |
545 |
|
546 |
- val = 0; |
547 |
bp = (char *) sipx->sipx_node; |
548 |
for (i = 0; i < sizeof(sipx->sipx_node); i++) { |
549 |
*sp = toupper(*sp); |
550 |
|
551 |
diff --git a/lib/netrom.c b/lib/netrom.c |
552 |
index f3033c7..254bd61 100644 |
553 |
--- a/lib/netrom.c |
554 |
+++ b/lib/netrom.c |
555 |
@@ -79,6 +79,11 @@ static const char *NETROM_sprint(struct sockaddr *sap, int numeric) |
556 |
return (NETROM_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call)); |
557 |
} |
558 |
|
559 |
+#ifdef DEBUG |
560 |
+#define _DEBUG 1 |
561 |
+#else |
562 |
+#define _DEBUG 0 |
563 |
+#endif |
564 |
|
565 |
static int NETROM_input(int type, char *bufp, struct sockaddr *sap) |
566 |
{ |
567 |
@@ -98,9 +103,8 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap) |
568 |
c = toupper(c); |
569 |
if (!(isupper(c) || isdigit(c))) { |
570 |
safe_strncpy(netrom_errmsg, _("Invalid callsign"), sizeof(netrom_errmsg)); |
571 |
-#ifdef DEBUG |
572 |
- fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig); |
573 |
-#endif |
574 |
+ if (_DEBUG) |
575 |
+ fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig); |
576 |
errno = EINVAL; |
577 |
return (-1); |
578 |
} |
579 |
@@ -111,9 +115,8 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap) |
580 |
/* Callsign too long? */ |
581 |
if ((i == 6) && (*bufp != '-') && (*bufp != '\0')) { |
582 |
safe_strncpy(netrom_errmsg, _("Callsign too long"), sizeof(netrom_errmsg)); |
583 |
-#ifdef DEBUG |
584 |
- fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig); |
585 |
-#endif |
586 |
+ if (_DEBUG) |
587 |
+ fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig); |
588 |
errno = E2BIG; |
589 |
return (-1); |
590 |
} |
591 |
@@ -131,12 +134,12 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap) |
592 |
} |
593 |
|
594 |
/* All done. */ |
595 |
-#ifdef DEBUG |
596 |
- fprintf(stderr, "netrom_input(%s): ", orig); |
597 |
- for (i = 0; i < sizeof(ax25_address); i++) |
598 |
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); |
599 |
- fprintf(stderr, "\n"); |
600 |
-#endif |
601 |
+ if (_DEBUG) { |
602 |
+ fprintf(stderr, "netrom_input(%s): ", orig); |
603 |
+ for (i = 0; i < sizeof(ax25_address); i++) |
604 |
+ fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); |
605 |
+ fprintf(stderr, "\n"); |
606 |
+ } |
607 |
|
608 |
return (0); |
609 |
} |
610 |
|
611 |
diff --git a/lib/rose.c b/lib/rose.c |
612 |
index 52d025a..c02e741 100644 |
613 |
--- a/lib/rose.c |
614 |
+++ b/lib/rose.c |
615 |
@@ -73,7 +73,6 @@ static const char * |
616 |
return (ROSE_print(((struct sockaddr_rose *) sap)->srose_addr.rose_addr)); |
617 |
} |
618 |
|
619 |
- |
620 |
static int ROSE_input(int type, char *bufp, struct sockaddr *sap) |
621 |
{ |
622 |
char *ptr; |
623 |
@@ -85,9 +84,6 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap) |
624 |
/* Node address the correct length ? */ |
625 |
if (strlen(bufp) != 10) { |
626 |
strcpy(ROSE_errmsg, _("Node address must be ten digits")); |
627 |
-#ifdef DEBUG |
628 |
- fprintf(stderr, "rose_input(%s): %s !\n", ROSE_errmsg, orig); |
629 |
-#endif |
630 |
errno = EINVAL; |
631 |
return (-1); |
632 |
} |
633 |
@@ -98,13 +94,6 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap) |
634 |
} |
635 |
|
636 |
/* All done. */ |
637 |
-#ifdef DEBUG |
638 |
- fprintf(stderr, "rose_input(%s): ", orig); |
639 |
- for (i = 0; i < sizeof(rose_address); i++) |
640 |
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377); |
641 |
- fprintf(stderr, "\n"); |
642 |
-#endif |
643 |
- |
644 |
return (0); |
645 |
} |
646 |
|
647 |
|
648 |
diff --git a/lib/tr.c b/lib/tr.c |
649 |
index 961cdb1..a0413f4 100644 |
650 |
--- a/lib/tr.c |
651 |
+++ b/lib/tr.c |
652 |
@@ -50,6 +50,11 @@ static const char *pr_tr(const char *ptr) |
653 |
return (buff); |
654 |
} |
655 |
|
656 |
+#ifdef DEBUG |
657 |
+#define _DEBUG 1 |
658 |
+#else |
659 |
+#define _DEBUG 0 |
660 |
+#endif |
661 |
|
662 |
static int in_tr(char *bufp, struct sockaddr *sap) |
663 |
{ |
664 |
@@ -82,9 +87,8 @@ static int in_tr(char *bufp, struct sockaddr *sap) |
665 |
else if (c >= 'A' && c <= 'F') |
666 |
val = c - 'A' + 10; |
667 |
else { |
668 |
-#ifdef DEBUG |
669 |
- fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig); |
670 |
-#endif |
671 |
+ if (_DEBUG) |
672 |
+ fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig); |
673 |
errno = EINVAL; |
674 |
return (-1); |
675 |
} |
676 |
@@ -97,9 +101,8 @@ static int in_tr(char *bufp, struct sockaddr *sap) |
677 |
else if (c >= 'A' && c <= 'F') |
678 |
val |= c - 'A' + 10; |
679 |
else { |
680 |
-#ifdef DEBUG |
681 |
- fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig); |
682 |
-#endif |
683 |
+ if (_DEBUG) |
684 |
+ fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig); |
685 |
errno = EINVAL; |
686 |
return (-1); |
687 |
} |
688 |
@@ -108,28 +111,21 @@ static int in_tr(char *bufp, struct sockaddr *sap) |
689 |
|
690 |
/* We might get a semicolon here - not required. */ |
691 |
if (*bufp == ':') { |
692 |
- if (i == TR_ALEN) { |
693 |
-#ifdef DEBUG |
694 |
+ if (_DEBUG && i == TR_ALEN) |
695 |
fprintf(stderr, _("in_tr(%s): trailing : ignored!\n"), |
696 |
- orig) |
697 |
-#endif |
698 |
- ; /* nothing */ |
699 |
- } |
700 |
+ orig); |
701 |
bufp++; |
702 |
} |
703 |
} |
704 |
|
705 |
/* That's it. Any trailing junk? */ |
706 |
- if ((i == TR_ALEN) && (*bufp != '\0')) { |
707 |
-#ifdef DEBUG |
708 |
+ if (_DEBUG && (i == TR_ALEN) && (*bufp != '\0')) { |
709 |
fprintf(stderr, _("in_tr(%s): trailing junk!\n"), orig); |
710 |
errno = EINVAL; |
711 |
return (-1); |
712 |
-#endif |
713 |
} |
714 |
-#ifdef DEBUG |
715 |
- fprintf(stderr, "in_tr(%s): %s\n", orig, pr_tr(sap->sa_data)); |
716 |
-#endif |
717 |
+ if (_DEBUG) |
718 |
+ fprintf(stderr, "in_tr(%s): %s\n", orig, pr_tr(sap->sa_data)); |
719 |
|
720 |
return (0); |
721 |
} |