From owner-svn-src-head@FreeBSD.ORG Fri Mar 7 01:23:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95699FA5; Fri, 7 Mar 2014 01:23:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 828C7812; Fri, 7 Mar 2014 01:23:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s271Nnx2019720; Fri, 7 Mar 2014 01:23:49 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s271Nn1b019719; Fri, 7 Mar 2014 01:23:49 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201403070123.s271Nn1b019719@svn.freebsd.org> From: Eitan Adler Date: Fri, 7 Mar 2014 01:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262882 - head/tools/tools/net80211/wlanstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2014 01:23:49 -0000 Author: eadler Date: Fri Mar 7 01:23:49 2014 New Revision: 262882 URL: http://svnweb.freebsd.org/changeset/base/262882 Log: wlanstats: add help - add a help (-h) flag - move usage into itsown function Modified: head/tools/tools/net80211/wlanstats/main.c Modified: head/tools/tools/net80211/wlanstats/main.c ============================================================================== --- head/tools/tools/net80211/wlanstats/main.c Fri Mar 7 01:13:48 2014 (r262881) +++ head/tools/tools/net80211/wlanstats/main.c Fri Mar 7 01:23:49 2014 (r262882) @@ -153,6 +153,11 @@ print_sta_stats(FILE *fd, const u_int8_t } #endif +void +usage(void) { + printf("wlanstats: [-ah] [-i ifname] [-l] [-o fmt] [interval]\n"); +} + int main(int argc, char *argv[]) { @@ -167,11 +172,14 @@ main(int argc, char *argv[]) if (ifname == NULL) ifname = "wlan0"; wf = wlanstats_new(ifname, getfmt("default")); - while ((c = getopt(argc, argv, "ai:lm:o:")) != -1) { + while ((c = getopt(argc, argv, "ahi:lm:o:")) != -1) { switch (c) { case 'a': allnodes++; break; + case 'h': + usage(); + exit(0); case 'i': wf->setifname(wf, optarg); break; @@ -188,7 +196,8 @@ main(int argc, char *argv[]) wf->setfmt(wf, getfmt(optarg)); break; default: - errx(-1, "usage: %s [-a] [-i ifname] [-l] [-o fmt] [interval]\n", argv[0]); + usage(); + exit(1); /*NOTREACHED*/ } }