Tue Mar 17 00:53:42 2009 UTC ()
fix sign-compare issues


(lukem)
diff -r1.38 -r1.39 src/sbin/route/show.c

cvs diff -r1.38 -r1.39 src/sbin/route/show.c (expand / switch to unified diff)

--- src/sbin/route/show.c 2008/09/10 01:06:58 1.38
+++ src/sbin/route/show.c 2009/03/17 00:53:42 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: show.c,v 1.38 2008/09/10 01:06:58 dyoung Exp $ */ 1/* $NetBSD: show.c,v 1.39 2009/03/17 00:53:42 lukem Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1988, 1993 4 * Copyright (c) 1983, 1988, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34#if 0 34#if 0
35static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; 35static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
36#else 36#else
37__RCSID("$NetBSD: show.c,v 1.38 2008/09/10 01:06:58 dyoung Exp $"); 37__RCSID("$NetBSD: show.c,v 1.39 2009/03/17 00:53:42 lukem Exp $");
38#endif 38#endif
39#endif /* not lint */ 39#endif /* not lint */
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/protosw.h> 42#include <sys/protosw.h>
43#include <sys/socket.h> 43#include <sys/socket.h>
44#include <sys/mbuf.h> 44#include <sys/mbuf.h>
45 45
46#include <net/if.h> 46#include <net/if.h>
47#include <net/if_dl.h> 47#include <net/if_dl.h>
48#include <net/if_types.h> 48#include <net/if_types.h>
49#include <net/route.h> 49#include <net/route.h>
50#include <netinet/in.h> 50#include <netinet/in.h>
@@ -347,27 +347,27 @@ p_sockaddr(struct sockaddr *sa, struct s @@ -347,27 +347,27 @@ p_sockaddr(struct sockaddr *sa, struct s
347 NULL, 0, NI_NUMERICHOST) != 0) 347 NULL, 0, NI_NUMERICHOST) != 0)
348 strlcpy(workbuf, "invalid", sizeof(workbuf)); 348 strlcpy(workbuf, "invalid", sizeof(workbuf));
349 cp = workbuf; 349 cp = workbuf;
350 break; 350 break;
351 351
352 case AF_INET: 352 case AF_INET:
353 cp = routename(sa, nm, flags); 353 cp = routename(sa, nm, flags);
354 break; 354 break;
355 355
356#ifdef INET6 356#ifdef INET6
357 case AF_INET6: 357 case AF_INET6:
358 cp = routename(sa, nm, flags); 358 cp = routename(sa, nm, flags);
359 /* make sure numeric address is not truncated */ 359 /* make sure numeric address is not truncated */
360 if (strchr(cp, ':') != NULL && strlen(cp) > width) 360 if (strchr(cp, ':') != NULL && (int)strlen(cp) > width)
361 width = strlen(cp); 361 width = strlen(cp);
362 break; 362 break;
363#endif /* INET6 */ 363#endif /* INET6 */
364 364
365#ifndef SMALL 365#ifndef SMALL
366#endif /* SMALL */ 366#endif /* SMALL */
367 367
368 default: 368 default:
369 { 369 {
370 u_char *s = (u_char *)sa->sa_data, *slim; 370 u_char *s = (u_char *)sa->sa_data, *slim;
371 char *wp = workbuf, *wplim; 371 char *wp = workbuf, *wplim;
372 372
373 slim = sa->sa_len + (u_char *)sa; 373 slim = sa->sa_len + (u_char *)sa;