From: Jouni Malinen Date: Sun, 5 Aug 2012 17:48:54 +0000 (+0300) Subject: edit: Add support for prompt string with readline X-Git-Tag: hostap_2_0~487 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b97bc3b514dd942cfd303cb168656060b7132c;p=thirdparty%2Fhostap.git edit: Add support for prompt string with readline Signed-hostap: Jouni Malinen --- diff --git a/src/utils/edit_readline.c b/src/utils/edit_readline.c index 9c27d7269..9a6f642cd 100644 --- a/src/utils/edit_readline.c +++ b/src/utils/edit_readline.c @@ -127,6 +127,17 @@ int edit_init(void (*cmd_cb)(void *ctx, char *cmd), eloop_register_read_sock(STDIN_FILENO, edit_read_char, NULL, NULL); + if (ps) { + size_t blen = os_strlen(ps) + 3; + char *ps2 = os_malloc(blen); + if (ps2) { + os_snprintf(ps2, blen, "%s> ", ps); + rl_callback_handler_install(ps2, readline_cmd_handler); + os_free(ps2); + return 0; + } + } + rl_callback_handler_install("> ", readline_cmd_handler); return 0;