From 1430e0c1fd42ea5a87f4861445e4c30809e4da57 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Sun, 7 Sep 2014 22:40:31 +0000 Subject: Remove useless comment, snprintf and if/else. OK mpi@ --- usr.sbin/arp/arp.c | 7 ++----- usr.sbin/ndp/ndp.c | 24 +++++------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 8f243a4c834..3c070fbd579 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arp.c,v 1.61 2014/09/03 10:39:41 mpi Exp $ */ +/* $OpenBSD: arp.c,v 1.62 2014/09/07 22:40:30 bluhm Exp $ */ /* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */ /* @@ -531,7 +531,6 @@ print_entry(struct sockaddr_dl *sdl, struct sockaddr_inarp *sin, struct hostent *hp = NULL; int addrwidth, llwidth, ifwidth ; struct timeval now; - char flgbuf[8]; gettimeofday(&now, 0); @@ -569,12 +568,10 @@ print_entry(struct sockaddr_dl *sdl, struct sockaddr_inarp *sin, else printf(" %-10.10s", "expired"); - snprintf(flgbuf, sizeof(flgbuf), "%s%s%s", + printf(" %s%s%s\n", (rtm->rtm_flags & RTF_LOCAL) ? "l" : "", (sin->sin_other & SIN_PROXY) ? "P" : "", (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : ""); - - printf(" %s\n", flgbuf); } /* diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 9655df21a51..73a7b60678d 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ndp.c,v 1.57 2014/09/03 10:39:41 mpi Exp $ */ +/* $OpenBSD: ndp.c,v 1.58 2014/09/07 22:40:30 bluhm Exp $ */ /* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */ /* @@ -564,7 +564,6 @@ dump(struct in6_addr *addr, int cflag) int addrwidth; int llwidth; int ifwidth; - char flgbuf[8]; char *ifname; /* Print header */ @@ -710,23 +709,10 @@ again:; printf(" "); } - /* - * other flags. R: router, P: proxy, W: ?? - */ - if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { - snprintf(flgbuf, sizeof(flgbuf), "%s%s%s", - (rtm->rtm_flags & RTF_LOCAL) ? "l" : "", - isrouter ? "R" : "", - (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : ""); - } else { - sin = (struct sockaddr_in6 *) - (sdl->sdl_len + (char *)sdl); - snprintf(flgbuf, sizeof(flgbuf), "%s%s%s", - (rtm->rtm_flags & RTF_LOCAL) ? "l" : "", - isrouter ? "R" : "", - (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : ""); - } - printf(" %s", flgbuf); + printf(" %s%s%s", + (rtm->rtm_flags & RTF_LOCAL) ? "l" : "", + isrouter ? "R" : "", + (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : ""); if (prbs) printf(" %d", prbs); -- cgit v1.2.3