From c7243b73cb3baaf6993d8a9dfb16c054c3978040 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 2 Jun 2008 18:08:17 +0000 Subject: 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. --- cmd-detach-client.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'cmd-detach-client.c') 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 @@ -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); -- cgit v1.2.3