diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-04-05 19:37:02 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-04-05 19:37:02 +0000 |
commit | e4e909999ff4748513fc31bbe665aac8750f45ec (patch) | |
tree | 4136b382d41a6e4b1834bf240fd4ca7233061c24 /usr.bin | |
parent | 0b66231a1be583912ff26d52e760083d1658718d (diff) |
Add a flag to cmd_find_session so that attach-session can prefer
unattached sessions when choosing the most recently used (if -t is not
given). Suggested by claudio@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-attach-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-has-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-kill-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-list-panes.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-list-windows.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-lock-server.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-rename-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-select-window.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-set-environment.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-set-option.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-show-buffer.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-show-environment.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-show-options.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-switch-client.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd.c | 34 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 15 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 6 |
18 files changed, 66 insertions, 49 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 57f83f50658..d81805bbc68 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.15 2011/01/04 00:42:46 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.16 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -51,7 +51,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) return (-1); } - if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'), 1)) == NULL) return (-1); if (ctx->cmdclient == NULL && ctx->curclient == NULL) diff --git a/usr.bin/tmux/cmd-has-session.c b/usr.bin/tmux/cmd-has-session.c index 15999d1c685..cdd32676a25 100644 --- a/usr.bin/tmux/cmd-has-session.c +++ b/usr.bin/tmux/cmd-has-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-has-session.c,v 1.5 2011/01/04 00:42:46 nicm Exp $ */ +/* $OpenBSD: cmd-has-session.c,v 1.6 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -41,7 +41,7 @@ cmd_has_session_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; - if (cmd_find_session(ctx, args_get(args, 't')) == NULL) + if (cmd_find_session(ctx, args_get(args, 't'), 0) == NULL) return (-1); return (0); diff --git a/usr.bin/tmux/cmd-kill-session.c b/usr.bin/tmux/cmd-kill-session.c index 4faad9f4630..a87ea910325 100644 --- a/usr.bin/tmux/cmd-kill-session.c +++ b/usr.bin/tmux/cmd-kill-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-session.c,v 1.8 2011/01/04 00:42:46 nicm Exp $ */ +/* $OpenBSD: cmd-kill-session.c,v 1.9 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -45,7 +45,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct args *args = self->args; struct session *s; - if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) return (-1); server_destroy_session(s); diff --git a/usr.bin/tmux/cmd-list-panes.c b/usr.bin/tmux/cmd-list-panes.c index f170fcd5e0e..905ce6e0c61 100644 --- a/usr.bin/tmux/cmd-list-panes.c +++ b/usr.bin/tmux/cmd-list-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-panes.c,v 1.9 2011/03/28 23:13:00 nicm Exp $ */ +/* $OpenBSD: cmd-list-panes.c,v 1.10 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -52,7 +52,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(args, 'a')) cmd_list_panes_server(ctx); else if (args_has(args, 's')) { - s = cmd_find_session(ctx, args_get(args, 't')); + s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) return (-1); cmd_list_panes_session(s, ctx); diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c index 203336d415f..266fc4d22cf 100644 --- a/usr.bin/tmux/cmd-list-windows.c +++ b/usr.bin/tmux/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-windows.c,v 1.12 2011/03/28 23:13:00 nicm Exp $ */ +/* $OpenBSD: cmd-list-windows.c,v 1.13 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -50,7 +50,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(args, 'a')) cmd_list_windows_server(ctx); else { - s = cmd_find_session(ctx, args_get(args, 't')); + s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) return (-1); cmd_list_windows_session(s, ctx); diff --git a/usr.bin/tmux/cmd-lock-server.c b/usr.bin/tmux/cmd-lock-server.c index 2e1fcf5eddd..fe249eef42d 100644 --- a/usr.bin/tmux/cmd-lock-server.c +++ b/usr.bin/tmux/cmd-lock-server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-lock-server.c,v 1.9 2011/01/04 02:03:41 nicm Exp $ */ +/* $OpenBSD: cmd-lock-server.c,v 1.10 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -71,7 +71,7 @@ cmd_lock_server_exec(struct cmd *self, unused struct cmd_ctx *ctx) if (self->entry == &cmd_lock_server_entry) server_lock(); else if (self->entry == &cmd_lock_session_entry) { - if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) return (-1); server_lock_session(s); } else { diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 3ff4c5b7140..ac28108307e 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.36 2011/02/03 20:50:03 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.37 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -75,7 +75,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) target = args_get(args, 't'); if (target != NULL) { - groupwith = cmd_find_session(ctx, target); + groupwith = cmd_find_session(ctx, target, 0); if (groupwith == NULL) return (-1); } else diff --git a/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c index 5f58bbb020c..afa3b349f0b 100644 --- a/usr.bin/tmux/cmd-rename-session.c +++ b/usr.bin/tmux/cmd-rename-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rename-session.c,v 1.8 2011/01/04 00:42:47 nicm Exp $ */ +/* $OpenBSD: cmd-rename-session.c,v 1.9 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -51,7 +51,7 @@ cmd_rename_session_exec(struct cmd *self, struct cmd_ctx *ctx) return (-1); } - if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) return (-1); RB_REMOVE(sessions, &sessions, s); diff --git a/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c index c07b749bd07..f3a29a3c90c 100644 --- a/usr.bin/tmux/cmd-select-window.c +++ b/usr.bin/tmux/cmd-select-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-window.c,v 1.6 2011/01/04 02:03:41 nicm Exp $ */ +/* $OpenBSD: cmd-select-window.c,v 1.7 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -102,7 +102,7 @@ cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx) last = 1; if (next || previous || last) { - s = cmd_find_session(ctx, args_get(args, 't')); + s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) return (-1); diff --git a/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c index a81fcf2751b..7dfd9be4ec3 100644 --- a/usr.bin/tmux/cmd-set-environment.c +++ b/usr.bin/tmux/cmd-set-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-environment.c,v 1.4 2011/01/04 00:42:47 nicm Exp $ */ +/* $OpenBSD: cmd-set-environment.c,v 1.5 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -65,7 +65,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(self->args, 'g')) env = &global_environ; else { - if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) return (-1); env = &s->environ; } diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index d96eeb71388..64508b3027f 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.50 2011/03/29 21:09:13 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.51 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -164,7 +164,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(self->args, 'g')) oo = &global_s_options; else { - s = cmd_find_session(ctx, args_get(args, 't')); + s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) return (-1); oo = &s->options; diff --git a/usr.bin/tmux/cmd-show-buffer.c b/usr.bin/tmux/cmd-show-buffer.c index 4f231d18d9d..3dd6d6b015a 100644 --- a/usr.bin/tmux/cmd-show-buffer.c +++ b/usr.bin/tmux/cmd-show-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-buffer.c,v 1.10 2011/01/04 00:42:47 nicm Exp $ */ +/* $OpenBSD: cmd-show-buffer.c,v 1.11 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -49,7 +49,7 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) size_t size, len; u_int width; - if ((s = cmd_find_session(ctx, NULL)) == NULL) + if ((s = cmd_find_session(ctx, NULL, 0)) == NULL) return (-1); if (!args_has(args, 'b')) { diff --git a/usr.bin/tmux/cmd-show-environment.c b/usr.bin/tmux/cmd-show-environment.c index 7b1d4f8f8a1..3108f5ecf95 100644 --- a/usr.bin/tmux/cmd-show-environment.c +++ b/usr.bin/tmux/cmd-show-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-environment.c,v 1.3 2011/01/04 00:42:47 nicm Exp $ */ +/* $OpenBSD: cmd-show-environment.c,v 1.4 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -50,7 +50,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(self->args, 'g')) env = &global_environ; else { - if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) + if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) return (-1); env = &s->environ; } diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c index e24b4540717..131536fb6da 100644 --- a/usr.bin/tmux/cmd-show-options.c +++ b/usr.bin/tmux/cmd-show-options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-options.c,v 1.13 2011/01/04 02:03:41 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.14 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -79,7 +79,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx) if (args_has(self->args, 'g')) oo = &global_s_options; else { - s = cmd_find_session(ctx, args_get(args, 't')); + s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) return (-1); oo = &s->options; diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index 0769a022ce8..1a0de247492 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.11 2011/01/04 00:42:47 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.12 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -86,7 +86,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_ctx *ctx) return (-1); } } else - s = cmd_find_session(ctx, args_get(args, 't')); + s = cmd_find_session(ctx, args_get(args, 't'), 0); if (s == NULL) return (-1); diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 45c7d43d354..e07ba43ee46 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.51 2011/03/27 20:27:26 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.52 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -112,7 +112,7 @@ const struct cmd_entry *cmd_table[] = { }; struct session *cmd_choose_session_list(struct sessionslist *); -struct session *cmd_choose_session(void); +struct session *cmd_choose_session(int); struct client *cmd_choose_client(struct clients *); struct client *cmd_lookup_client(const char *); struct session *cmd_lookup_session(const char *, int *); @@ -316,7 +316,7 @@ cmd_print(struct cmd *cmd, char *buf, size_t len) * session from all sessions. */ struct session * -cmd_current_session(struct cmd_ctx *ctx) +cmd_current_session(struct cmd_ctx *ctx, int prefer_unattached) { struct msg_command_data *data = ctx->msgdata; struct client *c = ctx->cmdclient; @@ -365,19 +365,25 @@ cmd_current_session(struct cmd_ctx *ctx) return (s); } - return (cmd_choose_session()); + return (cmd_choose_session(prefer_unattached)); } -/* Find the most recently used session. */ +/* + * Find the most recently used session, preferring unattached if the flag is + * set. + */ struct session * -cmd_choose_session(void) +cmd_choose_session(int prefer_unattached) { struct session *s, *sbest; struct timeval *tv = NULL; sbest = NULL; RB_FOREACH(s, sessions, &sessions) { - if (tv == NULL || timercmp(&s->activity_time, tv, >)) { + if (tv == NULL || timercmp(&s->activity_time, tv, >) || + (prefer_unattached && + !(sbest->flags & SESSION_UNATTACHED) && + (s->flags & SESSION_UNATTACHED))) { sbest = s; tv = &s->activity_time; } @@ -428,7 +434,7 @@ cmd_current_client(struct cmd_ctx *ctx) * No current client set. Find the current session and return the * newest of its clients. */ - s = cmd_current_session(ctx); + s = cmd_current_session(ctx, 0); if (s != NULL && !(s->flags & SESSION_UNATTACHED)) { ARRAY_INIT(&cc); for (i = 0; i < ARRAY_LENGTH(&clients); i++) { @@ -671,7 +677,7 @@ cmd_pane_session(struct cmd_ctx *ctx, struct window_pane *wp, struct winlink *wl; /* If this pane is in the current session, return that winlink. */ - s = cmd_current_session(ctx); + s = cmd_current_session(ctx, 0); if (s != NULL) { wl = winlink_find_by_window(&s->windows, wp->window); if (wl != NULL) { @@ -696,7 +702,7 @@ cmd_pane_session(struct cmd_ctx *ctx, struct window_pane *wp, /* Find the target session or report an error and return NULL. */ struct session * -cmd_find_session(struct cmd_ctx *ctx, const char *arg) +cmd_find_session(struct cmd_ctx *ctx, const char *arg, int prefer_unattached) { struct session *s; struct window_pane *wp; @@ -707,7 +713,7 @@ cmd_find_session(struct cmd_ctx *ctx, const char *arg) /* A NULL argument means the current session. */ if (arg == NULL) - return (cmd_current_session(ctx)); + return (cmd_current_session(ctx, prefer_unattached)); tmparg = xstrdup(arg); /* Lookup as pane id. */ @@ -753,7 +759,7 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp) * Find the current session. There must always be a current session, if * it can't be found, report an error. */ - if ((s = cmd_current_session(ctx)) == NULL) { + if ((s = cmd_current_session(ctx, 0)) == NULL) { ctx->error(ctx, "can't establish current session"); return (NULL); } @@ -900,7 +906,7 @@ cmd_find_index(struct cmd_ctx *ctx, const char *arg, struct session **sp) * Find the current session. There must always be a current session, if * it can't be found, report an error. */ - if ((s = cmd_current_session(ctx)) == NULL) { + if ((s = cmd_current_session(ctx, 0)) == NULL) { ctx->error(ctx, "can't establish current session"); return (-2); } @@ -1054,7 +1060,7 @@ cmd_find_pane(struct cmd_ctx *ctx, u_int idx; /* Get the current session. */ - if ((s = cmd_current_session(ctx)) == NULL) { + if ((s = cmd_current_session(ctx, 0)) == NULL) { ctx->error(ctx, "can't establish current session"); return (NULL); } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 5622daad797..1bd84feb3b5 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.216 2011/04/01 16:59:11 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.217 2011/04/05 19:37:01 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 1 2011 $ +.Dd $Mdocdate: April 5 2011 $ .Dt TMUX 1 .Os .Sh NAME @@ -562,6 +562,17 @@ If no server is started, .Ic attach-session will attempt to start it; this will fail unless sessions are created in the configuration file. +.Pp +The +.Ar target-session +rules for +.Ic attach-session +are slightly adjusted: if +.Nm +needs to select the most recently used session, it will prefer the most +recently used +.Em unattached +session. .It Xo Ic detach-client .Op Fl P .Op Fl t Ar target-client diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 1f315eb4425..6de1857befa 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.277 2011/03/29 19:30:16 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.278 2011/04/05 19:37:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1487,10 +1487,10 @@ struct cmd *cmd_parse(int, char **, char **); int cmd_exec(struct cmd *, struct cmd_ctx *); void cmd_free(struct cmd *); size_t cmd_print(struct cmd *, char *, size_t); -struct session *cmd_current_session(struct cmd_ctx *); +struct session *cmd_current_session(struct cmd_ctx *, int); struct client *cmd_current_client(struct cmd_ctx *); struct client *cmd_find_client(struct cmd_ctx *, const char *); -struct session *cmd_find_session(struct cmd_ctx *, const char *); +struct session *cmd_find_session(struct cmd_ctx *, const char *, int); struct winlink *cmd_find_window( struct cmd_ctx *, const char *, struct session **); int cmd_find_index( |