diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2004-10-27 21:39:06 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2004-10-27 21:39:06 +0000 |
commit | ca0890c801cf5cc796f52dd75f342f8b436ce3c6 (patch) | |
tree | ef210accc3b4f121d9aa92d6b7219b7c8de96c55 | |
parent | 66a3778fc78828079fb893209fd798fb6694b9de (diff) |
It is no longer necessary to check ioctls SIOCGRADIO and SIOCGTABLE0
against ENOTTY because iwi can now report statistics and radio transmitter
state at any time
-rw-r--r-- | sbin/iwicontrol/iwicontrol.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/sbin/iwicontrol/iwicontrol.c b/sbin/iwicontrol/iwicontrol.c index 966145da0f9..993d55409b3 100644 --- a/sbin/iwicontrol/iwicontrol.c +++ b/sbin/iwicontrol/iwicontrol.c @@ -1,4 +1,4 @@ -/* $Id: iwicontrol.c,v 1.4 2004/10/24 11:50:47 deraadt Exp $ */ +/* $Id: iwicontrol.c,v 1.5 2004/10/27 21:39:05 damien Exp $ */ /*- * Copyright (c) 2004 @@ -95,6 +95,7 @@ main(int argc, char **argv) if (!ifspecified) iface = optarg; break; + case 'd': path = optarg; break; @@ -232,12 +233,8 @@ get_radio_state(char *iface) { int radio; - if (do_req(iface, SIOCGRADIO, &radio) == -1) { - if (errno == ENOTTY) - errx(EX_OSERR, "Can't read radio: no firmware"); - else - err(EX_OSERR, "Can't read radio"); - } + if (do_req(iface, SIOCGRADIO, &radio) == -1) + err(EX_OSERR, "Can't read radio"); (void)printf("Radio is %s\n", radio ? "ON" : "OFF"); } @@ -310,12 +307,8 @@ get_statistics(char *iface) static unsigned long stats[256]; /* XXX */ const struct statistic *stat; - if (do_req(iface, SIOCGTABLE0, stats) == -1) { - if (errno == ENOTTY) - errx(EX_OSERR, "Can't read statistics: no firmware"); - else - err(EX_OSERR, "Can't read statistics"); - } + if (do_req(iface, SIOCGTABLE0, stats) == -1) + err(EX_OSERR, "Can't read statistics"); for (stat = tbl; stat->index != 0; stat++) (void)printf("%-60s[%lu]\n", stat->desc, stats[stat->index]); |