From 09cbd0c695cdd953834a46d161f6d3b0bf385c1c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 13 Aug 2009 23:44:18 +0000 Subject: Switch the prompt code to return an empty string when the user enters no response and reserve NULL for an explicit cancel. Change all callbacks to treat them the same so no functional change. Also add cancel key bindings to emacs mode which were missing. --- cmd-confirm-before.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd-confirm-before.c') diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index db799a4b..fd366b9b 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -107,7 +107,9 @@ cmd_confirm_before_callback(void *data, const char *s) struct cmd_ctx ctx; char *cause; - if (s == NULL || tolower((u_char) s[0]) != 'y' || s[1] != '\0') + if (s == NULL || *s == '\0') + return (0); + if (tolower((u_char) s[0]) != 'y' || s[1] != '\0') return (0); if (cmd_string_parse(cdata->cmd, &cmdlist, &cause) != 0) { -- cgit