[PATCH] wpa_cli: Use .wpa_cli_history under Android

Mikael Kanstrup mikael.kanstrup
Wed Mar 18 04:51:18 PDT 2015


wpa_cli already implements a command history file for easy accessing
commands previously used. Enable the functonality on Android too.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup at sonymobile.com>
---
 wpa_supplicant/Android.mk | 3 +++
 wpa_supplicant/wpa_cli.c  | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 6d39613..8222c0f 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -40,6 +40,9 @@ endif
 L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
 L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/wpa_supplicant\"
 
+# Use Android specific directory for wpa_cli command completion history
+L_CFLAGS += -DCONFIG_WPA_CLI_HISTORY_DIR=\"/data/misc/wifi\"
+
 # To force sizeof(enum) = 4
 ifeq ($(TARGET_ARCH),arm)
 L_CFLAGS += -mabi=aapcs-linux
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 2b40bbf..2f9ab03 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -3781,7 +3781,11 @@ static void start_edit(void)
 	ps = wpa_ctrl_get_remote_ifname(ctrl_conn);
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 
+#ifndef CONFIG_WPA_CLI_HISTORY_DIR
 	home = getenv("HOME");
+#else
+	home = CONFIG_WPA_CLI_HISTORY_DIR;
+#endif /* CONFIG_WPA_CLI_HISTORY_DIR */
 	if (home) {
 		const char *fname = ".wpa_cli_history";
 		int hfile_len = os_strlen(home) + 1 + os_strlen(fname) + 1;
-- 
1.8.2.2




More information about the Hostap mailing list