Preparations for v0.7.1 release
[mech_eap.git] / hostapd / hostapd_cli.c
index 340e9c3..2cfaf58 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * hostapd - command line interface for hostapd daemon
- * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2010, Jouni Malinen <j@w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
 #include "includes.h"
 #include <dirent.h>
 
-#include "wpa_ctrl.h"
+#include "common/wpa_ctrl.h"
 #include "common.h"
-#include "version.h"
+#include "common/version.h"
 
 
 static const char *hostapd_cli_version =
 "hostapd_cli v" VERSION_STR "\n"
-"Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi> and contributors";
+"Copyright (c) 2004-2010, Jouni Malinen <j@w1.fi> and contributors";
 
 
 static const char *hostapd_cli_license =
@@ -87,7 +87,7 @@ static const char *commands_help =
 "   sa_query <addr>      send SA Query to a station\n"
 #endif /* CONFIG_IEEE80211W */
 #ifdef CONFIG_WPS
-"   wps_pin <uuid> <pin> add WPS Enrollee PIN (Device Password)\n"
+"   wps_pin <uuid> <pin> [timeout]  add WPS Enrollee PIN (Device Password)\n"
 "   wps_pbc              indicate button pushed to initiate PBC\n"
 #ifdef CONFIG_WPS_OOB
 "   wps_oob <type> <path> <method>  use WPS with out-of-band (UFD)\n"
@@ -263,12 +263,16 @@ static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
                                   char *argv[])
 {
        char buf[64];
-       if (argc != 2) {
-               printf("Invalid 'wps_pin' command - exactly two arguments, "
+       if (argc < 2) {
+               printf("Invalid 'wps_pin' command - at least two arguments, "
                       "UUID and PIN, are required.\n");
                return -1;
        }
-       snprintf(buf, sizeof(buf), "WPS_PIN %s %s", argv[0], argv[1]);
+       if (argc > 2)
+               snprintf(buf, sizeof(buf), "WPS_PIN %s %s %s",
+                        argv[0], argv[1], argv[2]);
+       else
+               snprintf(buf, sizeof(buf), "WPS_PIN %s %s", argv[0], argv[1]);
        return wpa_ctrl_command(ctrl, buf);
 }
 
@@ -621,6 +625,9 @@ int main(int argc, char *argv[])
        int warning_displayed = 0;
        int c;
 
+       if (os_program_init())
+               return -1;
+
        for (;;) {
                c = getopt(argc, argv, "hG:i:p:v");
                if (c < 0)
@@ -709,5 +716,6 @@ int main(int argc, char *argv[])
 
        free(ctrl_ifname);
        hostapd_cli_close_connection();
+       os_program_deinit();
        return 0;
 }