summaryrefslogtreecommitdiffstats
path: root/tmux.h
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-12-12 14:33:47 +0000
committerThomas Adam <thomas@xteddy.org>2019-12-12 14:33:47 +0000
commit7922f4ee7bd4c18509c6774971fd007a4c5a10e3 (patch)
treecccfdd336c64b1b652a4b2333fa2efef0ba5edb3 /tmux.h
parent0d99519c3d3522e9281f8e0726e3d71fcf3e57f3 (diff)
parent5134666702ce972390f39e34bed9b60fe566263a (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'tmux.h')
-rw-r--r--tmux.h112
1 files changed, 90 insertions, 22 deletions
diff --git a/tmux.h b/tmux.h
index f1228191..bdebf248 100644
--- a/tmux.h
+++ b/tmux.h
@@ -480,13 +480,21 @@ enum msgtype {
MSG_RESIZE,
MSG_SHELL,
MSG_SHUTDOWN,
- MSG_STDERR,
- MSG_STDIN,
- MSG_STDOUT,
+ MSG_OLDSTDERR, /* unused */
+ MSG_OLDSTDIN, /* unused */
+ MSG_OLDSTDOUT, /* unused */
MSG_SUSPEND,
MSG_UNLOCK,
MSG_WAKEUP,
MSG_EXEC,
+
+ MSG_READ_OPEN = 300,
+ MSG_READ,
+ MSG_READ_DONE,
+ MSG_WRITE_OPEN,
+ MSG_WRITE,
+ MSG_WRITE_READY,
+ MSG_WRITE_CLOSE
};
/*
@@ -494,25 +502,49 @@ enum msgtype {
*
* Don't forget to bump PROTOCOL_VERSION if any of these change!
*/
-struct msg_command_data {
+struct msg_command {
int argc;
}; /* followed by packed argv */
-struct msg_stdin_data {
- ssize_t size;
- char data[BUFSIZ];
+struct msg_read_open {
+ int stream;
+ int fd;
+ char path[PATH_MAX];
};
-struct msg_stdout_data {
- ssize_t size;
+struct msg_read_data {
+ int stream;
+ size_t size;
char data[BUFSIZ];
};
-struct msg_stderr_data {
- ssize_t size;
+struct msg_read_done {
+ int stream;
+ int error;
+};
+
+struct msg_write_open {
+ int stream;
+ int fd;
+ char path[PATH_MAX];
+ int flags;
+};
+
+struct msg_write_data {
+ int stream;
+ size_t size;
char data[BUFSIZ];
};
+struct msg_write_ready {
+ int stream;
+ int error;
+};
+
+struct msg_write_close {
+ int stream;
+};
+
/* Mode keys. */
#define MODEKEY_EMACS 0
#define MODEKEY_VI 1
@@ -1476,6 +1508,29 @@ struct status_line {
struct status_line_entry entries[STATUS_LINES_LIMIT];
};
+/* File in client. */
+typedef void (*client_file_cb) (struct client *, const char *, int, int,
+ struct evbuffer *, void *);
+struct client_file {
+ struct client *c;
+ int references;
+ int stream;
+
+ char *path;
+ struct evbuffer *buffer;
+ struct bufferevent *event;
+
+ int fd;
+ int error;
+ int closed;
+
+ client_file_cb cb;
+ void *data;
+
+ RB_ENTRY (client_file) entry;
+};
+RB_HEAD(client_files, client_file);
+
/* Client connection. */
typedef int (*prompt_input_cb)(struct client *, void *, const char *, int);
typedef void (*prompt_free_cb)(void *);
@@ -1509,13 +1564,6 @@ struct client {
size_t discarded;
size_t redraw;
- void (*stdin_callback)(struct client *, int, void *);
- void *stdin_callback_data;
- struct evbuffer *stdin_data;
- int stdin_closed;
- struct evbuffer *stdout_data;
- struct evbuffer *stderr_data;
-
struct event repeat_timer;
struct event click_timer;
@@ -1599,6 +1647,8 @@ struct client {
void *overlay_data;
struct event overlay_timer;
+ struct client_files files;
+
TAILQ_ENTRY(client) entry;
};
TAILQ_HEAD(clients, client);
@@ -1755,6 +1805,8 @@ extern struct client *cfg_client;
void start_cfg(void);
int load_cfg(const char *, struct client *, struct cmdq_item *, int,
struct cmdq_item **);
+int load_cfg_from_buffer(const void *, size_t, const char *,
+ struct client *, struct cmdq_item *, int, struct cmdq_item **);
void set_cfg_file(const char *);
void printflike(1, 2) cfg_add_cause(const char *, ...);
void cfg_print_causes(struct cmdq_item *);
@@ -2072,6 +2124,8 @@ void cmd_parse_empty(struct cmd_parse_input *);
struct cmd_parse_result *cmd_parse_from_file(FILE *, struct cmd_parse_input *);
struct cmd_parse_result *cmd_parse_from_string(const char *,
struct cmd_parse_input *);
+struct cmd_parse_result *cmd_parse_from_buffer(const void *, size_t,
+ struct cmd_parse_input *);
struct cmd_parse_result *cmd_parse_from_arguments(int, char **,
struct cmd_parse_input *);
@@ -2131,6 +2185,23 @@ void alerts_reset_all(void);
void alerts_queue(struct window *, int);
void alerts_check_session(struct session *);
+/* file.c */
+int file_cmp(struct client_file *, struct client_file *);
+RB_PROTOTYPE(client_files, client_file, entry, file_cmp);
+struct client_file *file_create(struct client *, int, client_file_cb, void *);
+void file_free(struct client_file *);
+void file_fire_done(struct client_file *);
+void file_fire_read(struct client_file *);
+int file_can_print(struct client *);
+void printflike(2, 3) file_print(struct client *, const char *, ...);
+void file_vprint(struct client *, const char *, va_list);
+void file_print_buffer(struct client *, void *, size_t);
+void printflike(2, 3) file_error(struct client *, const char *, ...);
+void file_write(struct client *, const char *, int, const void *, size_t,
+ client_file_cb, void *);
+void file_read(struct client *, const char *, client_file_cb, void *);
+void file_push(struct client_file *);
+
/* server.c */
extern struct tmuxproc *server_proc;
extern struct clients clients;
@@ -2189,8 +2260,6 @@ void server_unlink_window(struct session *, struct winlink *);
void server_destroy_pane(struct window_pane *, int);
void server_destroy_session(struct session *);
void server_check_unattached(void);
-int server_set_stdin_callback(struct client *, void (*)(struct client *,
- int, void *), void *, char **);
void server_unzoom_window(struct window *);
/* status.c */
@@ -2575,9 +2644,8 @@ char *default_window_name(struct window *);
char *parse_window_name(const char *);
/* control.c */
-void control_callback(struct client *, int, void *);
+void control_start(struct client *);
void printflike(2, 3) control_write(struct client *, const char *, ...);
-void control_write_buffer(struct client *, struct evbuffer *);
/* control-notify.c */
void control_notify_input(struct client *, struct window_pane *,