1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Rename TMATE_SLAVE -> TMATE

This commit is contained in:
Nicolas Viennot 2019-11-07 08:29:41 -05:00
parent 4b79571357
commit 975f60d2ac
40 changed files with 103 additions and 103 deletions

View File

@ -227,7 +227,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
struct termios tio, saved_tio; struct termios tio, saved_tio;
size_t size; size_t size;
#ifndef TMATE_SLAVE #ifndef TMATE
/* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */ /* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */
signal(SIGCHLD, SIG_IGN); signal(SIGCHLD, SIG_IGN);
#endif #endif
@ -264,7 +264,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
cmd_list_free(cmdlist); cmd_list_free(cmdlist);
} }
#ifdef TMATE_SLAVE #ifdef TMATE
fd = tmate_session->tmux_socket_fd; fd = tmate_session->tmux_socket_fd;
/* Create client process structure (starts logging). */ /* Create client process structure (starts logging). */
@ -308,7 +308,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
fatal("pledge failed"); fatal("pledge failed");
#endif #endif
#ifndef TMATE_SLAVE #ifndef TMATE
/* Free stuff that is not used in the client. */ /* Free stuff that is not used in the client. */
options_free(global_options); options_free(global_options);
options_free(global_s_options); options_free(global_s_options);
@ -401,7 +401,7 @@ client_send_identify(const char *ttynam, const char *cwd)
int fd, flags = client_flags; int fd, flags = client_flags;
pid_t pid; pid_t pid;
#ifdef TMATE_SLAVE #ifdef TMATE
if (tmate_session->ssh_client.pubkey) { if (tmate_session->ssh_client.pubkey) {
proc_send(client_peer, MSG_IDENTIFY_TMATE_AUTH_PUBKEY, -1, proc_send(client_peer, MSG_IDENTIFY_TMATE_AUTH_PUBKEY, -1,
tmate_session->ssh_client.pubkey, tmate_session->ssh_client.pubkey,
@ -648,7 +648,7 @@ client_dispatch_wait(struct imsg *imsg, const char *shellcmd)
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_SHELL string"); fatalx("bad MSG_SHELL string");
#ifdef TMATE_SLAVE #ifdef TMATE
exit(1); exit(1);
#else #else
clear_signals(0); clear_signals(0);

View File

@ -47,7 +47,7 @@ const struct cmd_entry cmd_break_pane_entry = {
enum cmd_retval enum cmd_retval
cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -69,7 +69,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq)
enum cmd_retval enum cmd_retval
join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -44,7 +44,7 @@ const struct cmd_entry cmd_kill_pane_entry = {
enum cmd_retval enum cmd_retval
cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq) cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct winlink *wl = cmdq->state.tflag.wl; struct winlink *wl = cmdq->state.tflag.wl;

View File

@ -49,7 +49,7 @@ const struct cmd_entry cmd_paste_buffer_entry = {
enum cmd_retval enum cmd_retval
cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -52,7 +52,7 @@ const struct cmd_entry cmd_pipe_pane_entry = {
enum cmd_retval enum cmd_retval
cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -191,7 +191,7 @@ cmdq_continue_one(struct cmd_q *cmdq)
char *tmp; char *tmp;
int flags = !!(cmd->flags & CMD_CONTROL); int flags = !!(cmd->flags & CMD_CONTROL);
#ifdef TMATE_SLAVE #ifdef TMATE
int client_id; int client_id;
if (!tmate_should_exec_cmd_locally(cmd->entry)) { if (!tmate_should_exec_cmd_locally(cmd->entry)) {
client_id = cmdq->client ? cmdq->client->id : -1; client_id = cmdq->client ? cmdq->client->id : -1;

View File

@ -47,7 +47,7 @@ const struct cmd_entry cmd_resize_pane_entry = {
enum cmd_retval enum cmd_retval
cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -46,7 +46,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
enum cmd_retval enum cmd_retval
cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq) cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -45,7 +45,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
enum cmd_retval enum cmd_retval
cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq) cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -42,7 +42,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
enum cmd_retval enum cmd_retval
cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq) cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct winlink *wl = cmdq->state.tflag.wl; struct winlink *wl = cmdq->state.tflag.wl;

View File

@ -70,7 +70,7 @@ const struct cmd_entry cmd_previous_layout_entry = {
enum cmd_retval enum cmd_retval
cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -58,7 +58,7 @@ const struct cmd_entry cmd_send_prefix_entry = {
enum cmd_retval enum cmd_retval
cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq) cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -114,7 +114,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
else else
valstr = args->argv[1]; valstr = args->argv[1];
#ifdef TMATE_SLAVE #ifdef TMATE
if (!args_has(args, 'u')) if (!args_has(args, 'u'))
tmate_hook_set_option(optstr, valstr); tmate_hook_set_option(optstr, valstr);
#endif #endif
@ -191,7 +191,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
} }
/* Start or stop timers if necessary. */ /* Start or stop timers if necessary. */
#ifndef TMATE_SLAVE #ifndef TMATE
if (strcmp(oe->name, "automatic-rename") == 0) { if (strcmp(oe->name, "automatic-rename") == 0) {
RB_FOREACH(w, windows, &windows) { RB_FOREACH(w, windows, &windows) {
if (options_get_number(w->options, "automatic-rename")) if (options_get_number(w->options, "automatic-rename"))

View File

@ -51,7 +51,7 @@ const struct cmd_entry cmd_split_window_entry = {
enum cmd_retval enum cmd_retval
cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct args *args = self->args; struct args *args = self->args;

View File

@ -45,7 +45,7 @@ const struct cmd_entry cmd_swap_pane_entry = {
enum cmd_retval enum cmd_retval
cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else
struct winlink *src_wl, *dst_wl; struct winlink *src_wl, *dst_wl;

View File

@ -47,7 +47,7 @@ const struct cmd_entry cmd_switch_client_entry = {
enum cmd_retval enum cmd_retval
cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
cmdq_error(cmdq, "client switch is not supported"); cmdq_error(cmdq, "client switch is not supported");
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
#else #else

View File

@ -80,7 +80,7 @@ control_notify_window_layout_changed(struct window *w)
if (winlink_find_by_window_id(&s->windows, w->id) == NULL) if (winlink_find_by_window_id(&s->windows, w->id) == NULL)
continue; continue;
#ifndef TMATE_SLAVE #ifndef TMATE
/* /*
* When the last pane in a window is closed it won't have a * When the last pane in a window is closed it won't have a
* layout root and we don't need to inform the client about the * layout root and we don't need to inform the client about the

View File

@ -361,7 +361,7 @@ format_cb_window_layout(struct format_tree *ft, struct format_entry *fe)
if (w == NULL) if (w == NULL)
return; return;
#ifdef TMATE_SLAVE #ifdef TMATE
fe->value = xstrdup("no layout"); fe->value = xstrdup("no layout");
#else #else
if (w->saved_layout_root != NULL) if (w->saved_layout_root != NULL)
@ -380,14 +380,14 @@ format_cb_window_visible_layout(struct format_tree *ft, struct format_entry *fe)
if (w == NULL) if (w == NULL)
return; return;
#ifdef TMATE_SLAVE #ifdef TMATE
fe->value = xstrdup("no layout"); fe->value = xstrdup("no layout");
#else #else
fe->value = layout_dump(w->layout_root); fe->value = layout_dump(w->layout_root);
#endif #endif
} }
#ifndef TMATE_SLAVE #ifndef TMATE
/* Callback for pane_start_command. */ /* Callback for pane_start_command. */
void void
format_cb_start_command(struct format_tree *ft, struct format_entry *fe) format_cb_start_command(struct format_tree *ft, struct format_entry *fe)
@ -1187,7 +1187,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_active", "%d", wp == wp->window->active); format_add(ft, "pane_active", "%d", wp == wp->window->active);
format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF)); format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF));
#ifndef TMATE_SLAVE #ifndef TMATE
status = wp->status; status = wp->status;
if (wp->fd == -1 && WIFEXITED(status)) if (wp->fd == -1 && WIFEXITED(status))
format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status)); format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status));
@ -1207,7 +1207,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_tty", "%s", wp->tty); format_add(ft, "pane_tty", "%s", wp->tty);
format_add(ft, "pane_pid", "%ld", (long) wp->pid); format_add(ft, "pane_pid", "%ld", (long) wp->pid);
#ifndef TMATE_SLAVE #ifndef TMATE
format_add_cb(ft, "pane_start_command", format_cb_start_command); format_add_cb(ft, "pane_start_command", format_cb_start_command);
format_add_cb(ft, "pane_current_command", format_cb_current_command); format_add_cb(ft, "pane_current_command", format_cb_current_command);
format_add_cb(ft, "pane_current_path", format_cb_current_path); format_add_cb(ft, "pane_current_path", format_cb_current_path);

View File

@ -23,7 +23,7 @@
#include "tmux.h" #include "tmux.h"
#ifndef TMATE_SLAVE #ifndef TMATE
/* /*
* This file is rather misleadingly named, it contains the code which takes a * This file is rather misleadingly named, it contains the code which takes a

View File

@ -839,7 +839,7 @@ input_parse(struct window_pane *wp)
{ {
struct input_ctx *ictx = wp->ictx; struct input_ctx *ictx = wp->ictx;
const struct input_transition *itr; const struct input_transition *itr;
#ifdef TMATE_SLAVE #ifdef TMATE
struct evbuffer *evb = wp->event_input; struct evbuffer *evb = wp->event_input;
#else #else
struct evbuffer *evb = wp->event->input; struct evbuffer *evb = wp->event->input;
@ -961,7 +961,7 @@ input_get(struct input_ctx *ictx, u_int validx, int minval, int defval)
void void
input_reply(struct input_ctx *ictx, const char *fmt, ...) input_reply(struct input_ctx *ictx, const char *fmt, ...)
{ {
#ifndef TMATE_SLAVE #ifndef TMATE
va_list ap; va_list ap;
char *reply; char *reply;

2
job.c
View File

@ -49,7 +49,7 @@ job_run(const char *cmd, struct session *s, const char *cwd,
int nullfd, out[2]; int nullfd, out[2];
const char *home; const char *home;
#ifdef TMATE_SLAVE #ifdef TMATE
return NULL; return NULL;
#endif #endif

View File

@ -23,7 +23,7 @@
#include "tmux.h" #include "tmux.h"
#ifndef TMATE_SLAVE #ifndef TMATE
struct layout_cell *layout_find_bottomright(struct layout_cell *); struct layout_cell *layout_find_bottomright(struct layout_cell *);
u_short layout_checksum(const char *); u_short layout_checksum(const char *);

View File

@ -22,7 +22,7 @@
#include "tmux.h" #include "tmux.h"
#ifndef TMATE_SLAVE #ifndef TMATE
/* /*
* Set window layouts - predefined methods to arrange windows. These are * Set window layouts - predefined methods to arrange windows. These are

View File

@ -22,7 +22,7 @@
#include "tmux.h" #include "tmux.h"
#ifndef TMATE_SLAVE #ifndef TMATE
/* /*
* The window layout is a tree of cells each of which can be one of: a * The window layout is a tree of cells each of which can be one of: a

View File

@ -25,7 +25,7 @@
#include "tmux.h" #include "tmux.h"
#ifdef TMATE_SLAVE #ifdef TMATE
char * char *
default_window_name(struct window *w) default_window_name(struct window *w)

6
proc.c
View File

@ -172,7 +172,7 @@ proc_start(const char *name, struct event_base *base, int forkflag,
struct tmuxproc *tp; struct tmuxproc *tp;
struct utsname u; struct utsname u;
#ifdef TMATE_SLAVE #ifdef TMATE
if (forkflag) if (forkflag)
fatal("can't fork"); fatal("can't fork");
#else #else
@ -210,7 +210,7 @@ proc_start(const char *name, struct event_base *base, int forkflag,
tp = xcalloc(1, sizeof *tp); tp = xcalloc(1, sizeof *tp);
tp->name = xstrdup(name); tp->name = xstrdup(name);
#ifndef TMATE_SLAVE #ifndef TMATE
tp->signalcb = signalcb; tp->signalcb = signalcb;
set_signals(proc_signal_cb, tp); set_signals(proc_signal_cb, tp);
#endif #endif
@ -226,7 +226,7 @@ proc_loop(struct tmuxproc *tp, int (*loopcb)(void))
event_loop(EVLOOP_ONCE); event_loop(EVLOOP_ONCE);
while (!tp->exit && (loopcb == NULL || !loopcb ())); while (!tp->exit && (loopcb == NULL || !loopcb ()));
#ifdef TMATE_SLAVE #ifdef TMATE
/* flush data on sockets */ /* flush data on sockets */
event_loop(EVLOOP_ONCE | EVLOOP_NONBLOCK); event_loop(EVLOOP_ONCE | EVLOOP_NONBLOCK);
#endif #endif

View File

@ -61,7 +61,7 @@ recalculate_sizes(void)
TAILQ_FOREACH(c, &clients, entry) { TAILQ_FOREACH(c, &clients, entry) {
if (c->flags & CLIENT_SUSPENDED) if (c->flags & CLIENT_SUSPENDED)
continue; continue;
#ifdef TMATE_SLAVE #ifdef TMATE
if (c->flags & CLIENT_READONLY) if (c->flags & CLIENT_READONLY)
continue; continue;
#endif #endif
@ -78,7 +78,7 @@ recalculate_sizes(void)
} }
} }
#ifdef TMATE_SLAVE #ifdef TMATE
if (tmate_has_websocket()) { if (tmate_has_websocket()) {
if (tmate_session->websocket_sy < ssy) if (tmate_session->websocket_sy < ssy)
ssy = tmate_session->websocket_sy; ssy = tmate_session->websocket_sy;
@ -155,7 +155,7 @@ recalculate_sizes(void)
is_zoomed = w->flags & WINDOW_ZOOMED; is_zoomed = w->flags & WINDOW_ZOOMED;
if (is_zoomed) if (is_zoomed)
window_unzoom(w); window_unzoom(w);
#ifndef TMATE_SLAVE #ifndef TMATE
layout_resize(w, ssx, ssy); layout_resize(w, ssx, ssy);
#endif #endif
window_resize(w, ssx, ssy); window_resize(w, ssx, ssy);

View File

@ -96,7 +96,7 @@ server_client_get_key_table(struct client *c)
return (name); return (name);
} }
#ifdef TMATE_SLAVE #ifdef TMATE
u_int next_client_id; u_int next_client_id;
#endif #endif
@ -110,7 +110,7 @@ server_client_create(int fd)
c = xcalloc(1, sizeof *c); c = xcalloc(1, sizeof *c);
#ifdef TMATE_SLAVE #ifdef TMATE
c->id = next_client_id++; c->id = next_client_id++;
c->ip_address = NULL; c->ip_address = NULL;
c->pubkey = NULL; c->pubkey = NULL;
@ -204,7 +204,7 @@ server_client_lost(struct client *c)
TAILQ_REMOVE(&clients, c, entry); TAILQ_REMOVE(&clients, c, entry);
log_debug("lost client %p", c); log_debug("lost client %p", c);
#ifdef TMATE_SLAVE #ifdef TMATE
tmate_notify_client_left(tmate_session, c); tmate_notify_client_left(tmate_session, c);
#endif #endif
@ -252,7 +252,7 @@ server_client_lost(struct client *c)
cmdq_free(c->cmdq); cmdq_free(c->cmdq);
c->cmdq = NULL; c->cmdq = NULL;
#ifdef TMATE_SLAVE #ifdef TMATE
free(c->ip_address); free(c->ip_address);
c->ip_address = NULL; c->ip_address = NULL;
free(c->pubkey); free(c->pubkey);
@ -266,7 +266,7 @@ server_client_lost(struct client *c)
server_client_unref(c); server_client_unref(c);
#ifndef TMATE_SLAVE #ifndef TMATE
server_add_accept(0); /* may be more file descriptors now */ server_add_accept(0); /* may be more file descriptors now */
#endif #endif
@ -632,7 +632,7 @@ server_client_handle_key(struct client *c, key_code key)
window_unzoom(w); window_unzoom(w);
wp = window_pane_at_index(w, key - '0'); wp = window_pane_at_index(w, key - '0');
if (wp != NULL && window_pane_visible(wp)) if (wp != NULL && window_pane_visible(wp))
#ifdef TMATE_SLAVE #ifdef TMATE
tmate_client_set_active_pane(c->id, key - '0', wp->id); tmate_client_set_active_pane(c->id, key - '0', wp->id);
#else #else
window_set_active_pane(w, wp); window_set_active_pane(w, wp);
@ -783,7 +783,7 @@ server_client_loop(void)
RB_FOREACH(w, windows, &windows) { RB_FOREACH(w, windows, &windows) {
w->flags &= ~WINDOW_REDRAW; w->flags &= ~WINDOW_REDRAW;
TAILQ_FOREACH(wp, &w->panes, entry) { TAILQ_FOREACH(wp, &w->panes, entry) {
#ifndef TMATE_SLAVE #ifndef TMATE
if (wp->fd != -1) { if (wp->fd != -1) {
server_client_check_focus(wp); server_client_check_focus(wp);
server_client_check_resize(wp); server_client_check_resize(wp);
@ -795,7 +795,7 @@ server_client_loop(void)
} }
} }
#ifndef TMATE_SLAVE #ifndef TMATE
/* Check if pane should be resized. */ /* Check if pane should be resized. */
void void
server_client_check_resize(struct window_pane *wp) server_client_check_resize(struct window_pane *wp)
@ -1059,7 +1059,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
if (c->flags & CLIENT_DEAD) if (c->flags & CLIENT_DEAD)
return; return;
#ifdef TMATE_SLAVE #ifdef TMATE
if (c->flags & CLIENT_EXIT) if (c->flags & CLIENT_EXIT)
return; return;
#endif #endif
@ -1072,7 +1072,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
data = imsg->data; data = imsg->data;
datalen = imsg->hdr.len - IMSG_HEADER_SIZE; datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
#ifdef TMATE_SLAVE #ifdef TMATE
switch (imsg->hdr.type) { switch (imsg->hdr.type) {
case MSG_IDENTIFY_TMATE_IP_ADDRESS: case MSG_IDENTIFY_TMATE_IP_ADDRESS:
case MSG_IDENTIFY_TMATE_AUTH_NONE: case MSG_IDENTIFY_TMATE_AUTH_NONE:
@ -1103,7 +1103,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
return; return;
} }
#ifdef TMATE_SLAVE #ifdef TMATE
if (!(c->flags & CLIENT_IDENTIFIED)) { if (!(c->flags & CLIENT_IDENTIFIED)) {
tmate_warn("dropping unidentified client message: %d", imsg->hdr.type); tmate_warn("dropping unidentified client message: %d", imsg->hdr.type);
return; return;
@ -1308,7 +1308,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
memcpy(&c->pid, data, sizeof c->pid); memcpy(&c->pid, data, sizeof c->pid);
log_debug("client %p IDENTIFY_CLIENTPID %ld", c, (long)c->pid); log_debug("client %p IDENTIFY_CLIENTPID %ld", c, (long)c->pid);
break; break;
#ifdef TMATE_SLAVE #ifdef TMATE
case MSG_IDENTIFY_TMATE_IP_ADDRESS: case MSG_IDENTIFY_TMATE_IP_ADDRESS:
if (datalen == 0 || data[datalen - 1] != '\0') if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TMATE_IP_ADDRESS string"); fatalx("bad MSG_IDENTIFY_TMATE_IP_ADDRESS string");
@ -1380,7 +1380,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
if (!(c->flags & CLIENT_CONTROL)) if (!(c->flags & CLIENT_CONTROL))
c->flags |= CLIENT_TERMINAL; c->flags |= CLIENT_TERMINAL;
#ifdef TMATE_SLAVE #ifdef TMATE
tmate_notify_client_join(tmate_session, c); tmate_notify_client_join(tmate_session, c);
#endif #endif
} }

View File

@ -294,7 +294,7 @@ void
server_destroy_pane(struct window_pane *wp, int hooks) server_destroy_pane(struct window_pane *wp, int hooks)
{ {
struct window *w = wp->window; struct window *w = wp->window;
#ifndef TMATE_SLAVE #ifndef TMATE
int old_fd; int old_fd;
struct screen_write_ctx ctx; struct screen_write_ctx ctx;
struct grid_cell gc; struct grid_cell gc;
@ -330,7 +330,7 @@ server_destroy_pane(struct window_pane *wp, int hooks)
#endif #endif
server_unzoom_window(w); server_unzoom_window(w);
#ifndef TMATE_SLAVE #ifndef TMATE
layout_close_pane(wp); layout_close_pane(wp);
window_remove_pane(w, wp); window_remove_pane(w, wp);

View File

@ -135,7 +135,7 @@ server_create_socket(void)
int int
server_start(struct event_base *base, int lockfd, char *lockfile) server_start(struct event_base *base, int lockfd, char *lockfile)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
server_proc = proc_start("server", base, 0, server_signal); server_proc = proc_start("server", base, 0, server_signal);
#else #else
int pair[2]; int pair[2];
@ -170,7 +170,7 @@ server_start(struct event_base *base, int lockfd, char *lockfile)
gettimeofday(&start_time, NULL); gettimeofday(&start_time, NULL);
#ifdef TMATE_SLAVE #ifdef TMATE
server_fd = tmate_session->tmux_socket_fd; server_fd = tmate_session->tmux_socket_fd;
#else #else
server_fd = server_create_socket(); server_fd = server_create_socket();
@ -188,19 +188,19 @@ server_start(struct event_base *base, int lockfd, char *lockfile)
start_cfg(); start_cfg();
#ifndef TMATE_SLAVE #ifndef TMATE
status_prompt_load_history(); status_prompt_load_history();
server_add_accept(0); server_add_accept(0);
#endif #endif
proc_loop(server_proc, server_loop); proc_loop(server_proc, server_loop);
#ifndef TMATE_SLAVE #ifndef TMATE
status_prompt_save_history(); status_prompt_save_history();
#endif #endif
exit(0); exit(0);
} }
#ifdef TMATE_SLAVE #ifdef TMATE
static int tmate_server_request_exit; static int tmate_server_request_exit;
#endif #endif
@ -212,7 +212,7 @@ server_loop(void)
server_client_loop(); server_client_loop();
#ifdef TMATE_SLAVE #ifdef TMATE
if (!ssh_is_connected(tmate_session->ssh_client.session) && if (!ssh_is_connected(tmate_session->ssh_client.session) &&
!tmate_server_request_exit) { !tmate_server_request_exit) {
/* /*
@ -257,7 +257,7 @@ server_send_exit(void)
struct client *c, *c1; struct client *c, *c1;
struct session *s, *s1; struct session *s, *s1;
#ifdef TMATE_SLAVE #ifdef TMATE
tmate_server_request_exit = 1; tmate_server_request_exit = 1;
#endif #endif
@ -378,7 +378,7 @@ server_signal(int sig)
case SIGCHLD: case SIGCHLD:
server_child_signal(); server_child_signal();
break; break;
#ifndef TMATE_SLAVE #ifndef TMATE
case SIGUSR1: case SIGUSR1:
event_del(&server_ev_accept); event_del(&server_ev_accept);
fd = server_create_socket(); fd = server_create_socket();

View File

@ -344,7 +344,7 @@ session_new(struct session *s, const char *name, int argc, char **argv,
shell = _PATH_BSHELL; shell = _PATH_BSHELL;
hlimit = options_get_number(s->options, "history-limit"); hlimit = options_get_number(s->options, "history-limit");
#ifdef TMATE_SLAVE #ifdef TMATE
hlimit = hlimit > TMATE_HLIMIT ? TMATE_HLIMIT : hlimit; hlimit = hlimit > TMATE_HLIMIT ? TMATE_HLIMIT : hlimit;
#endif #endif
w = window_create(name, argc, argv, path, shell, cwd, env, s->tio, w = window_create(name, argc, argv, path, shell, cwd, env, s->tio,

View File

@ -24,7 +24,7 @@
#include "tmux.h" #include "tmux.h"
#ifndef TMATE_SLAVE #ifndef TMATE
struct event ev_sighup; struct event ev_sighup;
struct event ev_sigchld; struct event ev_sigchld;

View File

@ -217,7 +217,7 @@ status_redraw_get_left(struct client *c, time_t t, struct grid_cell *gc,
char *left; char *left;
size_t leftlen; size_t leftlen;
#ifdef TMATE_SLAVE #ifdef TMATE
left = xstrdup(tmate_left_status ?: ""); left = xstrdup(tmate_left_status ?: "");
#else #else
style_apply_update(gc, s->options, "status-left-style"); style_apply_update(gc, s->options, "status-left-style");
@ -243,7 +243,7 @@ status_redraw_get_right(struct client *c, time_t t, struct grid_cell *gc,
char *right; char *right;
size_t rightlen; size_t rightlen;
#ifdef TMATE_SLAVE #ifdef TMATE
right = xstrdup(tmate_right_status ?: ""); right = xstrdup(tmate_right_status ?: "");
#else #else
style_apply_update(gc, s->options, "status-right-style"); style_apply_update(gc, s->options, "status-right-style");
@ -530,7 +530,7 @@ status_print(struct client *c, struct winlink *wl, time_t t,
const char *fmt; const char *fmt;
char *text; char *text;
#ifdef TMATE_SLAVE #ifdef TMATE
/* TODO use the host winlink status */ /* TODO use the host winlink status */
#endif #endif

6
tmux.c
View File

@ -44,7 +44,7 @@ struct hooks *global_hooks;
struct timeval start_time; struct timeval start_time;
const char *socket_path; const char *socket_path;
#ifndef TMATE_SLAVE #ifndef TMATE
__dead void usage(void); __dead void usage(void);
static char *make_label(const char *); static char *make_label(const char *);
@ -167,7 +167,7 @@ setblocking(int fd, int state)
} }
} }
#ifdef TMATE_SLAVE #ifdef TMATE
const char * find_home(void) { return NULL; } const char * find_home(void) { return NULL; }
int areshell(__unused const char *shell) { return 0; } int areshell(__unused const char *shell) { return 0; }
#else #else
@ -350,7 +350,7 @@ main(int argc, char **argv)
} }
#endif #endif
#ifdef TMATE_SLAVE #ifdef TMATE
void tmux_server_init(void) void tmux_server_init(void)
{ {
global_hooks = hooks_create(NULL); global_hooks = hooks_create(NULL);

24
tmux.h
View File

@ -19,7 +19,7 @@
#ifndef TMUX_H #ifndef TMUX_H
#define TMUX_H #define TMUX_H
#define TMATE_SLAVE #define TMATE
#define PROTOCOL_VERSION 8 #define PROTOCOL_VERSION 8
@ -432,7 +432,7 @@ enum msgtype {
MSG_UNLOCK, MSG_UNLOCK,
MSG_WAKEUP, MSG_WAKEUP,
#ifdef TMATE_SLAVE #ifdef TMATE
MSG_LATENCY = 300, MSG_LATENCY = 300,
MSG_IDENTIFY_TMATE_IP_ADDRESS, MSG_IDENTIFY_TMATE_IP_ADDRESS,
MSG_IDENTIFY_TMATE_AUTH_NONE, MSG_IDENTIFY_TMATE_AUTH_NONE,
@ -871,7 +871,7 @@ struct window_pane {
struct window *window; struct window *window;
#ifndef TMATE_SLAVE #ifndef TMATE
struct layout_cell *layout_cell; struct layout_cell *layout_cell;
struct layout_cell *saved_layout_cell; struct layout_cell *saved_layout_cell;
#endif #endif
@ -890,7 +890,7 @@ struct window_pane {
#define PANE_FOCUSPUSH 0x10 #define PANE_FOCUSPUSH 0x10
#define PANE_INPUTOFF 0x20 #define PANE_INPUTOFF 0x20
#define PANE_CHANGED 0x40 #define PANE_CHANGED 0x40
#ifdef TMATE_SLAVE #ifdef TMATE
#define PANE_KILL 0x80 #define PANE_KILL 0x80
#endif #endif
@ -903,7 +903,7 @@ struct window_pane {
char tty[TTY_NAME_MAX]; char tty[TTY_NAME_MAX];
int status; int status;
#ifdef TMATE_SLAVE #ifdef TMATE
struct evbuffer *event_input; struct evbuffer *event_input;
#else #else
int fd; int fd;
@ -955,7 +955,7 @@ struct window {
int lastlayout; int lastlayout;
#ifndef TMATE_SLAVE #ifndef TMATE
struct layout_cell *layout_root; struct layout_cell *layout_root;
struct layout_cell *saved_layout_root; struct layout_cell *saved_layout_root;
char *old_layout; char *old_layout;
@ -973,7 +973,7 @@ struct window {
#define WINDOW_FORCEWIDTH 0x2000 #define WINDOW_FORCEWIDTH 0x2000
#define WINDOW_FORCEHEIGHT 0x4000 #define WINDOW_FORCEHEIGHT 0x4000
#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE) #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
#ifdef TMATE_SLAVE #ifdef TMATE
#define WINDOW_KILL 0x8000 #define WINDOW_KILL 0x8000
#endif #endif
@ -999,7 +999,7 @@ struct winlink {
#define WINLINK_ACTIVITY 0x2 #define WINLINK_ACTIVITY 0x2
#define WINLINK_SILENCE 0x4 #define WINLINK_SILENCE 0x4
#define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE) #define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE)
#ifdef TMATE_SLAVE #ifdef TMATE
#define WINLINK_KILL 0x80 #define WINLINK_KILL 0x80
#endif #endif
@ -1249,7 +1249,7 @@ struct message_entry {
/* Client connection. */ /* Client connection. */
struct client { struct client {
#ifdef TMATE_SLAVE #ifdef TMATE
int id; int id;
#endif #endif
struct tmuxpeer *peer; struct tmuxpeer *peer;
@ -1303,7 +1303,7 @@ struct client {
#define CLIENT_256COLOURS 0x20000 #define CLIENT_256COLOURS 0x20000
#define CLIENT_IDENTIFIED 0x40000 #define CLIENT_IDENTIFIED 0x40000
#define CLIENT_STATUSFORCE 0x80000 #define CLIENT_STATUSFORCE 0x80000
#ifdef TMATE_SLAVE #ifdef TMATE
#define CLIENT_TMATE_NOTIFIED_JOIN 0x10000000 #define CLIENT_TMATE_NOTIFIED_JOIN 0x10000000
#define CLIENT_TMATE_AUTHENTICATED 0x20000000 #define CLIENT_TMATE_AUTHENTICATED 0x20000000
#endif #endif
@ -1338,7 +1338,7 @@ struct client {
struct cmd_q *cmdq; struct cmd_q *cmdq;
int references; int references;
#ifdef TMATE_SLAVE #ifdef TMATE
char *ip_address; char *ip_address;
char *pubkey; char *pubkey;
int readonly; int readonly;
@ -2011,7 +2011,7 @@ void input_reset(struct window_pane *, int);
struct evbuffer *input_pending(struct window_pane *); struct evbuffer *input_pending(struct window_pane *);
void input_parse(struct window_pane *); void input_parse(struct window_pane *);
#ifndef TMATE_SLAVE #ifndef TMATE
/* input-key.c */ /* input-key.c */
void input_key(struct window_pane *, key_code, struct mouse_event *); void input_key(struct window_pane *, key_code, struct mouse_event *);
#endif #endif

View File

@ -407,7 +407,7 @@ tty_term_find(char *name, int fd, char **cause)
LIST_INSERT_HEAD(&tty_terms, term, entry); LIST_INSERT_HEAD(&tty_terms, term, entry);
/* we are in a jail, no access to files */ /* we are in a jail, no access to files */
#ifndef TMATE_SLAVE #ifndef TMATE
/* Set up curses terminal. */ /* Set up curses terminal. */
if (setupterm(name, fd, &error) != OK) { if (setupterm(name, fd, &error) != OK) {
switch (error) { switch (error) {
@ -537,7 +537,7 @@ error:
void void
tty_term_free(struct tty_term *term) tty_term_free(struct tty_term *term)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
/* /*
* We need to keep the term in memory, because we are in a jail, with * We need to keep the term in memory, because we are in a jail, with
* no file system, so we can't reload them. * no file system, so we can't reload them.

2
tty.c
View File

@ -166,7 +166,7 @@ tty_init(struct tty *tty, struct client *c, int fd, char *term)
tty->fd = fd; tty->fd = fd;
tty->client = c; tty->client = c;
#ifdef TMATE_SLAVE #ifdef TMATE
tty->path = NULL; tty->path = NULL;
#else #else
if ((path = ttyname(fd)) == NULL) if ((path = ttyname(fd)) == NULL)

View File

@ -61,7 +61,7 @@ window_copy_init(struct window_pane *wp)
data->searchtype = WINDOW_COPY_OFF; data->searchtype = WINDOW_COPY_OFF;
data->searchstr = NULL; data->searchstr = NULL;
#ifndef TMATE_SLAVE #ifndef TMATE
if (wp->fd != -1) if (wp->fd != -1)
bufferevent_disable(wp->event, EV_READ|EV_WRITE); bufferevent_disable(wp->event, EV_READ|EV_WRITE);
#endif #endif
@ -125,7 +125,7 @@ window_copy_free(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; struct window_copy_mode_data *data = wp->modedata;
#ifndef TMATE_SLAVE #ifndef TMATE
if (wp->fd != -1) if (wp->fd != -1)
bufferevent_enable(wp->event, EV_READ|EV_WRITE); bufferevent_enable(wp->event, EV_READ|EV_WRITE);
#endif #endif
@ -1407,7 +1407,7 @@ window_copy_copy_pipe(struct window_pane *wp, struct session *sess,
struct format_tree *ft; struct format_tree *ft;
char *expanded; char *expanded;
#ifdef TMATE_SLAVE #ifdef TMATE
/* that job_run() is not going to end well */ /* that job_run() is not going to end well */
return; return;
#endif #endif

View File

@ -297,7 +297,7 @@ window_create1(u_int sx, u_int sy)
TAILQ_INIT(&w->panes); TAILQ_INIT(&w->panes);
w->active = NULL; w->active = NULL;
#ifndef TMATE_SLAVE #ifndef TMATE
w->lastlayout = -1; w->lastlayout = -1;
w->layout_root = NULL; w->layout_root = NULL;
#endif #endif
@ -327,7 +327,7 @@ window_create(const char *name, int argc, char **argv, const char *path,
w = window_create1(sx, sy); w = window_create1(sx, sy);
wp = window_add_pane(w, hlimit); wp = window_add_pane(w, hlimit);
#ifndef TMATE_SLAVE #ifndef TMATE
layout_init(w, wp); layout_init(w, wp);
#endif #endif
@ -352,7 +352,7 @@ window_destroy(struct window *w)
{ {
RB_REMOVE(windows, &windows, w); RB_REMOVE(windows, &windows, w);
#ifndef TMATE_SLAVE #ifndef TMATE
if (w->layout_root != NULL) if (w->layout_root != NULL)
layout_free_cell(w->layout_root); layout_free_cell(w->layout_root);
if (w->saved_layout_root != NULL) if (w->saved_layout_root != NULL)
@ -523,7 +523,7 @@ window_zoom(struct window_pane *wp)
if (w->active != wp) if (w->active != wp)
window_set_active_pane(w, wp); window_set_active_pane(w, wp);
#ifndef TMATE_SLAVE #ifndef TMATE
TAILQ_FOREACH(wp1, &w->panes, entry) { TAILQ_FOREACH(wp1, &w->panes, entry) {
wp1->saved_layout_cell = wp1->layout_cell; wp1->saved_layout_cell = wp1->layout_cell;
wp1->layout_cell = NULL; wp1->layout_cell = NULL;
@ -548,7 +548,7 @@ window_unzoom(struct window *w)
w->flags &= ~WINDOW_ZOOMED; w->flags &= ~WINDOW_ZOOMED;
#ifndef TMATE_SLAVE #ifndef TMATE
layout_free(w); layout_free(w);
w->layout_root = w->saved_layout_root; w->layout_root = w->saved_layout_root;
w->saved_layout_root = NULL; w->saved_layout_root = NULL;
@ -752,7 +752,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
wp->shell = NULL; wp->shell = NULL;
wp->cwd = NULL; wp->cwd = NULL;
#ifdef TMATE_SLAVE #ifdef TMATE
wp->event_input = evbuffer_new(); wp->event_input = evbuffer_new();
#else #else
wp->fd = -1; wp->fd = -1;
@ -761,7 +761,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
wp->mode = NULL; wp->mode = NULL;
#ifndef TMATE_SLAVE #ifndef TMATE
wp->layout_cell = NULL; wp->layout_cell = NULL;
#endif #endif
@ -798,7 +798,7 @@ window_pane_destroy(struct window_pane *wp)
if (event_initialized(&wp->timer)) if (event_initialized(&wp->timer))
evtimer_del(&wp->timer); evtimer_del(&wp->timer);
#ifdef TMATE_SLAVE #ifdef TMATE
evbuffer_free(wp->event_input); evbuffer_free(wp->event_input);
#else #else
if (wp->fd != -1) { if (wp->fd != -1) {
@ -834,7 +834,7 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
const char *path, const char *shell, const char *cwd, struct environ *env, const char *path, const char *shell, const char *cwd, struct environ *env,
struct termios *tio, char **cause) struct termios *tio, char **cause)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
return 0; return 0;
#else #else
struct winsize ws; struct winsize ws;
@ -967,7 +967,7 @@ void
window_pane_read_callback(__unused struct bufferevent *bufev, void *data) window_pane_read_callback(__unused struct bufferevent *bufev, void *data)
{ {
struct window_pane *wp = data; struct window_pane *wp = data;
#ifdef TMATE_SLAVE #ifdef TMATE
struct evbuffer *evb = wp->event_input; struct evbuffer *evb = wp->event_input;
#else #else
struct evbuffer *evb = wp->event->input; struct evbuffer *evb = wp->event->input;
@ -1154,7 +1154,7 @@ void
window_pane_key(struct window_pane *wp, struct client *c, struct session *s, window_pane_key(struct window_pane *wp, struct client *c, struct session *s,
key_code key, struct mouse_event *m) key_code key, struct mouse_event *m)
{ {
#ifdef TMATE_SLAVE #ifdef TMATE
/* /*
* pane_id == -1, which means that we should send the keys to * pane_id == -1, which means that we should send the keys to
* the active pane. This is better due to latency issues in * the active pane. This is better due to latency issues in
@ -1199,7 +1199,7 @@ window_pane_visible(struct window_pane *wp)
{ {
struct window *w = wp->window; struct window *w = wp->window;
#ifndef TMATE_SLAVE #ifndef TMATE
if (wp->layout_cell == NULL) if (wp->layout_cell == NULL)
return (0); return (0);
#endif #endif