diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-02 18:08:17 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-02 18:08:17 +0000 |
commit | c7243b73cb3baaf6993d8a9dfb16c054c3978040 (patch) | |
tree | 1d67ee4c5cf764dc83245c79d27da52857b4a89d /cmd-next-window.c | |
parent | 11ee55e755af67dc9155e956b4569c8fdeb11848 (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-next-window.c')
-rw-r--r-- | cmd-next-window.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/cmd-next-window.c b/cmd-next-window.c index 4495558e..e07aaa0b 100644 --- a/cmd-next-window.c +++ b/cmd-next-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-next-window.c,v 1.6 2007-12-06 09:46:22 nicm Exp $ */ +/* $Id: cmd-next-window.c,v 1.7 2008-06-02 18:08:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -30,20 +30,26 @@ void cmd_next_window_exec(void *, struct cmd_ctx *); const struct cmd_entry cmd_next_window_entry = { - "next-window", "next", "", - CMD_NOCLIENT, - NULL, + "next-window", "next", + CMD_SESSIONONLY_USAGE, + 0, + cmd_sessiononly_parse, cmd_next_window_exec, - NULL, - NULL, - NULL + cmd_sessiononly_send, + cmd_sessiononly_recv, + cmd_sessiononly_free }; void -cmd_next_window_exec(unused void *ptr, struct cmd_ctx *ctx) +cmd_next_window_exec(void *ptr, struct cmd_ctx *ctx) { - if (session_next(ctx->session) == 0) - server_redraw_session(ctx->session); + struct session *s; + + if ((s = cmd_sessiononly_get(ptr, ctx)) == NULL) + return; + + if (session_next(s) == 0) + server_redraw_session(s); else ctx->error(ctx, "no next window"); |