summaryrefslogtreecommitdiffstats
path: root/cmd-kill-window.c
authortcunha <tcunha>2011-01-07 14:45:33 (GMT)
committer tcunha <tcunha>2011-01-07 14:45:33 (GMT)
commit1c7a360ed2cd87d299d6f26874381798177ee5fc (patch) (side-by-side diff)
tree7a110cc712014eb9653d81f598796943f32c6505 /cmd-kill-window.c
parent3399e17193a3a994a334f887c81d0f95a8557505 (diff)
downloadtmux-old-1c7a360ed2cd87d299d6f26874381798177ee5fc.zip
tmux-old-1c7a360ed2cd87d299d6f26874381798177ee5fc.tar.gz
tmux-old-1c7a360ed2cd87d299d6f26874381798177ee5fc.tar.bz2
Sync OpenBSD patchset 829:
Clean up and simplify tmux command argument parsing. Originally, tmux commands were parsed in the client process into a struct with the command data which was then serialised and sent to the server to be executed. The parsing was later moved into the server (an argv was sent from the client), but the parse step and intermediate struct was kept. This change removes that struct and the separate parse step. Argument parsing and printing is now common to all commands (in arguments.c) with each command left with just an optional check function (to validate the arguments at parse time), the exec function and a function to set up any key bindings (renamed from the old init function). This is overall more simple and consistent. There should be no changes to any commands behaviour or syntax although as this touches every command please watch for any unexpected changes.
Diffstat (limited to 'cmd-kill-window.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-kill-window.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 8b97c64..1673c95 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-window.c,v 1.21 2009/11/14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-kill-window.c,v 1.22 2011/01/07 14:45:34 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -28,22 +28,21 @@ int cmd_kill_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_window_entry = {
"kill-window", "killw",
+ "t:", 0, 0,
CMD_TARGET_WINDOW_USAGE,
- 0, "",
- cmd_target_init,
- cmd_target_parse,
- cmd_kill_window_exec,
- cmd_target_free,
- cmd_target_print
+ 0,
+ NULL,
+ NULL,
+ cmd_kill_window_exec
};
int
cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct cmd_target_data *data = self->data;
- struct winlink *wl;
+ struct args *args = self->args;
+ struct winlink *wl;
- if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
return (-1);
server_kill_window(wl->window);