From 11ee55e755af67dc9155e956b4569c8fdeb11848 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 1 Jun 2008 21:24:33 +0000 Subject: [PATCH] Prepare TERM in buffer before sending; this allows size to be part of cmd and prevents it being split. This is the only place this happens so remove it from todo. --- TODO | 2 -- client.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index b3e83826..6234eb0b 100644 --- a/TODO +++ b/TODO @@ -71,8 +71,6 @@ - different screen model? layers perhaps? hmm -- For 0.3 -------------------------------------------------------------------- -- anything which uses cmd_{send,recv}_string will break if the string is - split. string length should be part of the command size - chmod +x socket when any client is attached (upd in lost/accept) - clear EOL etc CANNOT rely on term using the current colour/attr and probably should not emulate it doing so diff --git a/client.c b/client.c index 7acc2eeb..42056faa 100644 --- a/client.c +++ b/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.26 2008-05-31 20:04:15 nicm Exp $ */ +/* $Id: client.c,v 1.27 2008-06-01 21:24:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -44,6 +44,7 @@ client_init(const char *path, struct client_ctx *cctx, int start_server) size_t size; int mode; u_int retries; + struct buffer *b; retries = 0; retry: @@ -99,8 +100,12 @@ retry: data.sy = ws.ws_row; if (ttyname_r(STDIN_FILENO, data.tty, sizeof data.tty) != 0) fatal("ttyname_r failed"); - client_write_server(cctx, MSG_IDENTIFY, &data, sizeof data); - cmd_send_string(cctx->srv_out, getenv("TERM")); + + b = buffer_create(BUFSIZ); + cmd_send_string(b, getenv("TERM")); + client_write_server2(cctx, MSG_IDENTIFY, + &data, sizeof data, BUFFER_OUT(b), BUFFER_USED(b)); + buffer_destroy(b); } return (0);