summaryrefslogtreecommitdiffstats
path: root/cmd-has-session.c
diff options
context:
space:
mode:
authortcunha <tcunha>2011-01-07 14:45:33 +0000
committertcunha <tcunha>2011-01-07 14:45:33 +0000
commit1c7a360ed2cd87d299d6f26874381798177ee5fc (patch)
tree7a110cc712014eb9653d81f598796943f32c6505 /cmd-has-session.c
parent3399e17193a3a994a334f887c81d0f95a8557505 (diff)
downloadtmux-old-1c7a360ed2cd87d299d6f26874381798177ee5fc.tar.gz
tmux-old-1c7a360ed2cd87d299d6f26874381798177ee5fc.tar.bz2
tmux-old-1c7a360ed2cd87d299d6f26874381798177ee5fc.zip
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-has-session.c')
-rw-r--r--cmd-has-session.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/cmd-has-session.c b/cmd-has-session.c
index fe81099f..9deb1272 100644
--- a/cmd-has-session.c
+++ b/cmd-has-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-has-session.c,v 1.15 2009/11/14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-has-session.c,v 1.16 2011/01/07 14:45:34 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -28,21 +28,20 @@ int cmd_has_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_has_session_entry = {
"has-session", "has",
+ "t:", 0, 0,
CMD_TARGET_SESSION_USAGE,
- 0, "",
- cmd_target_init,
- cmd_target_parse,
- cmd_has_session_exec,
- cmd_target_free,
- cmd_target_print
+ 0,
+ NULL,
+ NULL,
+ cmd_has_session_exec
};
int
cmd_has_session_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct cmd_target_data *data = self->data;
+ struct args *args = self->args;
- if (cmd_find_session(ctx, data->target) == NULL)
+ if (cmd_find_session(ctx, args_get(args, 't')) == NULL)
return (-1);
return (0);