summaryrefslogtreecommitdiffstats
path: root/control.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-25 11:35:55 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-25 11:35:55 +0000
commit8a40e10d55d5ebedb079ef96aa2619ecf9b45988 (patch)
tree248d3d8465ee5b94b2e0d6a15e70cb7e46733eac /control.c
parente0961dfdf4e0f87d002771144d74a67ffc21945a (diff)
Add time and a command count to control mode guards, based on code from
George Nachman.
Diffstat (limited to 'control.c')
-rw-r--r--control.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/control.c b/control.c
index fc2d6e43..e78186e4 100644
--- a/control.c
+++ b/control.c
@@ -68,8 +68,13 @@ control_callback(struct client *c, int closed, unused void *data)
}
if (cmd_string_parse(line, &cmdlist, NULL, 0, &cause) != 0) {
- control_write(c, "%%error in line \"%s\": %s", line,
- cause);
+ c->cmdq->time = time(NULL);
+ c->cmdq->number++;
+
+ cmdq_guard(c->cmdq, "begin");
+ control_write(c, "parse error: %s", cause);
+ cmdq_guard(c->cmdq, "error");
+
free(cause);
} else {
cmdq_run(c->cmdq, cmdlist);