From ca0890c801cf5cc796f52dd75f342f8b436ce3c6 Mon Sep 17 00:00:00 2001 From: Damien Bergamini Date: Wed, 27 Oct 2004 21:39:06 +0000 Subject: 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 --- sbin/iwicontrol/iwicontrol.c | 19 ++++++------------- 1 file 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]); -- cgit v1.2.3