tmux
3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
![]() ![]() |
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "tmux.h"
Go to the source code of this file.
Functions | |
RB_GENERATE (client_files, client_file, entry, file_cmp) | |
static char * | file_get_path (struct client *c, const char *file) |
int | file_cmp (struct client_file *cf1, struct client_file *cf2) |
struct client_file * | file_create_with_peer (struct tmuxpeer *peer, struct client_files *files, int stream, client_file_cb cb, void *cbdata) |
struct client_file * | file_create_with_client (struct client *c, int stream, client_file_cb cb, void *cbdata) |
void | file_free (struct client_file *cf) |
static void | file_fire_done_cb (int fd, short events, void *arg) |
void | file_fire_done (struct client_file *cf) |
void | file_fire_read (struct client_file *cf) |
int | file_can_print (struct client *c) |
void | file_print (struct client *c, const char *fmt,...) |
void | file_vprint (struct client *c, const char *fmt, va_list ap) |
void | file_print_buffer (struct client *c, void *data, size_t size) |
void | file_error (struct client *c, const char *fmt,...) |
void | file_write (struct client *c, const char *path, int flags, const void *bdata, size_t bsize, client_file_cb cb, void *cbdata) |
void | file_read (struct client *c, const char *path, client_file_cb cb, void *cbdata) |
static void | file_push_cb (int fd, short events, void *arg) |
void | file_push (struct client_file *cf) |
int | file_write_left (struct client_files *files) |
static void | file_write_error_callback (struct bufferevent *bev, short what, void *arg) |
static void | file_write_callback (struct bufferevent *bev, void *arg) |
void | file_write_open (struct client_files *files, struct tmuxpeer *peer, struct imsg *imsg, int allow_streams, int close_received, client_file_cb cb, void *cbdata) |
void | file_write_data (struct client_files *files, struct imsg *imsg) |
void | file_write_close (struct client_files *files, struct imsg *imsg) |
static void | file_read_error_callback (struct bufferevent *bev, short what, void *arg) |
static void | file_read_callback (struct bufferevent *bev, void *arg) |
void | file_read_open (struct client_files *files, struct tmuxpeer *peer, struct imsg *imsg, int allow_streams, int close_received, client_file_cb cb, void *cbdata) |
void | file_write_ready (struct client_files *files, struct imsg *imsg) |
void | file_read_data (struct client_files *files, struct imsg *imsg) |
void | file_read_done (struct client_files *files, struct imsg *imsg) |
Variables | |
static int | file_next_stream = 3 |
int file_can_print | ( | struct client * | c | ) |
Definition at line 174 of file file.c.
References CLIENT_CONTROL, client::flags, and client::session.
Referenced by file_error(), file_print_buffer(), and file_vprint().
int file_cmp | ( | struct client_file * | cf1, |
struct client_file * | cf2 | ||
) |
Definition at line 55 of file file.c.
References client_file::stream.
struct client_file* file_create_with_client | ( | struct client * | c, |
int | stream, | ||
client_file_cb | cb, | ||
void * | cbdata | ||
) |
Definition at line 97 of file file.c.
References client_file::buffer, client_file::c, client_file::cb, CLIENT_ATTACHED, client_files, client_file::data, fatalx(), client::files, client::flags, client_file::peer, client::peer, client_file::references, client::references, client_file::stream, client_file::tree, and xcalloc().
Referenced by file_error(), file_print_buffer(), file_read(), file_vprint(), and file_write().
struct client_file* file_create_with_peer | ( | struct tmuxpeer * | peer, |
struct client_files * | files, | ||
int | stream, | ||
client_file_cb | cb, | ||
void * | cbdata | ||
) |
Definition at line 71 of file file.c.
References client_file::buffer, client_file::c, client_file::cb, client_files, client_file::data, fatalx(), client_file::peer, client_file::references, client_file::stream, client_file::tree, and xcalloc().
Referenced by file_read_open(), and file_write_open().
void file_error | ( | struct client * | c, |
const char * | fmt, | ||
... | |||
) |
Definition at line 250 of file file.c.
References client_file::buffer, client_files, msg_write_open::fd, file_can_print(), file_create_with_client(), file_push(), client::files, msg_write_open::flags, MSG_WRITE_OPEN, client_file::path, client::peer, proc_send(), msg_write_open::stream, client_file::stream, and xstrdup().
Referenced by cmdq_error().
void file_fire_done | ( | struct client_file * | cf | ) |
Definition at line 159 of file file.c.
References file_fire_done_cb().
Referenced by file_push(), file_read(), file_read_data(), file_read_done(), file_write(), file_write_ready(), and server_client_lost().
|
static |
Definition at line 147 of file file.c.
References client_file::buffer, client_file::c, client_file::cb, CLIENT_DEAD, client_file::data, client_file::error, file_free(), client::flags, and client_file::path.
Referenced by file_fire_done().
void file_fire_read | ( | struct client_file * | cf | ) |
Definition at line 166 of file file.c.
References client_file::buffer, client_file::c, client_file::cb, client_file::data, client_file::error, and client_file::path.
Referenced by file_read_data().
void file_free | ( | struct client_file * | cf | ) |
Definition at line 129 of file file.c.
References client_file::buffer, client_file::c, client_files, client_file::path, client_file::references, server_client_unref(), and client_file::tree.
Referenced by file_fire_done_cb(), file_push_cb(), file_read_error_callback(), file_write_callback(), and file_write_close().
|
static |
Definition at line 42 of file file.c.
References server_client_get_cwd(), xasprintf(), and xstrdup().
Referenced by file_read(), and file_write().
void file_print | ( | struct client * | c, |
const char * | fmt, | ||
... | |||
) |
void file_print_buffer | ( | struct client * | c, |
void * | data, | ||
size_t | size | ||
) |
Definition at line 223 of file file.c.
References client_file::buffer, client_files, msg_write_open::fd, file_can_print(), file_create_with_client(), file_push(), client::files, msg_write_open::flags, MSG_WRITE_OPEN, client_file::path, client::peer, proc_send(), msg_write_open::stream, client_file::stream, and xstrdup().
void file_push | ( | struct client_file * | cf | ) |
Definition at line 442 of file file.c.
References client_file::buffer, file_fire_done(), file_push_cb(), log_debug(), MSG_WRITE, MSG_WRITE_CLOSE, client_file::peer, proc_send(), client_file::references, msg_write_close::stream, client_file::stream, xmalloc(), and xrealloc().
Referenced by file_error(), file_print_buffer(), file_push_cb(), file_vprint(), and file_write_ready().
|
static |
Definition at line 431 of file file.c.
References client_file::c, CLIENT_DEAD, file_free(), file_push(), and client::flags.
Referenced by file_push().
void file_read | ( | struct client * | c, |
const char * | path, | ||
client_file_cb | cb, | ||
void * | cbdata | ||
) |
Definition at line 356 of file file.c.
References client_file::buffer, CLIENT_ATTACHED, CLIENT_CONTROL, client_file::error, f, msg_read_open::fd, file_create_with_client(), file_fire_done(), file_get_path(), file_next_stream, client::flags, MSG_READ_OPEN, client_file::path, client_file::peer, proc_send(), msg_read_open::stream, client_file::stream, xmalloc(), and xstrdup().
Referenced by cmd_source_file_done(), and window_pane_start_input().
|
static |
Definition at line 664 of file file.c.
References client_file::event, log_debug(), MSG_READ, client_file::peer, proc_send(), client_file::stream, xmalloc(), and xrealloc().
Referenced by file_read_open().
void file_read_data | ( | struct client_files * | files, |
struct imsg * | imsg | ||
) |
Definition at line 778 of file file.c.
References client_file::buffer, client_files, client_file::error, fatalx(), file_fire_done(), file_fire_read(), log_debug(), msg_read_data::stream, and client_file::stream.
Referenced by server_client_command_done().
void file_read_done | ( | struct client_files * | files, |
struct imsg * | imsg | ||
) |
Definition at line 804 of file file.c.
References client_files, msg_read_done::error, client_file::error, fatalx(), file_fire_done(), log_debug(), msg_read_done::stream, and client_file::stream.
Referenced by server_client_command_done().
|
static |
Definition at line 644 of file file.c.
References client_files, msg_read_done::error, client_file::event, client_file::fd, file_free(), log_debug(), MSG_READ_DONE, client_file::peer, proc_send(), msg_read_done::stream, client_file::stream, and client_file::tree.
Referenced by file_read_open().
void file_read_open | ( | struct client_files * | files, |
struct tmuxpeer * | peer, | ||
struct imsg * | imsg, | ||
int | allow_streams, | ||
int | close_received, | ||
client_file_cb | cb, | ||
void * | cbdata | ||
) |
Definition at line 696 of file file.c.
References client_file::cb, client_files, client_file::closed, msg_read_done::error, client_file::error, client_file::event, fatalx(), msg_read_open::fd, client_file::fd, file_create_with_peer(), file_read_callback(), file_read_error_callback(), log_debug(), MSG_READ_DONE, client_file::path, client_file::peer, proc_send(), msg_read_open::stream, msg_read_done::stream, and client_file::stream.
Referenced by client_dispatch_wait().
void file_vprint | ( | struct client * | c, |
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 196 of file file.c.
References client_file::buffer, client_files, msg_write_open::fd, file_can_print(), file_create_with_client(), file_push(), client::files, msg_write_open::flags, MSG_WRITE_OPEN, client_file::path, client::peer, proc_send(), msg_write_open::stream, client_file::stream, and xstrdup().
Referenced by file_print().
void file_write | ( | struct client * | c, |
const char * | path, | ||
int | flags, | ||
const void * | bdata, | ||
size_t | bsize, | ||
client_file_cb | cb, | ||
void * | cbdata | ||
) |
Definition at line 282 of file file.c.
References client_file::buffer, CLIENT_ATTACHED, CLIENT_CONTROL, client_file::error, f, msg_write_open::fd, file_create_with_client(), file_fire_done(), file_get_path(), file_next_stream, msg_write_open::flags, client::flags, MSG_WRITE_OPEN, client_file::path, client_file::peer, proc_send(), msg_write_open::stream, client_file::stream, xmalloc(), and xstrdup().
|
static |
Definition at line 518 of file file.c.
References client_file::cb, client_files, client_file::closed, client_file::data, client_file::event, client_file::fd, file_free(), log_debug(), client_file::stream, and client_file::tree.
Referenced by file_write_open().
void file_write_close | ( | struct client_files * | files, |
struct imsg * | imsg | ||
) |
Definition at line 619 of file file.c.
References client_files, client_file::event, fatalx(), client_file::fd, file_free(), log_debug(), msg_write_close::stream, and client_file::stream.
Referenced by client_dispatch_wait().
void file_write_data | ( | struct client_files * | files, |
struct imsg * | imsg | ||
) |
Definition at line 599 of file file.c.
References client_files, client_file::event, fatalx(), log_debug(), msg_write_data::stream, and client_file::stream.
Referenced by client_dispatch_wait().
|
static |
Definition at line 499 of file file.c.
References client_file::cb, client_file::data, client_file::event, client_file::fd, log_debug(), and client_file::stream.
Referenced by file_write_open().
int file_write_left | ( | struct client_files * | files | ) |
Definition at line 479 of file file.c.
References client_files, client_file::event, log_debug(), and client_file::stream.
Referenced by client_exit().
void file_write_open | ( | struct client_files * | files, |
struct tmuxpeer * | peer, | ||
struct imsg * | imsg, | ||
int | allow_streams, | ||
int | close_received, | ||
client_file_cb | cb, | ||
void * | cbdata | ||
) |
Definition at line 537 of file file.c.
References client_file::cb, client_files, client_file::closed, msg_write_ready::error, client_file::error, client_file::event, fatalx(), msg_write_open::fd, client_file::fd, file_create_with_peer(), file_write_callback(), file_write_error_callback(), msg_write_open::flags, log_debug(), MSG_WRITE_READY, client_file::path, client_file::peer, proc_send(), msg_write_open::stream, msg_write_ready::stream, and client_file::stream.
Referenced by client_dispatch_wait().
void file_write_ready | ( | struct client_files * | files, |
struct imsg * | imsg | ||
) |
Definition at line 758 of file file.c.
References client_files, msg_write_ready::error, client_file::error, fatalx(), file_fire_done(), file_push(), msg_write_ready::stream, and client_file::stream.
Referenced by server_client_command_done().
RB_GENERATE | ( | client_files | , |
client_file | , | ||
entry | , | ||
file_cmp | |||
) |
|
static |
Definition at line 36 of file file.c.
Referenced by file_read(), and file_write().