summaryrefslogtreecommitdiffstats
path: root/cmd-confirm-before.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-04-27 17:27:36 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-04-27 17:27:36 +0000
commit5d1b6888dc11a201129a87cfe22ee514597eacf3 (patch)
tree250f66882982bac3d766850f6742dca59c9f326f /cmd-confirm-before.c
parent1f2d9e64bb292438ba9a618fd93baedc5e84eca1 (diff)
Convert hidden flag to a full flags word for the status line and add a flag to
accept after only one key. Use this so don't need to press enter after y/n for confirm-before.
Diffstat (limited to 'cmd-confirm-before.c')
-rw-r--r--cmd-confirm-before.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index 79b67b10..71cbe61c 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-confirm-before.c,v 1.1 2009-04-27 13:21:15 tcunha Exp $ */
+/* $Id: cmd-confirm-before.c,v 1.2 2009-04-27 17:27:36 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -125,7 +125,8 @@ cmd_confirm_before_exec(unused struct cmd *self, struct cmd_ctx *ctx)
cdata = xmalloc(sizeof *cdata);
cdata->data.cmd = xstrdup(data->cmd);
cdata->c = ctx->curclient;
- status_prompt_set(cdata->c, buf, cmd_confirm_before_callback, cdata, 0);
+ status_prompt_set(
+ cdata->c, buf, cmd_confirm_before_callback, cdata, PROMPT_SINGLE);
xfree(buf);
return (1);
@@ -183,7 +184,7 @@ cmd_confirm_before_callback(void *data, const char *s)
struct cmd_ctx ctx;
char *cause;
- if (s == NULL || (strcasecmp(s, "y") && strcasecmp(s, "yes")))
+ if (s == NULL || tolower((u_char) s[0]) != 'y' || s[1] != '\0')
goto out;
if (cmd_string_parse(cdata->data.cmd, &cmdlist, &cause) != 0) {