From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 15:52:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A80D3106566B; Mon, 7 Sep 2009 15:52:15 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96E908FC12; Mon, 7 Sep 2009 15:52:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87FqFrs019222; Mon, 7 Sep 2009 15:52:15 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87FqFwD019220; Mon, 7 Sep 2009 15:52:15 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200909071552.n87FqFwD019220@svn.freebsd.org> From: Hiroki Sato Date: Mon, 7 Sep 2009 15:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196931 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 15:52:15 -0000 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