Create main_fuchsia.c
Create main entry point for Fuchsia. For now take no arguments, and
initializes one default wpa_interface.
Change-Id: Ia195ded16ae464952736e49618be2af047436485
diff --git a/wpa_supplicant/BUILD.gn b/wpa_supplicant/BUILD.gn
index 524b6d1..286a015 100644
--- a/wpa_supplicant/BUILD.gn
+++ b/wpa_supplicant/BUILD.gn
@@ -40,7 +40,7 @@
"blacklist.c",
"wpas_glue.c",
"scan.c",
- "main_none.c",
+ "main_fuchsia.c",
]
include_dirs = [
diff --git a/wpa_supplicant/main_fuchsia.c b/wpa_supplicant/main_fuchsia.c
new file mode 100644
index 0000000..884e336
--- /dev/null
+++ b/wpa_supplicant/main_fuchsia.c
@@ -0,0 +1,37 @@
+/*
+ * WPA Supplicant / Fuchsia entry point
+ * Copyright (c) 2016 The Fuchsia Authors
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "includes.h"
+
+#include "common.h"
+#include "wpa_supplicant_i.h"
+
+int main(int argc, char *argv[]) {
+ struct wpa_interface iface;
+ int exitcode = 0;
+ struct wpa_params params;
+ struct wpa_global *global;
+
+ memset(¶ms, 0, sizeof(params));
+ params.wpa_debug_level = MSG_DEBUG;
+
+ global = wpa_supplicant_init(¶ms);
+ if (global == NULL) return -1;
+
+ memset(&iface, 0, sizeof(iface));
+ iface.ifname = "none";
+ iface.ctrl_interface = "";
+
+ if (wpa_supplicant_add_iface(global, &iface, NULL) == NULL) exitcode = -1;
+
+ if (exitcode == 0) exitcode = wpa_supplicant_run(global);
+
+ wpa_supplicant_deinit(global);
+
+ return exitcode;
+}