Date: Fri, 7 Mar 2014 01:23:49 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262882 - head/tools/tools/net80211/wlanstats Message-ID: <201403070123.s271Nn1b019719@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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*/ } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403070123.s271Nn1b019719>