diff options
author | mlaier <mlaier@FreeBSD.org> | 2004-03-15 13:41:17 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2004-03-15 13:41:17 +0000 |
commit | 4c91a73d426123e1662d8a1b186f9605ca384b73 (patch) | |
tree | 0cd850f4bfbc1ebe7c447546892114cb24f965a6 /contrib/pf/pfctl/pfctl_parser.c | |
parent | 950b98f1f71ea41489c4abcf9e4071bc2a3d33da (diff) | |
download | FreeBSD-src-4c91a73d426123e1662d8a1b186f9605ca384b73.zip FreeBSD-src-4c91a73d426123e1662d8a1b186f9605ca384b73.tar.gz |
Fix some style(9) related issues after discussion with/education from bde:
- Add <sys/param.h> and <limits.h> where required (do not depend on other
headers pulling it in).
- __dead -> __dead2
- #if defined() -> #ifdef
- Remove ugly PRIu64 macros and use %llu w/ (unsigned long long) cast.
All changes looped back to OpenBSD (where applicable) for easier sync in the
future.
Requested by: bde
Approved by: bms(mentor)
Diffstat (limited to 'contrib/pf/pfctl/pfctl_parser.c')
-rw-r--r-- | contrib/pf/pfctl/pfctl_parser.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/contrib/pf/pfctl/pfctl_parser.c b/contrib/pf/pfctl/pfctl_parser.c index de76cc7..52b00bb 100644 --- a/contrib/pf/pfctl/pfctl_parser.c +++ b/contrib/pf/pfctl/pfctl_parser.c @@ -46,19 +46,13 @@ #include <stdlib.h> #include <string.h> #include <ctype.h> +#include <limits.h> #include <netdb.h> #include <stdarg.h> #include <errno.h> #include <err.h> #include <ifaddrs.h> -#if defined(__FreeBSD__) -#include <inttypes.h> -#else -#define PRIu64 "llu" -#define PRId64 "lld" -#endif - #include "pfctl_parser.h" #include "pfctl.h" @@ -511,30 +505,32 @@ print_status(struct pf_status *s) if (s->ifname[0] != 0) { printf("Interface Stats for %-16s %5s %16s\n", s->ifname, "IPv4", "IPv6"); - printf(" %-25s %14"PRIu64" %16"PRIu64"\n", "Bytes In", - s->bcounters[0][0], s->bcounters[1][0]); - printf(" %-25s %14"PRIu64" %16"PRIu64"\n", "Bytes Out", - s->bcounters[0][1], s->bcounters[1][1]); + printf(" %-25s %14llu %16llu\n", "Bytes In", + (unsigned long long)s->bcounters[0][0], + (unsigned long long)s->bcounters[1][0]); + printf(" %-25s %14llu %16llu\n", "Bytes Out", + (unsigned long long)s->bcounters[0][1], + (unsigned long long)s->bcounters[1][1]); printf(" Packets In\n"); - printf(" %-23s %14"PRIu64" %16"PRIu64"\n", "Passed", - s->pcounters[0][0][PF_PASS], - s->pcounters[1][0][PF_PASS]); - printf(" %-23s %14"PRIu64" %16"PRIu64"\n", "Blocked", - s->pcounters[0][0][PF_DROP], - s->pcounters[1][0][PF_DROP]); + printf(" %-23s %14llu %16llu\n", "Passed", + (unsigned long long)s->pcounters[0][0][PF_PASS], + (unsigned long long)s->pcounters[1][0][PF_PASS]); + printf(" %-23s %14llu %16llu\n", "Blocked", + (unsigned long long)s->pcounters[0][0][PF_DROP], + (unsigned long long)s->pcounters[1][0][PF_DROP]); printf(" Packets Out\n"); - printf(" %-23s %14"PRIu64" %16"PRIu64"\n", "Passed", - s->pcounters[0][1][PF_PASS], - s->pcounters[1][1][PF_PASS]); - printf(" %-23s %14"PRIu64" %16"PRIu64"\n\n", "Blocked", - s->pcounters[0][1][PF_DROP], - s->pcounters[1][1][PF_DROP]); + printf(" %-23s %14llu %16llu\n", "Passed", + (unsigned long long)s->pcounters[0][1][PF_PASS], + (unsigned long long)s->pcounters[1][1][PF_PASS]); + printf(" %-23s %14llu %16llu\n\n", "Blocked", + (unsigned long long)s->pcounters[0][1][PF_DROP], + (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); printf(" %-25s %14u %14s\n", "current entries", s->states, ""); for (i = 0; i < FCNT_MAX; i++) { - printf(" %-25s %14"PRIu64" ", pf_fcounters[i], - s->fcounters[i]); + printf(" %-25s %14llu ", pf_fcounters[i], + (unsigned long long)s->fcounters[i]); if (runtime > 0) printf("%14.1f/s\n", (double)s->fcounters[i] / (double)runtime); @@ -543,8 +539,8 @@ print_status(struct pf_status *s) } printf("Counters\n"); for (i = 0; i < PFRES_MAX; i++) { - printf(" %-25s %14"PRIu64" ", pf_reasons[i], - s->counters[i]); + printf(" %-25s %14llu ", pf_reasons[i], + (unsigned long long)s->counters[i]); if (runtime > 0) printf("%14.1f/s\n", (double)s->counters[i] / (double)runtime); |