summaryrefslogtreecommitdiffstats
path: root/cmd-detach-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-02 18:08:17 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-02 18:08:17 +0000
commitc7243b73cb3baaf6993d8a9dfb16c054c3978040 (patch)
tree1d67ee4c5cf764dc83245c79d27da52857b4a89d /cmd-detach-client.c
parent11ee55e755af67dc9155e956b4569c8fdeb11848 (diff)
Move -s and -c down a level so handling them is the responsibility of the command (with some helper functions), rather than the top-level. This changes the action command syntax so that -s and -c must be after the command rather than before.
Diffstat (limited to 'cmd-detach-client.c')
-rw-r--r--cmd-detach-client.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index 64a31b85..fd0e5f55 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-detach-client.c,v 1.1 2007-11-16 21:12:31 nicm Exp $ */
+/* $Id: cmd-detach-client.c,v 1.2 2008-06-02 18:08:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,19 +29,25 @@
void cmd_detach_client_exec(void *, struct cmd_ctx *);
const struct cmd_entry cmd_detach_client_entry = {
- "detach-client", "detach", "",
- CMD_NOSESSION,
- NULL,
+ "detach-client", "detach",
+ CMD_CLIENTONLY_USAGE,
+ 0,
+ cmd_clientonly_parse,
cmd_detach_client_exec,
- NULL,
- NULL,
- NULL
+ cmd_clientonly_send,
+ cmd_clientonly_recv,
+ cmd_clientonly_free
};
void
-cmd_detach_client_exec(unused void *ptr, struct cmd_ctx *ctx)
+cmd_detach_client_exec(void *ptr, struct cmd_ctx *ctx)
{
- server_write_client(ctx->client, MSG_DETACH, NULL, 0);
+ struct client *c;
+
+ if ((c = cmd_clientonly_get(ptr, ctx)) == NULL)
+ return;
+
+ server_write_client(c, MSG_DETACH, NULL, 0);
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);