summaryrefslogtreecommitdiffstats
path: root/server-fn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-23 10:48:23 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-23 10:48:23 +0000
commit688a487570e39312c39d7a46e0a7ed6e61392ee8 (patch)
treeed01d3073c1decf05b67adc25a19b0901d16d1e9 /server-fn.c
parent21c17da7e6f4631dc418a7b1768d217ce1ccae2f (diff)
Lift last MAXNAMELEN limit on -s argument.
Diffstat (limited to 'server-fn.c')
-rw-r--r--server-fn.c28
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);