summaryrefslogtreecommitdiffstats
path: root/client-msg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-11-27 20:01:30 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-11-27 20:01:30 +0000
commit5cd1d459c5351774dbcda51911278d781384bf0f (patch)
tree8da5e09bbf78870f9ce02c80577b47c188150b17 /client-msg.c
parent2fabfb30b0275a0adc7b5bc0a260ab830d1f41ed (diff)
Three-stage exit process so that [] message printing works on detach etc.
Diffstat (limited to 'client-msg.c')
-rw-r--r--client-msg.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/client-msg.c b/client-msg.c
index 4e299bc6..b90488a1 100644
--- a/client-msg.c
+++ b/client-msg.c
@@ -1,4 +1,4 @@
-/* $Id: client-msg.c,v 1.11 2007-11-27 19:23:33 nicm Exp $ */
+/* $Id: client-msg.c,v 1.12 2007-11-27 20:01:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,6 +28,7 @@
int client_msg_fn_detach(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_error(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_exit(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_exited(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_okay(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_pause(struct hdr *, struct client_ctx *, char **);
@@ -40,6 +41,7 @@ struct client_msg client_msg_table[] = {
{ MSG_DETACH, client_msg_fn_detach },
{ MSG_ERROR, client_msg_fn_error },
{ MSG_EXIT, client_msg_fn_exit },
+ { MSG_EXITED, client_msg_fn_exited }
};
#define NCLIENTMSG (sizeof client_msg_table / sizeof client_msg_table[0])
@@ -88,6 +90,18 @@ client_msg_fn_exit(
if (hdr->size != 0)
fatalx("bad MSG_EXIT size");
+ client_write_server(cctx, MSG_EXITING, NULL, 0);
+
+ return (0);
+}
+
+int
+client_msg_fn_exited(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ if (hdr->size != 0)
+ fatalx("bad MSG_EXITED size");
+
cctx->flags |= CCTX_EXIT;
return (-1);