diff options
author | hrs <hrs@FreeBSD.org> | 2009-09-07 15:52:15 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2009-09-07 15:52:15 +0000 |
commit | 6032c99a9729fdc9f02f838161f7060d02a78773 (patch) | |
tree | 7984237119e37988aab40517cf84da98f7988ad7 /sbin | |
parent | e894c7001952dd8d859ba281a78077d40459f716 (diff) | |
download | FreeBSD-src-6032c99a9729fdc9f02f838161f7060d02a78773.zip FreeBSD-src-6032c99a9729fdc9f02f838161f7060d02a78773.tar.gz |
Use printb() instead of rolling its own routine to display
bits in options=<>.
Pointed out by: ume
MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ifconfig/ifgif.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/sbin/ifconfig/ifgif.c b/sbin/ifconfig/ifgif.c index aed6382..f91508b 100644 --- a/sbin/ifconfig/ifgif.c +++ b/sbin/ifconfig/ifgif.c @@ -51,38 +51,22 @@ static const char rcsid[] = #include "ifconfig.h" -static void gif_status(int); +#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\5SEND_REV_ETHIP_VER" -static struct { - const char *label; - u_int mask; -} gif_opts[] = { - { "ACCEPT_REV_ETHIP_VER", GIF_ACCEPT_REVETHIP }, - { "SEND_REV_ETHIP_VER", GIF_SEND_REVETHIP }, -}; +static void gif_status(int); static void gif_status(int s) { int opts; - int nopts = 0; - size_t i; ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; if (opts == 0) return; - - printf("\toptions=%d<", opts); - for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { - if (opts & gif_opts[i].mask) { - if (nopts++) - printf(","); - printf("%s", gif_opts[i].label); - } - } - printf(">\n"); + printb("\toptions", opts, GIFBITS); + putchar('\n'); } static void |