summaryrefslogtreecommitdiffstats
path: root/server-fn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-09-27 09:15:58 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-09-27 09:15:58 +0000
commit3fa8f1636486420b9f27b129dbd0f36015d4c24b (patch)
treec018e47c9eb2d78f518a941e7cd87ebe2eb63ab9 /server-fn.c
parent187648e8d1d6bc80113e829d7895e1c81ddd3c17 (diff)
Adjust $TMUX environ var to include session index, and don't compact session list on release. Also fix some argument types.
Diffstat (limited to 'server-fn.c')
-rw-r--r--server-fn.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/server-fn.c b/server-fn.c
index 668712b0..0429af94 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -1,4 +1,4 @@
-/* $Id: server-fn.c,v 1.2 2007-09-26 18:09:23 nicm Exp $ */
+/* $Id: server-fn.c,v 1.3 2007-09-27 09:15:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -24,11 +24,13 @@
/* Write command to a client. */
void
-server_write_client(struct client *c, u_int cmd, void *buf, size_t len)
+server_write_client(struct client *c, enum hdrtype type, void *buf, size_t len)
{
struct hdr hdr;
- hdr.type = cmd;
+ log_debug("writing %d to client %d", type, c->fd);
+
+ hdr.type = type;
hdr.size = len;
buffer_write(c->out, &hdr, sizeof hdr);
@@ -39,11 +41,13 @@ server_write_client(struct client *c, u_int cmd, void *buf, size_t len)
/* Write command to a client with two buffers. */
void
server_write_client2(struct client *c,
- u_int cmd, void *buf1, size_t len1, void *buf2, size_t len2)
+ enum hdrtype type, void *buf1, size_t len1, void *buf2, size_t len2)
{
struct hdr hdr;
- hdr.type = cmd;
+ log_debug("writing %d to client %d", type, c->fd);
+
+ hdr.type = type;
hdr.size = len1 + len2;
buffer_write(c->out, &hdr, sizeof hdr);
@@ -55,19 +59,22 @@ server_write_client2(struct client *c,
/* Write command to all clients attached to a specific window. */
void
-server_write_clients(struct window *w, u_int cmd, void *buf, size_t len)
+server_write_clients(
+ struct window *w, enum hdrtype type, void *buf, size_t len)
{
struct client *c;
struct hdr hdr;
u_int i;
- hdr.type = cmd;
+ hdr.type = type;
hdr.size = len;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (c != NULL && c->session != NULL) {
if (c->session->window == w) {
+ log_debug(
+ "writing %d to clients: %d", type, c->fd);
buffer_write(c->out, &hdr, sizeof hdr);
if (buf != NULL)
buffer_write(c->out, buf, len);