=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-find.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- src/usr.bin/tmux/cmd-find.c 2016/03/03 14:14:46 1.32 +++ src/usr.bin/tmux/cmd-find.c 2016/10/10 21:51:39 1.33 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-find.c,v 1.32 2016/03/03 14:14:46 nicm Exp $ */ +/* $OpenBSD: cmd-find.c,v 1.33 2016/10/10 21:51:39 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -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 @@ { "{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 @@ }; /* 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 @@ } /* Is this client better? */ -int +static int cmd_find_client_better(struct client *c, struct client *than) { if (than == NULL) @@ -117,7 +119,7 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ * 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 @@ } /* 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 @@ * 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ } /* 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 @@ * 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 @@ 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 @@ * 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 @@ * 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;