From cc8a57c9b998de1a547c609f571a31b1aa238795 Mon Sep 17 00:00:00 2001 From: joe Date: Sat, 28 Oct 2000 16:25:25 +0000 Subject: When an interface isn't specified use wi0 as the default. This gets around a segmentation fault that occurs when the interface isn't specified first before any of the options. Inspired by PR: bin/22241 --- usr.sbin/wicontrol/wicontrol.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'usr.sbin/wicontrol') diff --git a/usr.sbin/wicontrol/wicontrol.c b/usr.sbin/wicontrol/wicontrol.c index fbd81a3..ecbc2ea 100644 --- a/usr.sbin/wicontrol/wicontrol.c +++ b/usr.sbin/wicontrol/wicontrol.c @@ -697,6 +697,18 @@ int main(argc, argv) char *key = NULL; int modifier = 0; + /* Get the interface name */ + opterr = 0; + ch = getopt(argc, argv, "i:"); + if (ch == 'i') { + iface = optarg; + } else { + iface = "wi0"; + optreset = 1; + optind = 1; + } + opterr = 1; + while((ch = getopt(argc, argv, "hoc:d:e:f:i:k:p:r:q:t:n:s:m:v:P:S:T:ZC")) != -1) { switch(ch) { @@ -720,9 +732,6 @@ int main(argc, argv) wi_dumpstats(iface); exit(0); break; - case 'i': - iface = optarg; - break; case 'c': wi_setword(iface, WI_RID_CREATE_IBSS, atoi(optarg)); exit(0); -- cgit v1.1