version 1.10, 2009/08/08 21:18:23 |
version 1.11, 2009/08/08 21:52:43 |
|
|
|
|
#include "tmux.h" |
#include "tmux.h" |
|
|
|
void client_send_environ(struct client_ctx *); |
void client_handle_winch(struct client_ctx *); |
void client_handle_winch(struct client_ctx *); |
|
|
int |
int |
|
|
cctx->srv_in = buffer_create(BUFSIZ); |
cctx->srv_in = buffer_create(BUFSIZ); |
cctx->srv_out = buffer_create(BUFSIZ); |
cctx->srv_out = buffer_create(BUFSIZ); |
|
|
|
if (cmdflags & CMD_SENDENVIRON) |
|
client_send_environ(cctx); |
if (isatty(STDIN_FILENO)) { |
if (isatty(STDIN_FILENO)) { |
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) |
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) |
fatal("ioctl(TIOCGWINSZ)"); |
fatal("ioctl(TIOCGWINSZ)"); |
|
|
return (1); |
return (1); |
} |
} |
|
|
|
void |
|
client_send_environ(struct client_ctx *cctx) |
|
{ |
|
char **var; |
|
struct msg_environ_data data; |
|
|
|
for (var = environ; *var != NULL; var++) { |
|
if (strlcpy(data.var, *var, sizeof data.var) >= sizeof data.var) |
|
continue; |
|
client_write_server(cctx, MSG_ENVIRON, &data, sizeof data); |
|
} |
|
} |
|
|
int |
int |
client_main(struct client_ctx *cctx) |
client_main(struct client_ctx *cctx) |
{ |
{ |
|
|
if (hdr.size != sizeof printdata) |
if (hdr.size != sizeof printdata) |
fatalx("bad MSG_PRINT size"); |
fatalx("bad MSG_PRINT size"); |
buffer_read(cctx->srv_in, &printdata, sizeof printdata); |
buffer_read(cctx->srv_in, &printdata, sizeof printdata); |
printdata.msg[(sizeof printdata.msg) - 1] = '\0'; |
|
|
|
|
printdata.msg[(sizeof printdata.msg) - 1] = '\0'; |
cctx->errstr = xstrdup(printdata.msg); |
cctx->errstr = xstrdup(printdata.msg); |
return (-1); |
return (-1); |
case MSG_EXIT: |
case MSG_EXIT: |