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-list-windows.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'cmd-list-windows.c') diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 056af295..55d5a92f 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-windows.c,v 1.15 2007-12-06 09:46:21 nicm Exp $ */ +/* $Id: cmd-list-windows.c,v 1.16 2008-06-02 18:08:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -30,24 +30,29 @@ void cmd_list_windows_exec(void *, struct cmd_ctx *); const struct cmd_entry cmd_list_windows_entry = { - "list-windows", "lsw", NULL, - CMD_NOCLIENT, - NULL, + "list-windows", "lsw", + CMD_SESSIONONLY_USAGE, + 0, + cmd_sessiononly_parse, cmd_list_windows_exec, - NULL, - NULL, - NULL + cmd_sessiononly_send, + cmd_sessiononly_recv, + cmd_sessiononly_free }; void cmd_list_windows_exec(unused void *ptr, struct cmd_ctx *ctx) { + struct session *s; struct winlink *wl; struct window *w; u_int i; unsigned long long size; - RB_FOREACH(wl, winlinks, &ctx->session->windows) { + if ((s = cmd_sessiononly_get(ptr, ctx)) == NULL) + return; + + RB_FOREACH(wl, winlinks, &s->windows) { w = wl->window; size = 0; -- cgit