Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/route More style nits (KNF); casts and sizeof's are not...
details: https://anonhg.NetBSD.org/src/rev/3c3dfd3defee
branches: trunk
changeset: 583497:3c3dfd3defee
user: ginsbach <ginsbach%NetBSD.org@localhost>
date: Tue Aug 09 19:43:24 2005 +0000
description:
More style nits (KNF); casts and sizeof's are not followed by a space.
diffstat:
sbin/route/ccitt_addr.c | 10 ++--
sbin/route/route.c | 110 ++++++++++++++++++++++++------------------------
sbin/route/show.c | 14 ++---
3 files changed, 66 insertions(+), 68 deletions(-)
diffs (truncated from 489 to 300 lines):
diff -r d061b3cdfd6d -r 3c3dfd3defee sbin/route/ccitt_addr.c
--- a/sbin/route/ccitt_addr.c Tue Aug 09 19:26:24 2005 +0000
+++ b/sbin/route/ccitt_addr.c Tue Aug 09 19:43:24 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ccitt_addr.c,v 1.14 2005/02/05 14:05:23 xtraeme Exp $ */
+/* $NetBSD: ccitt_addr.c,v 1.15 2005/08/09 19:43:24 ginsbach Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -64,7 +64,7 @@
char *p, *ap, *limit;
int havenet = 0;
- memset(xp, 0, sizeof (*xp));
+ memset(xp, 0, sizeof(*xp));
xp->x25_family = AF_CCITT;
xp->x25_len = sizeof(*xp);
p = addr;
@@ -93,7 +93,7 @@
*/
ap = xp->x25_addr;
- limit = ap + sizeof (xp->x25_addr) - 1;
+ limit = ap + sizeof(xp->x25_addr) - 1;
while (*p) {
if (*p == ',')
break;
@@ -101,7 +101,7 @@
if (havenet)
return (0);
havenet++;
- xp->x25_net = atoi (xp->x25_addr);
+ xp->x25_net = atoi(xp->x25_addr);
p++;
ap = xp->x25_addr;
*ap = '\0';
@@ -121,7 +121,7 @@
p++;
ap = xp->x25_udata + 4; /* first four bytes are protocol id */
- limit = ap + sizeof (xp->x25_udata) - 4;
+ limit = ap + sizeof(xp->x25_udata) - 4;
xp->x25_udlen = 4;
while (*p) {
if (*p == ',')
diff -r d061b3cdfd6d -r 3c3dfd3defee sbin/route/route.c
--- a/sbin/route/route.c Tue Aug 09 19:26:24 2005 +0000
+++ b/sbin/route/route.c Tue Aug 09 19:43:24 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.84 2005/07/20 21:12:40 ginsbach Exp $ */
+/* $NetBSD: route.c,v 1.85 2005/08/09 19:43:24 ginsbach Exp $ */
/*
* Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: route.c,v 1.84 2005/07/20 21:12:40 ginsbach Exp $");
+__RCSID("$NetBSD: route.c,v 1.85 2005/08/09 19:43:24 ginsbach Exp $");
#endif
#endif /* not lint */
@@ -123,7 +123,7 @@
int pid, rtm_addrs;
int sock;
int forcehost, forcenet, doflush, nflag, af, qflag, tflag;
-int iflag, verbose, aflen = sizeof (struct sockaddr_in);
+int iflag, verbose, aflen = sizeof(struct sockaddr_in);
int locking, lockrest, debugonly, shortoutput, rv;
struct rt_metrics rt_metrics;
u_int32_t rtm_inits;
@@ -137,7 +137,7 @@
if (cp)
warnx("botched keyword: %s", cp);
- (void) fprintf(stderr,
+ (void)fprintf(stderr,
"Usage: %s [ -fnqvs ] cmd [[ -<qualifers> ] args ]\n",
getprogname());
exit(1);
@@ -305,7 +305,7 @@
err(1, "actual retrieval of routing table");
lim = buf + needed;
if (verbose) {
- (void) printf("Examining routing table from sysctl\n");
+ (void)printf("Examining routing table from sysctl\n");
if (af) printf("(address family %s)\n", (*argv + 1));
}
seqno = 0; /* ??? */
@@ -338,12 +338,12 @@
print_rtmsg(rtm, rlen);
else {
struct sockaddr *sa = (struct sockaddr *)(rtm + 1);
- (void) printf("%-20.20s ",
+ (void)printf("%-20.20s ",
routename(sa, NULL, rtm->rtm_flags));
sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);
- (void) printf("%-20.20s ",
+ (void)printf("%-20.20s ",
routename(sa, NULL, RTF_HOST));
- (void) printf("done\n");
+ (void)printf("done\n");
}
}
return 0;
@@ -399,14 +399,14 @@
switch (family) {
case AF_INET: {
struct sockaddr_in *nsin = (struct sockaddr_in *)nm;
- maskdata = (unsigned char *) &nsin->sin_addr;
+ maskdata = (unsigned char *)&nsin->sin_addr;
maskbytes = nsin->sin_len -
((caddr_t)&nsin->sin_addr - (caddr_t)nsin);
break;
}
case AF_INET6: {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nm;
- maskdata = (unsigned char *) &sin6->sin6_addr;
+ maskdata = (unsigned char *)&sin6->sin6_addr;
maskbytes = sin6->sin6_len -
((caddr_t)&sin6->sin6_addr - (caddr_t)sin6);
break;
@@ -510,7 +510,7 @@
}
}
if (cp == 0 && !nflag) {
- hp = gethostbyaddr((char *)&in, sizeof (struct in_addr),
+ hp = gethostbyaddr((char *)&in, sizeof(struct in_addr),
AF_INET);
if (hp) {
char *ccp;
@@ -579,7 +579,7 @@
break;
case AF_APPLETALK:
- (void) snprintf(line, sizeof(line), "atalk %d.%d",
+ (void)snprintf(line, sizeof(line), "atalk %d.%d",
((struct sockaddr_at *)sa)->sat_addr.s_net,
((struct sockaddr_at *)sa)->sat_addr.s_node);
break;
@@ -732,7 +732,7 @@
break;
case AF_APPLETALK:
- (void) snprintf(line, sizeof(line), "atalk %d.%d",
+ (void)snprintf(line, sizeof(line), "atalk %d.%d",
((struct sockaddr_at *)sa)->sat_addr.s_net,
((struct sockaddr_at *)sa)->sat_addr.s_node);
break;
@@ -881,22 +881,22 @@
case K_IFA:
if (!--argc)
usage(1+*argv);
- (void) getaddr(RTA_IFA, *++argv, 0);
+ (void)getaddr(RTA_IFA, *++argv, 0);
break;
case K_IFP:
if (!--argc)
usage(1+*argv);
- (void) getaddr(RTA_IFP, *++argv, 0);
+ (void)getaddr(RTA_IFP, *++argv, 0);
break;
case K_GENMASK:
if (!--argc)
usage(1+*argv);
- (void) getaddr(RTA_GENMASK, *++argv, 0);
+ (void)getaddr(RTA_GENMASK, *++argv, 0);
break;
case K_GATEWAY:
if (!--argc)
usage(1+*argv);
- (void) getaddr(RTA_GATEWAY, *++argv, 0);
+ (void)getaddr(RTA_GATEWAY, *++argv, 0);
break;
case K_DST:
if (!--argc)
@@ -907,7 +907,7 @@
case K_NETMASK:
if (!--argc)
usage(1+*argv);
- (void) getaddr(RTA_NETMASK, *++argv, 0);
+ (void)getaddr(RTA_NETMASK, *++argv, 0);
/* FALLTHROUGH */
case K_NET:
forcenet++;
@@ -938,7 +938,7 @@
ishost = getaddr(RTA_DST, *argv, &hp);
} else if ((rtm_addrs & RTA_GATEWAY) == 0) {
gateway = *argv;
- (void) getaddr(RTA_GATEWAY, *argv, &hp);
+ (void)getaddr(RTA_GATEWAY, *argv, &hp);
} else {
ret = atoi(*argv);
@@ -962,7 +962,7 @@
iflag = 0;
continue;
}
- (void) getaddr(RTA_NETMASK, *argv, 0);
+ (void)getaddr(RTA_NETMASK, *argv, 0);
}
}
}
@@ -994,15 +994,15 @@
return rv;
if (!qflag) {
oerrno = errno;
- (void) printf("%s %s %s", cmd, ishost? "host" : "net", dest);
+ (void)printf("%s %s %s", cmd, ishost? "host" : "net", dest);
if (*gateway) {
- (void) printf(": gateway %s", gateway);
+ (void)printf(": gateway %s", gateway);
if (attempts > 1 && ret == 0 && af == AF_INET)
- (void) printf(" (%s)",
+ (void)printf(" (%s)",
inet_ntoa(so_gate.sin.sin_addr));
}
if (ret == 0)
- (void) printf("\n");
+ (void)printf("\n");
else {
switch (oerrno) {
case ESRCH:
@@ -1018,7 +1018,7 @@
error = strerror(oerrno);
break;
}
- (void) printf(": %s\n", error);
+ (void)printf(": %s\n", error);
}
}
return (ret != 0);
@@ -1165,7 +1165,7 @@
switch (which) {
case RTA_DST:
forcenet++;
- (void) getaddr(RTA_NETMASK, s, 0);
+ (void)getaddr(RTA_NETMASK, s, 0);
break;
case RTA_NETMASK:
case RTA_GENMASK:
@@ -1482,7 +1482,7 @@
time_t now;
n = read(sock, msg, 2048);
now = time(NULL);
- (void) printf("got message of size %d on %s", n, ctime(&now));
+ (void)printf("got message of size %d on %s", n, ctime(&now));
print_rtmsg((struct rt_msghdr *)msg, n);
}
}
@@ -1687,7 +1687,7 @@
if (verbose == 0)
return;
if (rtm->rtm_version != RTM_VERSION) {
- (void) printf("routing message version %d not understood\n",
+ (void)printf("routing message version %d not understood\n",
rtm->rtm_version);
return;
}
@@ -1699,7 +1699,7 @@
switch (rtm->rtm_type) {
case RTM_IFINFO:
ifm = (struct if_msghdr *)rtm;
- (void) printf("if# %d, %s, flags:", ifm->ifm_index,
+ (void)printf("if# %d, %s, flags:", ifm->ifm_index,
#ifdef SMALL
""
#else
@@ -1712,13 +1712,13 @@
case RTM_NEWADDR:
case RTM_DELADDR:
ifam = (struct ifa_msghdr *)rtm;
- (void) printf("metric %d, flags:", ifam->ifam_metric);
+ (void)printf("metric %d, flags:", ifam->ifam_metric);
bprintf(stdout, ifam->ifam_flags, routeflags);
pmsg_addrs((char *)(ifam + 1), ifam->ifam_addrs);
break;
case RTM_IEEE80211:
ifan = (struct if_announcemsghdr *)rtm;
- (void) printf("if# %d, what: ", ifan->ifan_index);
+ (void)printf("if# %d, what: ", ifan->ifan_index);
switch (ifan->ifan_what) {
case RTM_IEEE80211_ASSOC:
printf("associate");
@@ -1785,7 +1785,7 @@
break;
case RTM_IFANNOUNCE:
ifan = (struct if_announcemsghdr *)rtm;
- (void) printf("if# %d, what: ", ifan->ifan_index);
+ (void)printf("if# %d, what: ", ifan->ifan_index);
switch (ifan->ifan_what) {
case IFAN_ARRIVAL:
printf("arrival");
@@ -1800,7 +1800,7 @@
printf("\n");
break;
default:
- (void) printf("pid: %d, seq %d, errno %d, flags:",
+ (void)printf("pid: %d, seq %d, errno %d, flags:",
Home |
Main Index |
Thread Index |
Old Index