summaryrefslogtreecommitdiffstats
path: root/cmd-confirm-before.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-16 19:29:24 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-16 19:29:24 +0000
commit646d6a929c81adbb978f88e14ff9b27dee0463d0 (patch)
treef95f2413f150f1746fc095e2356f1f1651fb79b2 /cmd-confirm-before.c
parent6f9a2ee50a1100575eda807fae2689e42a531473 (diff)
Sync OpenBSD patchset 261:
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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index e1db383e..eca42b39 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-confirm-before.c,v 1.9 2009-07-28 22:12:16 tcunha Exp $ */
+/* $Id: cmd-confirm-before.c,v 1.10 2009-08-16 19:29:24 tcunha Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -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) {