diff options
Diffstat (limited to 'server-fn.c')
-rw-r--r-- | server-fn.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/server-fn.c b/server-fn.c index 65a4ab99..74f07a0e 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.21 2007-10-19 10:21:35 nicm Exp $ */ +/* $Id: server-fn.c,v 1.22 2007-10-23 10:48:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -23,33 +23,33 @@ #include "tmux.h" -/* Find session from sessid. */ +/* Find session from command message. */ struct session * -server_find_sessid(struct sessid *sid, char **cause) +server_extract_session(struct msg_command_data *data, char *name, char **cause) { struct session *s; u_int i, n; - if (*sid->name != '\0') { - sid->name[(sizeof sid->name) - 1] = '\0'; - if ((s = session_find(sid->name)) == NULL) { - xasprintf(cause, "session not found: %s", sid->name); + if (name != NULL) { + if ((s = session_find(name)) == NULL) { + xasprintf(cause, "session not found: %s", name); return (NULL); } return (s); } - if (sid->pid != -1) { - if (sid->pid != getpid()) { - xasprintf(cause, "wrong server: %lld", sid->pid); + if (data->pid != -1) { + if (data->pid != getpid()) { + xasprintf(cause, "wrong server: %lld", data->pid); return (NULL); } - if (sid->idx > ARRAY_LENGTH(&sessions)) { - xasprintf(cause, "index out of range: %u", sid->idx); + if (data->idx > ARRAY_LENGTH(&sessions)) { + xasprintf(cause, "index out of range: %u", data->idx); return (NULL); } - if ((s = ARRAY_ITEM(&sessions, sid->idx)) == NULL) { - xasprintf(cause, "session doesn't exist: %u", sid->idx); + if ((s = ARRAY_ITEM(&sessions, data->idx)) == NULL) { + xasprintf( + cause, "session doesn't exist: %u", data->idx); return (NULL); } return (s); |