diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-05-20 17:28:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-05-20 17:28:42 +0000 |
commit | c066735fd34020c06fde7c3e53d428eebfe3d28b (patch) | |
tree | e1e0b7a6db52d1e58bb029a8c7103a3bf6cedc70 /sbin/ancontrol/ancontrol.c | |
parent | 4f4e089be4540fe3f157c0c5c0301b82fb62eea4 (diff) |
make this more like our wicontrol(8)
Diffstat (limited to 'sbin/ancontrol/ancontrol.c')
-rw-r--r-- | sbin/ancontrol/ancontrol.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/sbin/ancontrol/ancontrol.c b/sbin/ancontrol/ancontrol.c index 31d83a0c35b..986fc863c96 100644 --- a/sbin/ancontrol/ancontrol.c +++ b/sbin/ancontrol/ancontrol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ancontrol.c,v 1.1 2000/04/03 01:08:09 mickey Exp $ */ +/* $OpenBSD: ancontrol.c,v 1.2 2000/05/20 17:28:41 deraadt Exp $ */ /* * Copyright 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -786,34 +786,16 @@ void usage(p) char *p; { - fprintf(stderr, "usage: %s -i iface -A (show specified APs)\n", p); - fprintf(stderr, "\t%s -i iface -N (show specified SSIDss)\n", p); - fprintf(stderr, "\t%s -i iface -S (show NIC status)\n", p); - fprintf(stderr, "\t%s -i iface -I (show NIC capabilities)\n", p); - fprintf(stderr, "\t%s -i iface -T (show stats counters)\n", p); - fprintf(stderr, "\t%s -i iface -C (show current config)\n", p); - fprintf(stderr, "\t%s -i iface -t 0|1|2|3|4 (set TX speed)\n", p); - fprintf(stderr, "\t%s -i iface -s 0|1|2|3 (set power same mode)\n", p); - fprintf(stderr, "\t%s -i iface [-v 1|2|3|4] -a AP (specify AP)\n", p); - fprintf(stderr, "\t%s -i iface -b val (set beacon period)\n", p); - fprintf(stderr, "\t%s -i iface [-v 0|1] -d val (set diversity)\n", p); - fprintf(stderr, "\t%s -i iface -j val (set netjoin timeout)\n", p); - fprintf(stderr, "\t%s -i iface -l val (set station name)\n", p); - fprintf(stderr, "\t%s -i iface -m val (set MAC address)\n", p); - fprintf(stderr, "\t%s -i iface [-v 1|2|3] -n SSID " - "(specify SSID)\n", p); - fprintf(stderr, "\t%s -i iface -o 0|1 (set operating mode)\n", p); - fprintf(stderr, "\t%s -i iface -c val (set ad-hoc channel)\n", p); - fprintf(stderr, "\t%s -i iface -f val (set frag threshold)\n", p); - fprintf(stderr, "\t%s -i iface -r val (set RTS threshold)\n", p); + fprintf(stderr, + "usage: ancontrol interface [-A] [-N] [-S] [-I] [-T] [-C] [-t 0|1|2|3|4]\n" + " [-s 0|1|2|3] [-a AP] [-v 1|2|3|4] [-b beacon period] [-d 0|1|2|3]\n" + " [-v 0|1] [-j netjoin timeout] [-l station name] [-m macaddress]\n" + " [-n SSID] [-v 1|2|3] [-o 0|1] [-p tx power] [-c channel number]\n" + " [-f fragmentation threshold] [-r RTS threshold]\n"); #ifdef ANCACHE - fprintf(stderr, "\t%s -i iface -Q print signal quality cache\n", p); - fprintf(stderr, "\t%s -i iface -Z zero out signal cache\n", p); + fprintf(stderr, + " [-Q] [-Z]\n"); #endif - - fprintf(stderr, "\t%s -h (display this message)\n", p); - - exit(1); } @@ -1147,8 +1129,14 @@ main(argc, argv) void *arg = NULL; char *p = argv[0]; + if (argc > 1 && argv[1][0] != '-') { + iface = argv[1]; + memcpy(&argv[1], &argv[2], argc * sizeof(char *)); + argc--; + } + while ((ch = getopt(argc, argv, - "i:ANISCTht:a:o:s:n:v:d:j:b:c:r:p:w:m:l:QZ")) != -1) { + "i:ANISCTt:a:o:s:n:v:d:j:b:c:r:p:w:m:l:QZ")) != -1) { switch(ch) { case 'Z': #ifdef ANCACHE @@ -1165,7 +1153,8 @@ main(argc, argv) #endif break; case 'i': - iface = optarg; + if (iface == NULL) + iface = optarg; break; case 'A': act = ACT_DUMPAP; @@ -1298,7 +1287,6 @@ main(argc, argv) act = ACT_SET_WAKE_DURATION; arg = optarg; break; - case 'h': default: usage(p); } |