aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wlantest_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-21 10:09:27 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-21 10:09:27 (GMT)
commit13b9f3a1f9f67d3e8964e76ad450b3567a27e3ba (patch)
treea3b8669c9ca27fbed72c899c53bc05bf8ed2a84d /wlantest/wlantest_cli.c
parente3acc8f1c8b6d3800e415b17d144a0de1881c70e (diff)
downloadhostap-13b9f3a1f9f67d3e8964e76ad450b3567a27e3ba.zip
hostap-13b9f3a1f9f67d3e8964e76ad450b3567a27e3ba.tar.gz
hostap-13b9f3a1f9f67d3e8964e76ad450b3567a27e3ba.tar.bz2
wlantest: Add history file for wlantest_cli
Diffstat (limited to 'wlantest/wlantest_cli.c')
-rw-r--r--wlantest/wlantest_cli.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/wlantest/wlantest_cli.c b/wlantest/wlantest_cli.c
index c0f6f54..751ea77 100644
--- a/wlantest/wlantest_cli.c
+++ b/wlantest/wlantest_cli.c
@@ -1084,18 +1084,29 @@ static char ** wlantest_cli_edit_completion_cb(void *ctx, const char *str,
static void wlantest_cli_interactive(int s)
{
struct wlantest_cli cli;
+ char *home, *hfile = NULL;
if (eloop_init())
return;
+ home = getenv("HOME");
+ if (home) {
+ const char *fname = ".wlantest_cli_history";
+ int hfile_len = os_strlen(home) + 1 + os_strlen(fname) + 1;
+ hfile = os_malloc(hfile_len);
+ if (hfile)
+ os_snprintf(hfile, hfile_len, "%s/%s", home, fname);
+ }
+
cli.s = s;
eloop_register_signal_terminate(wlantest_cli_eloop_terminate, &cli);
edit_init(wlantest_cli_edit_cmd_cb, wlantest_cli_edit_eof_cb,
- wlantest_cli_edit_completion_cb, &cli, NULL);
+ wlantest_cli_edit_completion_cb, &cli, hfile);
eloop_run();
- edit_deinit(NULL, NULL);
+ edit_deinit(hfile, NULL);
+ os_free(hfile);
eloop_destroy();
}