diff options
Diffstat (limited to 'tmux.h')
-rw-r--r-- | tmux.h | 126 |
1 files changed, 24 insertions, 102 deletions
@@ -21,13 +21,11 @@ #define PROTOCOL_VERSION 8 -#include <sys/param.h> #include <sys/time.h> #include <sys/uio.h> #include <event.h> #include <limits.h> -#include <signal.h> #include <stdarg.h> #include <stdio.h> #include <termios.h> @@ -69,89 +67,13 @@ extern char **environ; #define unused __attribute__ ((unused)) /* Attribute to make gcc check printf-like arguments. */ -#define printflike1 __attribute__ ((format (printf, 1, 2))) -#define printflike2 __attribute__ ((format (printf, 2, 3))) -#define printflike3 __attribute__ ((format (printf, 3, 4))) -#define printflike4 __attribute__ ((format (printf, 4, 5))) -#define printflike5 __attribute__ ((format (printf, 5, 6))) +#define printflike(a, b) __attribute__ ((format (printf, a, b))) /* Number of items in array. */ #ifndef nitems #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif -/* Default template for choose-buffer. */ -#define CHOOSE_BUFFER_TEMPLATE \ - "#{buffer_name}: #{buffer_size} bytes: #{buffer_sample}" - -/* Default template for choose-client. */ -#define CHOOSE_CLIENT_TEMPLATE \ - "#{client_tty}: #{session_name} " \ - "[#{client_width}x#{client_height} #{client_termname}]" \ - "#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \ - "(last used #{client_activity_string})" - -/* Default templates for choose-tree. */ -#define CHOOSE_TREE_SESSION_TEMPLATE \ - "#{session_name}: #{session_windows} windows" \ - "#{?session_grouped, (group ,}" \ - "#{session_group}#{?session_grouped,),}" \ - "#{?session_attached, (attached),}" -#define CHOOSE_TREE_WINDOW_TEMPLATE \ - "#{window_index}: #{window_name}#{window_flags} " \ - "\"#{pane_title}\"" - -/* Default template for display-message. */ -#define DISPLAY_MESSAGE_TEMPLATE \ - "[#{session_name}] #{window_index}:" \ - "#{window_name}, current pane #{pane_index} " \ - "- (%H:%M %d-%b-%y)" - -/* Default template for find-window. */ -#define FIND_WINDOW_TEMPLATE \ - "#{window_index}: #{window_name} " \ - "[#{window_width}x#{window_height}] " \ - "(#{window_panes} panes) #{window_find_matches}" - -/* Default template for list-buffers. */ -#define LIST_BUFFERS_TEMPLATE \ - "#{buffer_name}: #{buffer_size} bytes: " \ - "\"#{buffer_sample}\"" - -/* Default template for list-clients. */ -#define LIST_CLIENTS_TEMPLATE \ - "#{client_tty}: #{session_name} " \ - "[#{client_width}x#{client_height} #{client_termname}]" \ - "#{?client_utf8, (utf8),} #{?client_readonly, (ro),}" - -/* Default template for list-sessions. */ -#define LIST_SESSIONS_TEMPLATE \ - "#{session_name}: #{session_windows} windows " \ - "(created #{session_created_string}) " \ - "[#{session_width}x#{session_height}]" \ - "#{?session_grouped, (group ,}" \ - "#{session_group}#{?session_grouped,),}" \ - "#{?session_attached, (attached),}" - -/* Default templates for list-windows. */ -#define LIST_WINDOWS_TEMPLATE \ - "#{window_index}: #{window_name}#{window_flags} " \ - "(#{window_panes} panes) " \ - "[#{window_width}x#{window_height}] " \ - "[layout #{window_layout}] #{window_id}" \ - "#{?window_active, (active),}"; -#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \ - "#{session_name}:" \ - "#{window_index}: #{window_name}#{window_flags} " \ - "(#{window_panes} panes) " \ - "[#{window_width}x#{window_height}] " - -/* Default templates for break-pane, new-window and split-window. */ -#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" -#define NEW_SESSION_TEMPLATE "#{session_name}:" -#define NEW_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE -#define SPLIT_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE - /* Bell option values. */ #define BELL_NONE 0 #define BELL_ANY 1 @@ -1489,7 +1411,6 @@ struct cmd_entry { #define CMD_READONLY 0x4 int flags; - void (*key_binding)(struct cmd *, int); enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); }; @@ -1563,7 +1484,7 @@ extern char *cfg_file; extern char *shell_cmd; extern int debug_level; extern time_t start_time; -extern char socket_path[MAXPATHLEN]; +extern char socket_path[PATH_MAX]; extern int login_shell; extern char *environ_path; void logfile(const char *); @@ -1588,8 +1509,8 @@ int format_cmp(struct format_entry *, struct format_entry *); RB_PROTOTYPE(format_tree, format_entry, entry, format_cmp); struct format_tree *format_create(void); void format_free(struct format_tree *); -void printflike3 format_add(struct format_tree *, const char *, const char *, - ...); +void printflike(3, 4) format_add(struct format_tree *, const char *, + const char *, ...); const char *format_find(struct format_tree *, const char *); char *format_expand(struct format_tree *, const char *); void format_session(struct format_tree *, struct session *); @@ -1642,7 +1563,7 @@ void options_free(struct options *); struct options_entry *options_find1(struct options *, const char *); struct options_entry *options_find(struct options *, const char *); void options_remove(struct options *, const char *); -struct options_entry *printflike3 options_set_string(struct options *, +struct options_entry *printflike(3, 4) options_set_string(struct options *, const char *, const char *, ...); char *options_get_string(struct options *, const char *); struct options_entry *options_set_number(struct options *, const char *, @@ -1909,8 +1830,8 @@ size_t cmd_list_print(struct cmd_list *, char *, size_t); /* cmd-queue.c */ struct cmd_q *cmdq_new(struct client *); int cmdq_free(struct cmd_q *); -void printflike2 cmdq_print(struct cmd_q *, const char *, ...); -void printflike2 cmdq_error(struct cmd_q *, const char *, ...); +void printflike(2, 3) cmdq_print(struct cmd_q *, const char *, ...); +void printflike(2, 3) cmdq_error(struct cmd_q *, const char *, ...); int cmdq_guard(struct cmd_q *, const char *, int); void cmdq_run(struct cmd_q *, struct cmd_list *); void cmdq_append(struct cmd_q *, struct cmd_list *); @@ -2005,9 +1926,9 @@ void status_free_jobs(struct status_out_tree *); void status_update_jobs(struct client *); void status_set_window_at(struct client *, u_int); int status_redraw(struct client *); -char *status_replace(struct client *, struct session *, - struct winlink *, struct window_pane *, const char *, time_t, int); -void printflike2 status_message_set(struct client *, const char *, ...); +char *status_replace(struct client *, struct session *, struct winlink *, + struct window_pane *, const char *, time_t, int); +void printflike(2, 3) status_message_set(struct client *, const char *, ...); void status_message_clear(struct client *); int status_message_redraw(struct client *); void status_prompt_set(struct client *, const char *, const char *, @@ -2097,13 +2018,13 @@ void screen_write_start( struct screen_write_ctx *, struct window_pane *, struct screen *); void screen_write_stop(struct screen_write_ctx *); void screen_write_reset(struct screen_write_ctx *); -size_t printflike2 screen_write_cstrlen(int, const char *, ...); -void printflike5 screen_write_cnputs(struct screen_write_ctx *, +size_t printflike(2, 3) screen_write_cstrlen(int, const char *, ...); +void printflike(5, 6) screen_write_cnputs(struct screen_write_ctx *, ssize_t, struct grid_cell *, int, const char *, ...); -size_t printflike2 screen_write_strlen(int, const char *, ...); -void printflike3 screen_write_puts(struct screen_write_ctx *, +size_t printflike(2, 3) screen_write_strlen(int, const char *, ...); +void printflike(3, 4) screen_write_puts(struct screen_write_ctx *, struct grid_cell *, const char *, ...); -void printflike5 screen_write_nputs(struct screen_write_ctx *, +void printflike(5, 6) screen_write_nputs(struct screen_write_ctx *, ssize_t, struct grid_cell *, int, const char *, ...); void screen_write_vnputs(struct screen_write_ctx *, ssize_t, struct grid_cell *, int, const char *, va_list); @@ -2287,7 +2208,7 @@ extern const char window_clock_table[14][5][5]; extern const struct window_mode window_copy_mode; void window_copy_init_from_pane(struct window_pane *); void window_copy_init_for_output(struct window_pane *); -void printflike2 window_copy_add(struct window_pane *, const char *, ...); +void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...); void window_copy_vadd(struct window_pane *, const char *, va_list); void window_copy_pageup(struct window_pane *); @@ -2326,7 +2247,7 @@ void clear_signals(int); /* control.c */ void control_callback(struct client *, int, void *); -void printflike2 control_write(struct client *, const char *, ...); +void printflike(2, 3) control_write(struct client *, const char *, ...); void control_write_buffer(struct client *, struct evbuffer *); /* control-notify.c */ @@ -2399,18 +2320,19 @@ struct event_base *osdep_event_init(void); /* log.c */ void log_open(const char *); void log_close(void); -void printflike1 log_debug(const char *, ...); -__dead void printflike1 log_fatal(const char *, ...); -__dead void printflike1 log_fatalx(const char *, ...); +void printflike(1, 2) log_debug(const char *, ...); +__dead void printflike(1, 2) log_fatal(const char *, ...); +__dead void printflike(1, 2) log_fatalx(const char *, ...); /* xmalloc.c */ char *xstrdup(const char *); void *xcalloc(size_t, size_t); void *xmalloc(size_t); -void *xrealloc(void *, size_t, size_t); -int printflike2 xasprintf(char **, const char *, ...); +void *xrealloc(void *, size_t); +void *xreallocarray(void *, size_t, size_t); +int printflike(2, 3) xasprintf(char **, const char *, ...); int xvasprintf(char **, const char *, va_list); -int printflike3 xsnprintf(char *, size_t, const char *, ...); +int printflike(3, 4) xsnprintf(char *, size_t, const char *, ...); int xvsnprintf(char *, size_t, const char *, va_list); /* style.c */ |