diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 53c1df31..daab428f 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -30,7 +30,7 @@ * Attach existing session to the current terminal. */ -enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_attach_session_entry = { .name = "attach-session", @@ -154,7 +154,7 @@ cmd_attach_session(struct cmd_q *cmdq, int dflag, int rflag, const char *cflag, return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_attach_session_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-bind-key.c b/cmd-bind-key.c index 88767245..bcc179c3 100644 --- a/cmd-bind-key.c +++ b/cmd-bind-key.c @@ -27,10 +27,10 @@ * Bind a key to a command, this recurses through cmd_*. */ -enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *); -enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *, - key_code); +static enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *, + key_code); const struct cmd_entry cmd_bind_key_entry = { .name = "bind-key", @@ -44,7 +44,7 @@ const struct cmd_entry cmd_bind_key_entry = { .exec = cmd_bind_key_exec }; -enum cmd_retval +static enum cmd_retval cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -93,7 +93,7 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_bind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key) { struct args *args = self->args; diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 85873227..b57542aa 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -28,7 +28,7 @@ #define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" -enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_break_pane_entry = { .name = "break-pane", @@ -44,7 +44,7 @@ const struct cmd_entry cmd_break_pane_entry = { .exec = cmd_break_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 33f6cf08..e468674d 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -27,13 +27,14 @@ * Write the entire contents of a pane to a buffer or stdout. */ -enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_capture_pane_exec(struct cmd *, struct cmd_q *); -char *cmd_capture_pane_append(char *, size_t *, char *, size_t); -char *cmd_capture_pane_pending(struct args *, struct window_pane *, - size_t *); -char *cmd_capture_pane_history(struct args *, struct cmd_q *, - struct window_pane *, size_t *); +static char *cmd_capture_pane_append(char *, size_t *, char *, + size_t); +static char *cmd_capture_pane_pending(struct args *, + struct window_pane *, size_t *); +static char *cmd_capture_pane_history(struct args *, struct cmd_q *, + struct window_pane *, size_t *); const struct cmd_entry cmd_capture_pane_entry = { .name = "capture-pane", @@ -49,7 +50,7 @@ const struct cmd_entry cmd_capture_pane_entry = { .exec = cmd_capture_pane_exec }; -char * +static char * cmd_capture_pane_append(char *buf, size_t *len, char *line, size_t linelen) { buf = xrealloc(buf, *len + linelen + 1); @@ -58,7 +59,7 @@ cmd_capture_pane_append(char *buf, size_t *len, char *line, size_t linelen) return (buf); } -char * +static char * cmd_capture_pane_pending(struct args *args, struct window_pane *wp, size_t *len) { @@ -90,7 +91,7 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp, return (buf); } -char * +static char * cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq, struct window_pane *wp, size_t *len) { @@ -175,7 +176,7 @@ cmd_capture_pane_history(struct args *args, struct cmd_q *cmdq, return (buf); } -enum cmd_retval +static enum cmd_retval cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index 90872e90..fee4958a 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -30,7 +30,7 @@ #define CHOOSE_BUFFER_TEMPLATE \ "#{buffer_name}: #{buffer_size} bytes: #{buffer_sample}" -enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_choose_buffer_entry = { .name = "choose-buffer", @@ -45,7 +45,7 @@ const struct cmd_entry cmd_choose_buffer_entry = { .exec = cmd_choose_buffer_exec }; -enum cmd_retval +static enum cmd_retval cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-choose-client.c b/cmd-choose-client.c index b9a24be6..67d184b3 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -33,9 +33,9 @@ "#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \ "(last used #{t:client_activity})" -enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *); -void cmd_choose_client_callback(struct window_choose_data *); +static void cmd_choose_client_callback(struct window_choose_data *); const struct cmd_entry cmd_choose_client_entry = { .name = "choose-client", @@ -54,7 +54,7 @@ struct cmd_choose_client_data { struct client *client; }; -enum cmd_retval +static enum cmd_retval cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -110,7 +110,7 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -void +static void cmd_choose_client_callback(struct window_choose_data *cdata) { struct client *c; diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index db9222ba..13bbe2a7 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -41,7 +41,7 @@ "#{window_index}: #{window_name}#{window_flags} " \ "\"#{pane_title}\"" -enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_choose_tree_entry = { .name = "choose-tree", @@ -83,7 +83,7 @@ const struct cmd_entry cmd_choose_window_entry = { .exec = cmd_choose_tree_exec }; -enum cmd_retval +static enum cmd_retval cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-clear-history.c b/cmd-clear-history.c index 62683ff6..a1da256d 100644 --- a/cmd-clear-history.c +++ b/cmd-clear-history.c @@ -24,7 +24,7 @@ * Clear pane history. */ -enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_clear_history_entry = { .name = "clear-history", @@ -39,7 +39,7 @@ const struct cmd_entry cmd_clear_history_entry = { .exec = cmd_clear_history_exec }; -enum cmd_retval +static enum cmd_retval cmd_clear_history_exec(__unused struct cmd *self, struct cmd_q *cmdq) { struct window_pane *wp = cmdq->state.tflag.wp; diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index 3ec22865..a2fc1278 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -29,10 +29,10 @@ * Prompt for command in client. */ -enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); -int cmd_command_prompt_callback(void *, const char *); -void cmd_command_prompt_free(void *); +static int cmd_command_prompt_callback(void *, const char *); +static void cmd_command_prompt_free(void *); const struct cmd_entry cmd_command_prompt_entry = { .name = "command-prompt", @@ -58,7 +58,7 @@ struct cmd_command_prompt_cdata { int idx; }; -enum cmd_retval +static enum cmd_retval cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -115,7 +115,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -int +static int cmd_command_prompt_callback(void *data, const char *s) { struct cmd_command_prompt_cdata *cdata = data; @@ -162,7 +162,7 @@ cmd_command_prompt_callback(void *data, const char *s) return (0); } -void +static void cmd_command_prompt_free(void *data) { struct cmd_command_prompt_cdata *cdata = data; diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index b5a12821..4241aefb 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -28,10 +28,10 @@ * Asks for confirmation before executing a command. */ -enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_q *); -int cmd_confirm_before_callback(void *, const char *); -void cmd_confirm_before_free(void *); +static int cmd_confirm_before_callback(void *, const char *); +static void cmd_confirm_before_free(void *); const struct cmd_entry cmd_confirm_before_entry = { .name = "confirm-before", @@ -51,7 +51,7 @@ struct cmd_confirm_before_data { struct client *client; }; -enum cmd_retval +static enum cmd_retval cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -83,7 +83,7 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -int +static int cmd_confirm_before_callback(void *data, const char *s) { struct cmd_confirm_before_data *cdata = data; @@ -113,7 +113,7 @@ cmd_confirm_before_callback(void *data, const char *s) return (0); } -void +static void cmd_confirm_before_free(void *data) { struct cmd_confirm_before_data *cdata = data; diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index d785e893..6b99c347 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -24,7 +24,7 @@ * Enter copy or clock mode. */ -enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_copy_mode_entry = { .name = "copy-mode", @@ -52,7 +52,7 @@ const struct cmd_entry cmd_clock_mode_entry = { .exec = cmd_copy_mode_exec }; -enum cmd_retval +static enum cmd_retval cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-detach-client.c b/cmd-detach-client.c index 80c6555f..814ba091 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -26,7 +26,7 @@ * Detach a client. */ -enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_detach_client_entry = { .name = "detach-client", @@ -55,7 +55,7 @@ const struct cmd_entry cmd_suspend_client_entry = { .exec = cmd_detach_client_exec }; -enum cmd_retval +static enum cmd_retval cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-display-message.c b/cmd-display-message.c index 217d164a..05e84561 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -32,7 +32,7 @@ "#{window_name}, current pane #{pane_index} " \ "- (%H:%M %d-%b-%y)" -enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_display_message_entry = { .name = "display-message", @@ -49,7 +49,7 @@ const struct cmd_entry cmd_display_message_entry = { .exec = cmd_display_message_exec }; -enum cmd_retval +static enum cmd_retval cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-find-window.c b/cmd-find-window.c index 6324f26a..6ab6fbcf 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -33,9 +33,9 @@ "[#{window_width}x#{window_height}] " \ "(#{window_panes} panes) #{window_find_matches}" -enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_find_window_exec(struct cmd *, struct cmd_q *); -void cmd_find_window_callback(struct window_choose_data *); +static void cmd_find_window_callback(struct window_choose_data *); /* Flags for determining matching behavior. */ #define CMD_FIND_WINDOW_BY_TITLE 0x1 @@ -68,11 +68,11 @@ struct cmd_find_window_data { }; TAILQ_HEAD(cmd_find_window_list, cmd_find_window_data); -u_int cmd_find_window_match_flags(struct args *); -void cmd_find_window_match(struct cmd_find_window_list *, int, - struct winlink *, const char *, const char *); +static u_int cmd_find_window_match_flags(struct args *); +static void cmd_find_window_match(struct cmd_find_window_list *, int, + struct winlink *, const char *, const char *); -u_int +static u_int cmd_find_window_match_flags(struct args *args) { u_int match_flags = 0; @@ -92,7 +92,7 @@ cmd_find_window_match_flags(struct args *args) return (match_flags); } -void +static void cmd_find_window_match(struct cmd_find_window_list *find_list, int match_flags, struct winlink *wl, const char *str, const char *searchstr) @@ -138,7 +138,7 @@ cmd_find_window_match(struct cmd_find_window_list *find_list, free(find_data); } -enum cmd_retval +static enum cmd_retval cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -216,7 +216,7 @@ out: return (CMD_RETURN_NORMAL); } -void +static void cmd_find_window_callback(struct window_choose_data *cdata) { struct session *s; diff --git a/cmd-find.c b/cmd-find.c index 22511201..dec386ac 100644 --- a/cmd-find.c +++ b/cmd-find.c @@ -27,33 +27,35 @@ #include "tmux.h" -struct session *cmd_find_try_TMUX(struct client *, struct window *); -int cmd_find_client_better(struct client *, struct client *); -struct client *cmd_find_best_client(struct client **, u_int); -int cmd_find_session_better(struct session *, struct session *, - int); -struct session *cmd_find_best_session(struct session **, u_int, int); -int cmd_find_best_session_with_window(struct cmd_find_state *); -int cmd_find_best_winlink_with_window(struct cmd_find_state *); +static struct session *cmd_find_try_TMUX(struct client *, struct window *); +static int cmd_find_client_better(struct client *, struct client *); +static struct client *cmd_find_best_client(struct client **, u_int); +static int cmd_find_session_better(struct session *, struct session *, + int); +static struct session *cmd_find_best_session(struct session **, u_int, int); +static int cmd_find_best_session_with_window(struct cmd_find_state *); +static int cmd_find_best_winlink_with_window(struct cmd_find_state *); -int cmd_find_current_session_with_client(struct cmd_find_state *); -int cmd_find_current_session(struct cmd_find_state *); -struct client *cmd_find_current_client(struct cmd_q *); +static int cmd_find_current_session_with_client(struct cmd_find_state *); +static int cmd_find_current_session(struct cmd_find_state *); +static struct client *cmd_find_current_client(struct cmd_q *); -const char *cmd_find_map_table(const char *[][2], const char *); +static const char *cmd_find_map_table(const char *[][2], const char *); -int cmd_find_get_session(struct cmd_find_state *, const char *); -int cmd_find_get_window(struct cmd_find_state *, const char *); -int cmd_find_get_window_with_session(struct cmd_find_state *, const char *); -int cmd_find_get_window_with_pane(struct cmd_find_state *); -int cmd_find_get_pane(struct cmd_find_state *, const char *); -int cmd_find_get_pane_with_session(struct cmd_find_state *, const char *); -int cmd_find_get_pane_with_window(struct cmd_find_state *, const char *); +static int cmd_find_get_session(struct cmd_find_state *, const char *); +static int cmd_find_get_window(struct cmd_find_state *, const char *); +static int cmd_find_get_window_with_session(struct cmd_find_state *, + const char *); +static int cmd_find_get_pane(struct cmd_find_state *, const char *); +static int cmd_find_get_pane_with_session(struct cmd_find_state *, + const char *); +static int cmd_find_get_pane_with_window(struct cmd_find_state *, + const char *); -const char *cmd_find_session_table[][2] = { +static const char *cmd_find_session_table[][2] = { { NULL, NULL } }; -const char *cmd_find_window_table[][2] = { +static const char *cmd_find_window_table[][2] = { { "{start}", "^" }, { "{last}", "!" }, { "{end}", "$" }, @@ -61,7 +63,7 @@ const char *cmd_find_window_table[][2] = { { "{previous}", "-" }, { NULL, NULL } }; -const char *cmd_find_pane_table[][2] = { +static const char *cmd_find_pane_table[][2] = { { "{last}", "!" }, { "{next}", "+" }, { "{previous}", "-" }, @@ -81,7 +83,7 @@ const char *cmd_find_pane_table[][2] = { }; /* Get session from TMUX if present. */ -struct session * +static struct session * cmd_find_try_TMUX(struct client *c, struct window *w) { struct environ_entry *envent; @@ -108,7 +110,7 @@ cmd_find_try_TMUX(struct client *c, struct window *w) } /* Is this client better? */ -int +static int cmd_find_client_better(struct client *c, struct client *than) { if (than == NULL) @@ -117,7 +119,7 @@ cmd_find_client_better(struct client *c, struct client *than) } /* Find best client from a list, or all if list is NULL. */ -struct client * +static struct client * cmd_find_best_client(struct client **clist, u_int csize) { struct client *c_loop, *c; @@ -143,7 +145,7 @@ cmd_find_best_client(struct client **clist, u_int csize) } /* Is this session better? */ -int +static int cmd_find_session_better(struct session *s, struct session *than, int flags) { int attached; @@ -161,7 +163,7 @@ cmd_find_session_better(struct session *s, struct session *than, int flags) } /* Find best session from a list, or all if list is NULL. */ -struct session * +static struct session * cmd_find_best_session(struct session **slist, u_int ssize, int flags) { struct session *s_loop, *s; @@ -183,7 +185,7 @@ cmd_find_best_session(struct session **slist, u_int ssize, int flags) } /* Find best session and winlink for window. */ -int +static int cmd_find_best_session_with_window(struct cmd_find_state *fs) { struct session **slist = NULL; @@ -220,7 +222,7 @@ fail: * Find the best winlink for a window (the current if it contains the pane, * otherwise the first). */ -int +static int cmd_find_best_winlink_with_window(struct cmd_find_state *fs) { struct winlink *wl, *wl_loop; @@ -244,7 +246,7 @@ cmd_find_best_winlink_with_window(struct cmd_find_state *fs) } /* Find current session when we have an unattached client. */ -int +static int cmd_find_current_session_with_client(struct cmd_find_state *fs) { struct window_pane *wp; @@ -308,7 +310,7 @@ unknown_pane: * Work out the best current state. If this function succeeds, the state is * guaranteed to be completely filled in. */ -int +static int cmd_find_current_session(struct cmd_find_state *fs) { /* If we know the current client, use it. */ @@ -338,7 +340,7 @@ cmd_find_current_session(struct cmd_find_state *fs) } /* Work out the best current client. */ -struct client * +static struct client * cmd_find_current_client(struct cmd_q *cmdq) { struct cmd_find_state current; @@ -384,7 +386,7 @@ cmd_find_current_client(struct cmd_q *cmdq) } /* Maps string in table. */ -const char * +static const char * cmd_find_map_table(const char *table[][2], const char *s) { u_int i; @@ -397,7 +399,7 @@ cmd_find_map_table(const char *table[][2], const char *s) } /* Find session from string. Fills in s. */ -int +static int cmd_find_get_session(struct cmd_find_state *fs, const char *session) { struct session *s, *s_loop; @@ -461,7 +463,7 @@ cmd_find_get_session(struct cmd_find_state *fs, const char *session) } /* Find window from string. Fills in s, wl, w. */ -int +static int cmd_find_get_window(struct cmd_find_state *fs, const char *window) { log_debug("%s: %s", __func__, window); @@ -497,7 +499,7 @@ cmd_find_get_window(struct cmd_find_state *fs, const char *window) * Find window from string, assuming it is in given session. Needs s, fills in * wl and w. */ -int +static int cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) { struct winlink *wl; @@ -647,18 +649,8 @@ cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) return (-1); } -/* Find window from given pane. Needs wp, fills in s and wl and w. */ -int -cmd_find_get_window_with_pane(struct cmd_find_state *fs) -{ - log_debug("%s", __func__); - - fs->w = fs->wp->window; - return (cmd_find_best_session_with_window(fs)); -} - /* Find pane from string. Fills in s, wl, w, wp. */ -int +static int cmd_find_get_pane(struct cmd_find_state *fs, const char *pane) { log_debug("%s: %s", __func__, pane); @@ -695,7 +687,7 @@ cmd_find_get_pane(struct cmd_find_state *fs, const char *pane) * Find pane from string, assuming it is in given session. Needs s, fills in wl * and w and wp. */ -int +static int cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane) { log_debug("%s: %s", __func__, pane); @@ -722,7 +714,7 @@ cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane) * Find pane from string, assuming it is in the given window. Needs w, fills in * wp. */ -int +static int cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane) { const char *errstr; diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 3dc20cd1..615da2b6 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -29,11 +29,11 @@ * Executes a tmux command if a shell command returns true or false. */ -enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmd_q *); -void cmd_if_shell_callback(struct job *); -void cmd_if_shell_done(struct cmd_q *); -void cmd_if_shell_free(void *); +static void cmd_if_shell_callback(struct job *); +static void cmd_if_shell_done(struct cmd_q *); +static void cmd_if_shell_free(void *); const struct cmd_entry cmd_if_shell_entry = { .name = "if-shell", @@ -63,7 +63,7 @@ struct cmd_if_shell_data { int references; }; -enum cmd_retval +static enum cmd_retval cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -137,7 +137,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_WAIT); } -void +static void cmd_if_shell_callback(struct job *job) { struct cmd_if_shell_data *cdata = job->data; @@ -174,7 +174,7 @@ cmd_if_shell_callback(struct job *job) cmd_list_free(cmdlist); } -void +static void cmd_if_shell_done(struct cmd_q *cmdq1) { struct cmd_if_shell_data *cdata = cmdq1->data; @@ -197,7 +197,7 @@ cmd_if_shell_done(struct cmd_q *cmdq1) free(cdata); } -void +static void cmd_if_shell_free(void *data) { struct cmd_if_shell_data *cdata = data; diff --git a/cmd-join-pane.c b/cmd-join-pane.c index 263e7dfc..3ff8f08e 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -29,9 +29,7 @@ * Join or move a pane into another (like split/swap/kill). */ -enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_q *); - -enum cmd_retval join_pane(struct cmd *, struct cmd_q *, int); +static enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_join_pane_entry = { .name = "join-pane", @@ -61,14 +59,8 @@ const struct cmd_entry cmd_move_pane_entry = { .exec = cmd_join_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq) -{ - return (join_pane(self, cmdq, self->entry == &cmd_join_pane_entry)); -} - -enum cmd_retval -join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) { struct args *args = self->args; struct session *dst_s; @@ -79,6 +71,12 @@ join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) int size, percentage, dst_idx; enum layout_type type; struct layout_cell *lc; + int not_same_window; + + if (self->entry == &cmd_join_pane_entry) + not_same_window = 1; + else + not_same_window = 0; dst_s = cmdq->state.tflag.s; dst_wl = cmdq->state.tflag.wl; diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c index ebb2b8d6..76829aa3 100644 --- a/cmd-kill-pane.c +++ b/cmd-kill-pane.c @@ -26,7 +26,7 @@ * Kill pane. */ -enum cmd_retval cmd_kill_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_kill_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_pane_entry = { .name = "kill-pane", @@ -41,7 +41,7 @@ const struct cmd_entry cmd_kill_pane_entry = { .exec = cmd_kill_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct winlink *wl = cmdq->state.tflag.wl; diff --git a/cmd-kill-server.c b/cmd-kill-server.c index d1940c33..bbb4e8a0 100644 --- a/cmd-kill-server.c +++ b/cmd-kill-server.c @@ -27,7 +27,7 @@ * Kill the server and do nothing else. */ -enum cmd_retval cmd_kill_server_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_kill_server_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_server_entry = { .name = "kill-server", @@ -51,7 +51,7 @@ const struct cmd_entry cmd_start_server_entry = { .exec = cmd_kill_server_exec }; -enum cmd_retval +static enum cmd_retval cmd_kill_server_exec(struct cmd *self, __unused struct cmd_q *cmdq) { if (self->entry == &cmd_kill_server_entry) diff --git a/cmd-kill-session.c b/cmd-kill-session.c index c77e45bb..ec7d5fb2 100644 --- a/cmd-kill-session.c +++ b/cmd-kill-session.c @@ -27,7 +27,7 @@ * Note this deliberately has no alias to make it hard to hit by accident. */ -enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_session_entry = { .name = "kill-session", @@ -42,7 +42,7 @@ const struct cmd_entry cmd_kill_session_entry = { .exec = cmd_kill_session_exec }; -enum cmd_retval +static enum cmd_retval cmd_kill_session_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-kill-window.c b/cmd-kill-window.c index 9d388ce5..c7534d5c 100644 --- a/cmd-kill-window.c +++ b/cmd-kill-window.c @@ -24,7 +24,7 @@ * Destroy window. */ -enum cmd_retval cmd_kill_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_kill_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_window_entry = { .name = "kill-window", @@ -52,7 +52,7 @@ const struct cmd_entry cmd_unlink_window_entry = { .exec = cmd_kill_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index 238b2776..41ad865b 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -30,7 +30,7 @@ #define LIST_BUFFERS_TEMPLATE \ "#{buffer_name}: #{buffer_size} bytes: \"#{buffer_sample}\"" -enum cmd_retval cmd_list_buffers_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_list_buffers_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_buffers_entry = { .name = "list-buffers", @@ -43,7 +43,7 @@ const struct cmd_entry cmd_list_buffers_entry = { .exec = cmd_list_buffers_exec }; -enum cmd_retval +static enum cmd_retval cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-list-clients.c b/cmd-list-clients.c index f318ac18..efe19652 100644 --- a/cmd-list-clients.c +++ b/cmd-list-clients.c @@ -33,7 +33,7 @@ "[#{client_width}x#{client_height} #{client_termname}]" \ "#{?client_utf8, (utf8),} #{?client_readonly, (ro),}" -enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_clients_entry = { .name = "list-clients", @@ -48,7 +48,7 @@ const struct cmd_entry cmd_list_clients_entry = { .exec = cmd_list_clients_exec }; -enum cmd_retval +static enum cmd_retval cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 76e06a71..9d78589a 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -26,13 +26,13 @@ * List panes on given window. */ -enum cmd_retval cmd_list_panes_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_list_panes_exec(struct cmd *, struct cmd_q *); -void cmd_list_panes_server(struct cmd *, struct cmd_q *); -void cmd_list_panes_session(struct cmd *, struct session *, struct cmd_q *, - int); -void cmd_list_panes_window(struct cmd *, struct session *, struct winlink *, - struct cmd_q *, int); +static void cmd_list_panes_server(struct cmd *, struct cmd_q *); +static void cmd_list_panes_session(struct cmd *, struct session *, + struct cmd_q *, int); +static void cmd_list_panes_window(struct cmd *, struct session *, + struct winlink *, struct cmd_q *, int); const struct cmd_entry cmd_list_panes_entry = { .name = "list-panes", @@ -47,7 +47,7 @@ const struct cmd_entry cmd_list_panes_entry = { .exec = cmd_list_panes_exec }; -enum cmd_retval +static enum cmd_retval cmd_list_panes_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -64,7 +64,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -void +static void cmd_list_panes_server(struct cmd *self, struct cmd_q *cmdq) { struct session *s; @@ -73,7 +73,7 @@ cmd_list_panes_server(struct cmd *self, struct cmd_q *cmdq) cmd_list_panes_session(self, s, cmdq, 2); } -void +static void cmd_list_panes_session(struct cmd *self, struct session *s, struct cmd_q *cmdq, int type) { @@ -83,7 +83,7 @@ cmd_list_panes_session(struct cmd *self, struct session *s, struct cmd_q *cmdq, cmd_list_panes_window(self, s, wl, cmdq, type); } -void +static void cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl, struct cmd_q *cmdq, int type) { diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 27e80dbc..30a1f586 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -36,7 +36,7 @@ "#{session_group}#{?session_grouped,),}" \ "#{?session_attached, (attached),}" -enum cmd_retval cmd_list_sessions_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_list_sessions_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_sessions_entry = { .name = "list-sessions", @@ -49,7 +49,7 @@ const struct cmd_entry cmd_list_sessions_entry = { .exec = cmd_list_sessions_exec }; -enum cmd_retval +static enum cmd_retval cmd_list_sessions_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 11a5fddf..7ca49b3e 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -39,11 +39,11 @@ "(#{window_panes} panes) " \ "[#{window_width}x#{window_height}] " -enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmd_q *); -void cmd_list_windows_server(struct cmd *, struct cmd_q *); -void cmd_list_windows_session(struct cmd *, struct session *, - struct cmd_q *, int); +static void cmd_list_windows_server(struct cmd *, struct cmd_q *); +static void cmd_list_windows_session(struct cmd *, struct session *, + struct cmd_q *, int); const struct cmd_entry cmd_list_windows_entry = { .name = "list-windows", @@ -58,7 +58,7 @@ const struct cmd_entry cmd_list_windows_entry = { .exec = cmd_list_windows_exec }; -enum cmd_retval +static enum cmd_retval cmd_list_windows_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -71,7 +71,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -void +static void cmd_list_windows_server(struct cmd *self, struct cmd_q *cmdq) { struct session *s; @@ -80,7 +80,7 @@ cmd_list_windows_server(struct cmd *self, struct cmd_q *cmdq) cmd_list_windows_session(self, s, cmdq, 1); } -void +static void cmd_list_windows_session(struct cmd *self, struct session *s, struct cmd_q *cmdq, int type) { diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index de76b855..d97d139c 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -31,8 +31,9 @@ * Loads a paste buffer from a file. */ -enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmd_q *); -void cmd_load_buffer_callback(struct client *, int, void *); +static enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmd_q *); + +static void cmd_load_buffer_callback(struct client *, int, void *); const struct cmd_entry cmd_load_buffer_entry = { .name = "load-buffer", @@ -45,7 +46,7 @@ const struct cmd_entry cmd_load_buffer_entry = { .exec = cmd_load_buffer_exec }; -enum cmd_retval +static enum cmd_retval cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -132,7 +133,7 @@ error: return (CMD_RETURN_ERROR); } -void +static void cmd_load_buffer_callback(struct client *c, int closed, void *data) { const char *bufname = data; diff --git a/cmd-lock-server.c b/cmd-lock-server.c index 01597169..2eef9952 100644 --- a/cmd-lock-server.c +++ b/cmd-lock-server.c @@ -24,7 +24,7 @@ * Lock commands. */ -enum cmd_retval cmd_lock_server_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_lock_server_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_lock_server_entry = { .name = "lock-server", @@ -63,7 +63,7 @@ const struct cmd_entry cmd_lock_client_entry = { .exec = cmd_lock_server_exec }; -enum cmd_retval +static enum cmd_retval cmd_lock_server_exec(struct cmd *self, __unused struct cmd_q *cmdq) { if (self->entry == &cmd_lock_server_entry) diff --git a/cmd-move-window.c b/cmd-move-window.c index aa683b83..1d423646 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -26,7 +26,7 @@ * Move a window. */ -enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_move_window_entry = { .name = "move-window", @@ -56,7 +56,7 @@ const struct cmd_entry cmd_link_window_entry = { .exec = cmd_move_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-new-session.c b/cmd-new-session.c index 357ffed1..f48872fc 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -33,7 +33,7 @@ #define NEW_SESSION_TEMPLATE "#{session_name}:" -enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_new_session_entry = { .name = "new-session", @@ -63,7 +63,7 @@ const struct cmd_entry cmd_has_session_entry = { .exec = cmd_new_session_exec }; -enum cmd_retval +static enum cmd_retval cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-new-window.c b/cmd-new-window.c index 2a647b9f..edd44150 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -32,7 +32,7 @@ #define NEW_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" -enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_new_window_entry = { .name = "new-window", @@ -48,7 +48,7 @@ const struct cmd_entry cmd_new_window_entry = { .exec = cmd_new_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 8025975f..5f8b46c4 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -28,10 +28,7 @@ * Paste paste buffer if present. */ -enum cmd_retval cmd_paste_buffer_exec(struct cmd *, struct cmd_q *); - -void cmd_paste_buffer_filter(struct window_pane *, - const char *, size_t, const char *, int); +static enum cmd_retval cmd_paste_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_paste_buffer_entry = { .name = "paste-buffer", @@ -47,7 +44,7 @@ const struct cmd_entry cmd_paste_buffer_entry = { .exec = cmd_paste_buffer_exec }; -enum cmd_retval +static enum cmd_retval cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index e59fc586..ea8ec527 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -33,9 +33,9 @@ * Open pipe to redirect pane output. If already open, close first. */ -enum cmd_retval cmd_pipe_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_pipe_pane_exec(struct cmd *, struct cmd_q *); -void cmd_pipe_pane_error_callback(struct bufferevent *, short, void *); +static void cmd_pipe_pane_error_callback(struct bufferevent *, short, void *); const struct cmd_entry cmd_pipe_pane_entry = { .name = "pipe-pane", @@ -50,7 +50,7 @@ const struct cmd_entry cmd_pipe_pane_entry = { .exec = cmd_pipe_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -142,7 +142,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) } } -void +static void cmd_pipe_pane_error_callback(__unused struct bufferevent *bufev, __unused short what, void *data) { diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c index 79e5aad0..79747f2c 100644 --- a/cmd-refresh-client.c +++ b/cmd-refresh-client.c @@ -24,7 +24,7 @@ * Refresh client. */ -enum cmd_retval cmd_refresh_client_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_refresh_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_refresh_client_entry = { .name = "refresh-client", @@ -39,7 +39,7 @@ const struct cmd_entry cmd_refresh_client_entry = { .exec = cmd_refresh_client_exec }; -enum cmd_retval +static enum cmd_retval cmd_refresh_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-rename-session.c b/cmd-rename-session.c index b40f44f7..7e9fd015 100644 --- a/cmd-rename-session.c +++ b/cmd-rename-session.c @@ -26,7 +26,7 @@ * Change session name. */ -enum cmd_retval cmd_rename_session_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_rename_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rename_session_entry = { .name = "rename-session", @@ -41,7 +41,7 @@ const struct cmd_entry cmd_rename_session_entry = { .exec = cmd_rename_session_exec }; -enum cmd_retval +static enum cmd_retval cmd_rename_session_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-rename-window.c b/cmd-rename-window.c index a1f15eef..ee53fcb3 100644 --- a/cmd-rename-window.c +++ b/cmd-rename-window.c @@ -26,7 +26,7 @@ * Rename a window. */ -enum cmd_retval cmd_rename_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_rename_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rename_window_entry = { .name = "rename-window", @@ -41,7 +41,7 @@ const struct cmd_entry cmd_rename_window_entry = { .exec = cmd_rename_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_rename_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index fa52ab14..36726688 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -26,9 +26,10 @@ * Increase or decrease pane size. */ -enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmd_q *); -void cmd_resize_pane_mouse_update(struct client *, struct mouse_event *); +static void cmd_resize_pane_mouse_update(struct client *, + struct mouse_event *); const struct cmd_entry cmd_resize_pane_entry = { .name = "resize-pane", @@ -44,7 +45,7 @@ const struct cmd_entry cmd_resize_pane_entry = { .exec = cmd_resize_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -123,7 +124,7 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -void +static void cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m) { struct winlink *wl; @@ -154,12 +155,14 @@ cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m) continue; if (wp->xoff + wp->sx == m->lx && - wp->yoff <= 1 + ly && wp->yoff + wp->sy >= ly) { + wp->yoff <= 1 + ly && + wp->yoff + wp->sy >= ly) { layout_resize_pane(wp, LAYOUT_LEFTRIGHT, m->x - m->lx, 0); found = 1; } if (wp->yoff + wp->sy == ly && - wp->xoff <= 1 + m->lx && wp->xoff + wp->sx >= m->lx) { + wp->xoff <= 1 + m->lx && + wp->xoff + wp->sx >= m->lx) { layout_resize_pane(wp, LAYOUT_TOPBOTTOM, y - ly, 0); found = 1; } diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c index ba2c1cd2..3a7c8090 100644 --- a/cmd-respawn-pane.c +++ b/cmd-respawn-pane.c @@ -28,7 +28,7 @@ * Respawn a pane (restart the command). Kill existing if -k given. */ -enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_respawn_pane_entry = { .name = "respawn-pane", @@ -43,7 +43,7 @@ const struct cmd_entry cmd_respawn_pane_entry = { .exec = cmd_respawn_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c index 95fc0cb4..42f7db19 100644 --- a/cmd-respawn-window.c +++ b/cmd-respawn-window.c @@ -27,7 +27,7 @@ * Respawn a window (restart the command). Kill existing if -k given. */ -enum cmd_retval cmd_respawn_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_respawn_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_respawn_window_entry = { .name = "respawn-window", @@ -42,7 +42,7 @@ const struct cmd_entry cmd_respawn_window_entry = { .exec = cmd_respawn_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c index 94eca37d..bda810c3 100644 --- a/cmd-rotate-window.c +++ b/cmd-rotate-window.c @@ -24,7 +24,7 @@ * Rotate the panes in a window. */ -enum cmd_retval cmd_rotate_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_rotate_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rotate_window_entry = { .name = "rotate-window", @@ -39,7 +39,7 @@ const struct cmd_entry cmd_rotate_window_entry = { .exec = cmd_rotate_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct winlink *wl = cmdq->state.tflag.wl; diff --git a/cmd-run-shell.c b/cmd-run-shell.c index d87a061f..55c98ad3 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -29,11 +29,11 @@ * Runs a command without a window. */ -enum cmd_retval cmd_run_shell_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_run_shell_exec(struct cmd *, struct cmd_q *); -void cmd_run_shell_callback(struct job *); -void cmd_run_shell_free(void *); -void cmd_run_shell_print(struct job *, const char *); +static void cmd_run_shell_callback(struct job *); +static void cmd_run_shell_free(void *); +static void cmd_run_shell_print(struct job *, const char *); const struct cmd_entry cmd_run_shell_entry = { .name = "run-shell", @@ -55,7 +55,7 @@ struct cmd_run_shell_data { int wp_id; }; -void +static void cmd_run_shell_print(struct job *job, const char *msg) { struct cmd_run_shell_data *cdata = job->data; @@ -74,7 +74,7 @@ cmd_run_shell_print(struct job *job, const char *msg) window_copy_add(wp, "%s", msg); } -enum cmd_retval +static enum cmd_retval cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -113,7 +113,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_WAIT); } -void +static void cmd_run_shell_callback(struct job *job) { struct cmd_run_shell_data *cdata = job->data; @@ -161,7 +161,7 @@ cmd_run_shell_callback(struct job *job) free(msg); } -void +static void cmd_run_shell_free(void *data) { struct cmd_run_shell_data *cdata = data; diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c index 3aaf8159..f52061f7 100644 --- a/cmd-save-buffer.c +++ b/cmd-save-buffer.c @@ -32,7 +32,7 @@ * Saves a paste buffer to a file. */ -enum cmd_retval cmd_save_buffer_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_save_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_save_buffer_entry = { .name = "save-buffer", @@ -56,7 +56,7 @@ const struct cmd_entry cmd_show_buffer_entry = { .exec = cmd_save_buffer_exec }; -enum cmd_retval +static enum cmd_retval cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-select-layout.c b/cmd-select-layout.c index 44f01bb7..48d2ac30 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -26,7 +26,7 @@ * Switch window to selected layout. */ -enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_layout_entry = { .name = "select-layout", @@ -67,7 +67,7 @@ const struct cmd_entry cmd_previous_layout_entry = { .exec = cmd_select_layout_exec }; -enum cmd_retval +static enum cmd_retval cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-select-pane.c b/cmd-select-pane.c index 14d53d48..956d42a8 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -24,7 +24,7 @@ * Select pane. */ -enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_pane_entry = { .name = "select-pane", @@ -52,7 +52,7 @@ const struct cmd_entry cmd_last_pane_entry = { .exec = cmd_select_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-select-window.c b/cmd-select-window.c index 78228067..a1413ae0 100644 --- a/cmd-select-window.c +++ b/cmd-select-window.c @@ -26,7 +26,7 @@ * Select window by index. */ -enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_window_entry = { .name = "select-window", @@ -80,7 +80,7 @@ const struct cmd_entry cmd_last_window_entry = { .exec = cmd_select_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct winlink *wl = cmdq->state.tflag.wl; diff --git a/cmd-send-keys.c b/cmd-send-keys.c index 92c75ec3..9d6b41d8 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -27,7 +27,7 @@ * Send keys to client. */ -enum cmd_retval cmd_send_keys_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_send_keys_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_send_keys_entry = { .name = "send-keys", @@ -55,7 +55,7 @@ const struct cmd_entry cmd_send_prefix_entry = { .exec = cmd_send_keys_exec }; -enum cmd_retval +static enum cmd_retval cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index 1f0cf3d8..41ea73d9 100644 --- a/cmd-set-buffer.c +++ b/cmd-set-buffer.c @@ -27,7 +27,7 @@ * Add, set, append to or delete a paste buffer. */ -enum cmd_retval cmd_set_buffer_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_set_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_set_buffer_entry = { .name = "set-buffer", @@ -51,7 +51,7 @@ const struct cmd_entry cmd_delete_buffer_entry = { .exec = cmd_set_buffer_exec }; -enum cmd_retval +static enum cmd_retval cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-set-environment.c b/cmd-set-environment.c index ba295ea6..bfb39a4a 100644 --- a/cmd-set-environment.c +++ b/cmd-set-environment.c @@ -27,7 +27,7 @@ * Set an environment variable. */ -enum cmd_retval cmd_set_environment_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_set_environment_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_set_environment_entry = { .name = "set-environment", @@ -42,7 +42,7 @@ const struct cmd_entry cmd_set_environment_entry = { .exec = cmd_set_environment_exec }; -enum cmd_retval +static enum cmd_retval cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-set-hook.c b/cmd-set-hook.c index 4d7cf908..2e8bcb0f 100644 --- a/cmd-set-hook.c +++ b/cmd-set-hook.c @@ -27,7 +27,7 @@ * Set or show global or session hooks. */ -enum cmd_retval cmd_set_hook_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_set_hook_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_set_hook_entry = { .name = "set-hook", @@ -55,7 +55,7 @@ const struct cmd_entry cmd_show_hooks_entry = { .exec = cmd_set_hook_exec }; -enum cmd_retval +static enum cmd_retval cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-set-option.c b/cmd-set-option.c index 0f116b6f..8f7e469c 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -27,40 +27,40 @@ * Set an option. */ -enum cmd_retval cmd_set_option_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_set_option_exec(struct cmd *, struct cmd_q *); -enum cmd_retval cmd_set_option_user(struct cmd *, struct cmd_q *, +static enum cmd_retval cmd_set_option_user(struct cmd *, struct cmd_q *, const char *, const char *); -int cmd_set_option_unset(struct cmd *, struct cmd_q *, - const struct options_table_entry *, struct options *, - const char *); -int cmd_set_option_set(struct cmd *, struct cmd_q *, - const struct options_table_entry *, struct options *, - const char *); +static int cmd_set_option_unset(struct cmd *, struct cmd_q *, + const struct options_table_entry *, struct options *, + const char *); +static int cmd_set_option_set(struct cmd *, struct cmd_q *, + const struct options_table_entry *, struct options *, + const char *); -struct options_entry *cmd_set_option_string(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_string(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); -struct options_entry *cmd_set_option_number(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_number(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); -struct options_entry *cmd_set_option_key(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_key(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); -struct options_entry *cmd_set_option_colour(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_colour(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); -struct options_entry *cmd_set_option_attributes(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_attributes(struct cmd *, + struct cmd_q *, const struct options_table_entry *, + struct options *, const char *); +static struct options_entry *cmd_set_option_flag(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); -struct options_entry *cmd_set_option_flag(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_choice(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); -struct options_entry *cmd_set_option_choice(struct cmd *, struct cmd_q *, - const struct options_table_entry *, struct options *, - const char *); -struct options_entry *cmd_set_option_style(struct cmd *, struct cmd_q *, +static struct options_entry *cmd_set_option_style(struct cmd *, struct cmd_q *, const struct options_table_entry *, struct options *, const char *); @@ -90,7 +90,7 @@ const struct cmd_entry cmd_set_window_option_entry = { .exec = cmd_set_option_exec }; -enum cmd_retval +static enum cmd_retval cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -223,7 +223,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) } /* Set user option. */ -enum cmd_retval +static enum cmd_retval cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr, const char *valstr) { @@ -301,7 +301,7 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr, } /* Unset an option. */ -int +static int cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -331,7 +331,7 @@ cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq, } /* Set an option. */ -int +static int cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -386,7 +386,7 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq, } /* Set a string option. */ -struct options_entry * +static struct options_entry * cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -408,7 +408,7 @@ cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq, } /* Set a number option. */ -struct options_entry * +static struct options_entry * cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -426,7 +426,7 @@ cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq, } /* Set a key option. */ -struct options_entry * +static struct options_entry * cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -443,7 +443,7 @@ cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq, } /* Set a colour option. */ -struct options_entry * +static struct options_entry * cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -459,7 +459,7 @@ cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq, } /* Set an attributes option. */ -struct options_entry * +static struct options_entry * cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -475,7 +475,7 @@ cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq, } /* Set a flag option. */ -struct options_entry * +static struct options_entry * cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -503,7 +503,7 @@ cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq, } /* Set a choice option. */ -struct options_entry * +static struct options_entry * cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) @@ -538,7 +538,7 @@ cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq, } /* Set a style option. */ -struct options_entry * +static struct options_entry * cmd_set_option_style(struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) diff --git a/cmd-show-environment.c b/cmd-show-environment.c index 29e89274..5ad0bb8a 100644 --- a/cmd-show-environment.c +++ b/cmd-show-environment.c @@ -27,11 +27,11 @@ * Show environment. */ -enum cmd_retval cmd_show_environment_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_show_environment_exec(struct cmd *, struct cmd_q *); -char *cmd_show_environment_escape(struct environ_entry *); -void cmd_show_environment_print(struct cmd *, struct cmd_q *, - struct environ_entry *); +static char *cmd_show_environment_escape(struct environ_entry *); +static void cmd_show_environment_print(struct cmd *, struct cmd_q *, + struct environ_entry *); const struct cmd_entry cmd_show_environment_entry = { .name = "show-environment", @@ -46,7 +46,7 @@ const struct cmd_entry cmd_show_environment_entry = { .exec = cmd_show_environment_exec }; -char * +static char * cmd_show_environment_escape(struct environ_entry *envent) { const char *value = envent->value; @@ -64,7 +64,7 @@ cmd_show_environment_escape(struct environ_entry *envent) return (ret); } -void +static void cmd_show_environment_print(struct cmd *self, struct cmd_q *cmdq, struct environ_entry *envent) { @@ -87,7 +87,7 @@ cmd_show_environment_print(struct cmd *self, struct cmd_q *cmdq, cmdq_print(cmdq, "unset %s;", envent->name); } -enum cmd_retval +static enum cmd_retval cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-show-messages.c b/cmd-show-messages.c index 3131184d..0f607aa2 100644 --- a/cmd-show-messages.c +++ b/cmd-show-messages.c @@ -29,7 +29,7 @@ * Show client message log. */ -enum cmd_retval cmd_show_messages_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_show_messages_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_show_messages_entry = { .name = "show-messages", @@ -55,10 +55,10 @@ const struct cmd_entry cmd_server_info_entry = { .exec = cmd_show_messages_exec }; -int cmd_show_messages_terminals(struct cmd_q *, int); -int cmd_show_messages_jobs(struct cmd_q *, int); +static int cmd_show_messages_terminals(struct cmd_q *, int); +static int cmd_show_messages_jobs(struct cmd_q *, int); -int +static int cmd_show_messages_terminals(struct cmd_q *cmdq, int blank) { struct tty_term *term; @@ -79,7 +79,7 @@ cmd_show_messages_terminals(struct cmd_q *cmdq, int blank) return (n != 0); } -int +static int cmd_show_messages_jobs(struct cmd_q *cmdq, int blank) { struct job *job; @@ -98,7 +98,7 @@ cmd_show_messages_jobs(struct cmd_q *cmdq, int blank) return (n != 0); } -enum cmd_retval +static enum cmd_retval cmd_show_messages_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-show-options.c b/cmd-show-options.c index 322f532c..89d8f219 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -27,12 +27,12 @@ * Show options. */ -enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmd_q *); -enum cmd_retval cmd_show_options_one(struct cmd *, struct cmd_q *, - struct options *, int); -enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *, - struct options *, enum options_table_scope); +static enum cmd_retval cmd_show_options_one(struct cmd *, struct cmd_q *, + struct options *, int); +static enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *, + struct options *, enum options_table_scope); const struct cmd_entry cmd_show_options_entry = { .name = "show-options", @@ -60,7 +60,7 @@ const struct cmd_entry cmd_show_window_options_entry = { .exec = cmd_show_options_exec }; -enum cmd_retval +static enum cmd_retval cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -110,7 +110,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq) return (cmd_show_options_one(self, cmdq, oo, quiet)); } -enum cmd_retval +static enum cmd_retval cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq, struct options *oo, int quiet) { @@ -160,7 +160,7 @@ retry: return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_show_options_all(struct cmd *self, struct cmd_q *cmdq, struct options *oo, enum options_table_scope scope) { diff --git a/cmd-source-file.c b/cmd-source-file.c index ecebbaca..ef3ac7ac 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -26,9 +26,9 @@ * Sources a configuration file. */ -enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *); -void cmd_source_file_done(struct cmd_q *); +static void cmd_source_file_done(struct cmd_q *); const struct cmd_entry cmd_source_file_entry = { .name = "source-file", @@ -41,7 +41,7 @@ const struct cmd_entry cmd_source_file_entry = { .exec = cmd_source_file_exec }; -enum cmd_retval +static enum cmd_retval cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -76,7 +76,7 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_WAIT); } -void +static void cmd_source_file_done(struct cmd_q *cmdq1) { struct cmd_q *cmdq = cmdq1->data; diff --git a/cmd-split-window.c b/cmd-split-window.c index 8d24c6c5..e3e3d059 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -33,7 +33,7 @@ #define SPLIT_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" -enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_split_window_entry = { .name = "split-window", @@ -49,7 +49,7 @@ const struct cmd_entry cmd_split_window_entry = { .exec = cmd_split_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-string.c b/cmd-string.c index 757d4cdb..2cf63294 100644 --- a/cmd-string.c +++ b/cmd-string.c @@ -31,14 +31,14 @@ * Parse a command from a string. */ -int cmd_string_getc(const char *, size_t *); -void cmd_string_ungetc(size_t *); -void cmd_string_copy(char **, char *, size_t *); -char *cmd_string_string(const char *, size_t *, char, int); -char *cmd_string_variable(const char *, size_t *); -char *cmd_string_expand_tilde(const char *, size_t *); +static int cmd_string_getc(const char *, size_t *); +static void cmd_string_ungetc(size_t *); +static void cmd_string_copy(char **, char *, size_t *); +static char *cmd_string_string(const char *, size_t *, char, int); +static char *cmd_string_variable(const char *, size_t *); +static char *cmd_string_expand_tilde(const char *, size_t *); -int +static int cmd_string_getc(const char *s, size_t *p) { const u_char *ucs = s; @@ -48,7 +48,7 @@ cmd_string_getc(const char *s, size_t *p) return (ucs[(*p)++]); } -void +static void cmd_string_ungetc(size_t *p) { (*p)--; @@ -173,7 +173,7 @@ out: return (rval); } -void +static void cmd_string_copy(char **dst, char *src, size_t *len) { size_t srclen; @@ -187,7 +187,7 @@ cmd_string_copy(char **dst, char *src, size_t *len) free(src); } -char * +static char * cmd_string_string(const char *s, size_t *p, char endch, int esc) { int ch; @@ -245,7 +245,7 @@ error: return (NULL); } -char * +static char * cmd_string_variable(const char *s, size_t *p) { int ch, fch; @@ -314,7 +314,7 @@ error: return (NULL); } -char * +static char * cmd_string_expand_tilde(const char *s, size_t *p) { struct passwd *pw; @@ -337,7 +337,10 @@ cmd_string_expand_tilde(const char *s, size_t *p) cp = user = xmalloc(strlen(s)); for (;;) { last = cmd_string_getc(s, p); - if (last == EOF || last == '/' || last == ' '|| last == '\t') + if (last == EOF || + last == '/' || + last == ' '|| + last == '\t') break; *cp++ = last; } diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index 13575e0a..e5f5c810 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -26,7 +26,7 @@ * Swap two panes. */ -enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_swap_pane_entry = { .name = "swap-pane", @@ -42,7 +42,7 @@ const struct cmd_entry cmd_swap_pane_entry = { .exec = cmd_swap_pane_exec }; -enum cmd_retval +static enum cmd_retval cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct window *src_w, *dst_w; diff --git a/cmd-swap-window.c b/cmd-swap-window.c index 14907d2d..904a974d 100644 --- a/cmd-swap-window.c +++ b/cmd-swap-window.c @@ -26,7 +26,7 @@ * Swap one window with another. */ -enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_swap_window_entry = { .name = "swap-window", @@ -42,7 +42,7 @@ const struct cmd_entry cmd_swap_window_entry = { .exec = cmd_swap_window_exec }; -enum cmd_retval +static enum cmd_retval cmd_swap_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct session *src, *dst; diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 6e2ee2a0..cc3212db 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -27,7 +27,7 @@ * Switch client to a different session. */ -enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_switch_client_entry = { .name = "switch-client", @@ -44,7 +44,7 @@ const struct cmd_entry cmd_switch_client_entry = { .exec = cmd_switch_client_exec }; -enum cmd_retval +static enum cmd_retval cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c index 7452fd9f..00c7779b 100644 --- a/cmd-unbind-key.c +++ b/cmd-unbind-key.c @@ -26,9 +26,9 @@ * Unbind key from command. */ -enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *); -enum cmd_retval cmd_unbind_key_mode_table(struct cmd *, struct cmd_q *, - key_code); +static enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_unbind_key_mode_table(struct cmd *, struct cmd_q *, + key_code); const struct cmd_entry cmd_unbind_key_entry = { .name = "unbind-key", @@ -41,7 +41,7 @@ const struct cmd_entry cmd_unbind_key_entry = { .exec = cmd_unbind_key_exec }; -enum cmd_retval +static enum cmd_retval cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -98,7 +98,7 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_unbind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key) { struct args *args = self->args; diff --git a/cmd-wait-for.c b/cmd-wait-for.c index 81b01627..fb2fb699 100644 --- a/cmd-wait-for.c +++ b/cmd-wait-for.c @@ -28,7 +28,7 @@ * Block or wake a client on a named wait channel. */ -enum cmd_retval cmd_wait_for_exec(struct cmd *, struct cmd_q *); +static enum cmd_retval cmd_wait_for_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_wait_for_entry = { .name = "wait-for", @@ -52,31 +52,30 @@ struct wait_channel { RB_ENTRY(wait_channel) entry; }; RB_HEAD(wait_channels, wait_channel); -struct wait_channels wait_channels = RB_INITIALIZER(wait_channels); +static struct wait_channels wait_channels = RB_INITIALIZER(wait_channels); -int wait_channel_cmp(struct wait_channel *, struct wait_channel *); -RB_PROTOTYPE(wait_channels, wait_channel, entry, wait_channel_cmp); -RB_GENERATE(wait_channels, wait_channel, entry, wait_channel_cmp); +static int wait_channel_cmp(struct wait_channel *, struct wait_channel *); +RB_GENERATE_STATIC(wait_channels, wait_channel, entry, wait_channel_cmp); -int +static int wait_channel_cmp(struct wait_channel *wc1, struct wait_channel *wc2) { return (strcmp(wc1->name, wc2->name)); } -enum cmd_retval cmd_wait_for_signal(struct cmd_q *, const char *, - struct wait_channel *); -enum cmd_retval cmd_wait_for_wait(struct cmd_q *, const char *, - struct wait_channel *); -enum cmd_retval cmd_wait_for_lock(struct cmd_q *, const char *, - struct wait_channel *); -enum cmd_retval cmd_wait_for_unlock(struct cmd_q *, const char *, - struct wait_channel *); +static enum cmd_retval cmd_wait_for_signal(struct cmd_q *, const char *, + struct wait_channel *); +static enum cmd_retval cmd_wait_for_wait(struct cmd_q *, const char *, + struct wait_channel *); +static enum cmd_retval cmd_wait_for_lock(struct cmd_q *, const char *, + struct wait_channel *); +static enum cmd_retval cmd_wait_for_unlock(struct cmd_q *, const char *, + struct wait_channel *); -struct wait_channel *cmd_wait_for_add(const char *); -void cmd_wait_for_remove(struct wait_channel *wc); +static struct wait_channel *cmd_wait_for_add(const char *); +static void cmd_wait_for_remove(struct wait_channel *wc); -struct wait_channel * +static struct wait_channel * cmd_wait_for_add(const char *name) { struct wait_channel *wc; @@ -97,7 +96,7 @@ cmd_wait_for_add(const char *name) return (wc); } -void +static void cmd_wait_for_remove(struct wait_channel *wc) { if (wc->locked) @@ -113,7 +112,7 @@ cmd_wait_for_remove(struct wait_channel *wc) free(wc); } -enum cmd_retval +static enum cmd_retval cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; @@ -132,7 +131,7 @@ cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq) return (cmd_wait_for_wait(cmdq, name, wc)); } -enum cmd_retval +static enum cmd_retval cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name, struct wait_channel *wc) { @@ -158,7 +157,7 @@ cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name, return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_wait_for_wait(struct cmd_q *cmdq, const char *name, struct wait_channel *wc) { @@ -185,7 +184,7 @@ cmd_wait_for_wait(struct cmd_q *cmdq, const char *name, return (CMD_RETURN_WAIT); } -enum cmd_retval +static enum cmd_retval cmd_wait_for_lock(struct cmd_q *cmdq, const char *name, struct wait_channel *wc) { @@ -207,7 +206,7 @@ cmd_wait_for_lock(struct cmd_q *cmdq, const char *name, return (CMD_RETURN_NORMAL); } -enum cmd_retval +static enum cmd_retval cmd_wait_for_unlock(struct cmd_q *cmdq, const char *name, struct wait_channel *wc) { diff --git a/window-clock.c b/window-clock.c index f6dc85cd..a9bbb75a 100644 --- a/window-clock.c +++ b/window-clock.c @@ -24,14 +24,14 @@ #include "tmux.h" -struct screen *window_clock_init(struct window_pane *); -void window_clock_free(struct window_pane *); -void window_clock_resize(struct window_pane *, u_int, u_int); -void window_clock_key(struct window_pane *, struct client *, - struct session *, key_code, struct mouse_event *); +static struct screen *window_clock_init(struct window_pane *); +static void window_clock_free(struct window_pane *); +static void window_clock_resize(struct window_pane *, u_int, u_int); +static void window_clock_key(struct window_pane *, struct client *, + struct session *, key_code, struct mouse_event *); -void window_clock_timer_callback(int, short, void *); -void window_clock_draw_screen(struct window_pane *); +static void window_clock_timer_callback(int, short, void *); +static void window_clock_draw_screen(struct window_pane *); const struct window_mode window_clock_mode = { window_clock_init, @@ -119,7 +119,7 @@ const char window_clock_table[14][5][5] = { { 1,0,0,0,1 } }, }; -void +static void window_clock_timer_callback(__unused int fd, __unused short events, void *arg) { struct window_pane *wp = arg; @@ -142,7 +142,7 @@ window_clock_timer_callback(__unused int fd, __unused short events, void *arg) server_redraw_window(wp->window); } -struct screen * +static struct screen * window_clock_init(struct window_pane *wp) { struct window_clock_mode_data *data; @@ -164,7 +164,7 @@ window_clock_init(struct window_pane *wp) return (s); } -void +static void window_clock_free(struct window_pane *wp) { struct window_clock_mode_data *data = wp->modedata; @@ -174,7 +174,7 @@ window_clock_free(struct window_pane *wp) free(data); } -void +static void window_clock_resize(struct window_pane *wp, u_int sx, u_int sy) { struct window_clock_mode_data *data = wp->modedata; @@ -184,7 +184,7 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy) window_clock_draw_screen(wp); } -void +static void window_clock_key(struct window_pane *wp, __unused struct client *c, __unused struct session *sess, __unused key_code key, __unused struct mouse_event *m) @@ -192,7 +192,7 @@ window_clock_key(struct window_pane *wp, __unused struct client *c, window_pane_reset_mode(wp); } -void +static void window_clock_draw_screen(struct window_pane *wp) { struct window_clock_mode_data *data = wp->modedata;