summaryrefslogtreecommitdiffstats
path: root/cmd-confirm-before.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-13 23:44:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-13 23:44:18 +0000
commit09cbd0c695cdd953834a46d161f6d3b0bf385c1c (patch)
tree547649ceb2c777efe0cb20b2f2cae7ae0d7e1108 /cmd-confirm-before.c
parent7a359c00aca2e35dc26c2239f4261f0fa53f0caf (diff)
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.
Diffstat (limited to 'cmd-confirm-before.c')
-rw-r--r--cmd-confirm-before.c4
1 files changed, 3 insertions, 1 deletions
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) {