diff options
author | bde <bde@FreeBSD.org> | 1998-06-29 17:51:39 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-06-29 17:51:39 +0000 |
commit | 64fc186e356ac5b3a1cf29556a50eb3668001942 (patch) | |
tree | cc889ba7a9f5953adebd3e16b9c1ad1f2ca78738 /usr.sbin/mrouted | |
parent | be7e982a5e08a752d70421b0fe84f3bb9e04256f (diff) | |
download | FreeBSD-src-64fc186e356ac5b3a1cf29556a50eb3668001942.zip FreeBSD-src-64fc186e356ac5b3a1cf29556a50eb3668001942.tar.gz |
Don't assume that time_t is long. Fixed printf format errors (don't
assume that ntohl() returns long).
Diffstat (limited to 'usr.sbin/mrouted')
-rw-r--r-- | usr.sbin/mrouted/mtrace.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/usr.sbin/mrouted/mtrace.c b/usr.sbin/mrouted/mtrace.c index ba2a4d4..1686451 100644 --- a/usr.sbin/mrouted/mtrace.c +++ b/usr.sbin/mrouted/mtrace.c @@ -100,7 +100,7 @@ #ifndef lint static const char rcsid[] = - "$Id: mtrace.c,v 1.13 1998/01/16 07:17:44 charnier Exp $"; + "$Id: mtrace.c,v 1.14 1998/06/09 05:01:35 imp Exp $"; #endif #include <ctype.h> @@ -1214,6 +1214,7 @@ void passive_mode() { struct timeval tr; + time_t tr_sec; struct ip *ip; struct igmp *igmp; struct tr_resp *r; @@ -1320,7 +1321,8 @@ passive_mode() if (m) bcopy(&tr, &m->last, sizeof(tr)); - now = localtime(&tr.tv_sec); + tr_sec = tr.tv_sec; + now = localtime(&tr_sec); strftime(timebuf, sizeof(timebuf) - 1, "%b %e %k:%M:%S", now); printf("Mtrace %s at %s", len == 0 ? "query" : @@ -1703,15 +1705,17 @@ stat_line(r, s, have_next, rst) if (debug > 2) { - printf("\t\t\t\tv_in: %ld ", ntohl(s->tr_vifin)); - printf("v_out: %ld ", ntohl(s->tr_vifout)); - printf("pkts: %ld\n", ntohl(s->tr_pktcnt)); - printf("\t\t\t\tv_in: %ld ", ntohl(r->tr_vifin)); - printf("v_out: %ld ", ntohl(r->tr_vifout)); - printf("pkts: %ld\n", ntohl(r->tr_pktcnt)); - printf("\t\t\t\tv_in: %ld ",ntohl(s->tr_vifin)-ntohl(r->tr_vifin)); - printf("v_out: %ld ", ntohl(s->tr_vifout) - ntohl(r->tr_vifout)); - printf("pkts: %ld ", ntohl(s->tr_pktcnt) - ntohl(r->tr_pktcnt)); + printf("\t\t\t\tv_in: %ld ", (long)ntohl(s->tr_vifin)); + printf("v_out: %ld ", (long)ntohl(s->tr_vifout)); + printf("pkts: %ld\n", (long)ntohl(s->tr_pktcnt)); + printf("\t\t\t\tv_in: %ld ", (long)ntohl(r->tr_vifin)); + printf("v_out: %ld ", (long)ntohl(r->tr_vifout)); + printf("pkts: %ld\n", (long)ntohl(r->tr_pktcnt)); + printf("\t\t\t\tv_in: %ld ", + (long)(ntohl(s->tr_vifin) - ntohl(r->tr_vifin))); + printf("v_out: %ld ", + (long)(ntohl(s->tr_vifout) - ntohl(r->tr_vifout))); + printf("pkts: %ld ", (long)(ntohl(s->tr_pktcnt) - ntohl(r->tr_pktcnt))); printf("time: %d\n", timediff); } } @@ -1875,15 +1879,18 @@ print_stats(base, prev, new, bugs) printf("------- ---------------------\n"); } if (debug > 2) { - printf("\t\t\t\tv_in: %ld ", ntohl(n->tr_vifin)); - printf("v_out: %ld ", ntohl(n->tr_vifout)); - printf("pkts: %ld\n", ntohl(n->tr_pktcnt)); - printf("\t\t\t\tv_in: %ld ", ntohl(b->tr_vifin)); - printf("v_out: %ld ", ntohl(b->tr_vifout)); - printf("pkts: %ld\n", ntohl(b->tr_pktcnt)); - printf("\t\t\t\tv_in: %ld ", ntohl(n->tr_vifin) - ntohl(b->tr_vifin)); - printf("v_out: %ld ", ntohl(n->tr_vifout) - ntohl(b->tr_vifout)); - printf("pkts: %ld\n", ntohl(n->tr_pktcnt) - ntohl(b->tr_pktcnt)); + printf("\t\t\t\tv_in: %ld ", (long)ntohl(n->tr_vifin)); + printf("v_out: %ld ", (long)ntohl(n->tr_vifout)); + printf("pkts: %ld\n", (long)ntohl(n->tr_pktcnt)); + printf("\t\t\t\tv_in: %ld ", (long)ntohl(b->tr_vifin)); + printf("v_out: %ld ", (long)ntohl(b->tr_vifout)); + printf("pkts: %ld\n", (long)ntohl(b->tr_pktcnt)); + printf("\t\t\t\tv_in: %ld ", + (long)(ntohl(n->tr_vifin) - ntohl(b->tr_vifin))); + printf("v_out: %ld ", + (long)(ntohl(n->tr_vifout) - ntohl(b->tr_vifout))); + printf("pkts: %ld\n", + (long)(ntohl(n->tr_pktcnt) - ntohl(b->tr_pktcnt))); printf("\t\t\t\treset: %x\n", *r); } |