Date: Mon, 7 Sep 2009 15:52:15 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196931 - head/sbin/ifconfig Message-ID: <200909071552.n87FqFwD019220@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Mon Sep 7 15:52:15 2009 New Revision: 196931 URL: http://svn.freebsd.org/changeset/base/196931 Log: Use printb() instead of rolling its own routine to display bits in options=<>. Pointed out by: ume MFC after: 3 days Modified: head/sbin/ifconfig/ifgif.c Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Mon Sep 7 15:43:09 2009 (r196930) +++ head/sbin/ifconfig/ifgif.c Mon Sep 7 15:52:15 2009 (r196931) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909071552.n87FqFwD019220>