=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-find.c,v retrieving revision 1.32 retrieving revision 1.33 diff -c -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 **** ! /* $OpenBSD: cmd-find.c,v 1.32 2016/03/03 14:14:46 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-find.c,v 1.33 2016/10/10 21:51:39 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott *************** *** 27,59 **** #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 *); ! 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 *); ! 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 *); ! const char *cmd_find_session_table[][2] = { { NULL, NULL } }; ! const char *cmd_find_window_table[][2] = { { "{start}", "^" }, { "{last}", "!" }, { "{end}", "$" }, --- 27,61 ---- #include "tmux.h" ! 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 *); ! 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 *); ! static const char *cmd_find_map_table(const char *[][2], 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 *); ! static const char *cmd_find_session_table[][2] = { { NULL, NULL } }; ! static const char *cmd_find_window_table[][2] = { { "{start}", "^" }, { "{last}", "!" }, { "{end}", "$" }, *************** *** 61,67 **** { "{previous}", "-" }, { NULL, NULL } }; ! const char *cmd_find_pane_table[][2] = { { "{last}", "!" }, { "{next}", "+" }, { "{previous}", "-" }, --- 63,69 ---- { "{previous}", "-" }, { NULL, NULL } }; ! static const char *cmd_find_pane_table[][2] = { { "{last}", "!" }, { "{next}", "+" }, { "{previous}", "-" }, *************** *** 81,87 **** }; /* Get session from TMUX if present. */ ! struct session * cmd_find_try_TMUX(struct client *c, struct window *w) { struct environ_entry *envent; --- 83,89 ---- }; /* Get session from TMUX if present. */ ! static struct session * cmd_find_try_TMUX(struct client *c, struct window *w) { struct environ_entry *envent; *************** *** 108,114 **** } /* Is this client better? */ ! int cmd_find_client_better(struct client *c, struct client *than) { if (than == NULL) --- 110,116 ---- } /* Is this client better? */ ! static int cmd_find_client_better(struct client *c, struct client *than) { if (than == NULL) *************** *** 117,123 **** } /* Find best client from a list, or all if list is NULL. */ ! struct client * cmd_find_best_client(struct client **clist, u_int csize) { struct client *c_loop, *c; --- 119,125 ---- } /* Find best client from a list, or all if list is NULL. */ ! static struct client * cmd_find_best_client(struct client **clist, u_int csize) { struct client *c_loop, *c; *************** *** 143,149 **** } /* Is this session better? */ ! int cmd_find_session_better(struct session *s, struct session *than, int flags) { int attached; --- 145,151 ---- } /* Is this session better? */ ! static int cmd_find_session_better(struct session *s, struct session *than, int flags) { int attached; *************** *** 161,167 **** } /* Find best session from a list, or all if list is NULL. */ ! struct session * cmd_find_best_session(struct session **slist, u_int ssize, int flags) { struct session *s_loop, *s; --- 163,169 ---- } /* Find best session from a list, or all if list is NULL. */ ! static struct session * cmd_find_best_session(struct session **slist, u_int ssize, int flags) { struct session *s_loop, *s; *************** *** 183,189 **** } /* Find best session and winlink for window. */ ! int cmd_find_best_session_with_window(struct cmd_find_state *fs) { struct session **slist = NULL; --- 185,191 ---- } /* Find best session and winlink for window. */ ! static int cmd_find_best_session_with_window(struct cmd_find_state *fs) { struct session **slist = NULL; *************** *** 220,226 **** * Find the best winlink for a window (the current if it contains the pane, * otherwise the first). */ ! int cmd_find_best_winlink_with_window(struct cmd_find_state *fs) { struct winlink *wl, *wl_loop; --- 222,228 ---- * Find the best winlink for a window (the current if it contains the pane, * otherwise the first). */ ! static int cmd_find_best_winlink_with_window(struct cmd_find_state *fs) { struct winlink *wl, *wl_loop; *************** *** 244,250 **** } /* Find current session when we have an unattached client. */ ! int cmd_find_current_session_with_client(struct cmd_find_state *fs) { struct window_pane *wp; --- 246,252 ---- } /* Find current session when we have an unattached client. */ ! static int cmd_find_current_session_with_client(struct cmd_find_state *fs) { struct window_pane *wp; *************** *** 308,314 **** * Work out the best current state. If this function succeeds, the state is * guaranteed to be completely filled in. */ ! int cmd_find_current_session(struct cmd_find_state *fs) { /* If we know the current client, use it. */ --- 310,316 ---- * Work out the best current state. If this function succeeds, the state is * guaranteed to be completely filled in. */ ! static int cmd_find_current_session(struct cmd_find_state *fs) { /* If we know the current client, use it. */ *************** *** 338,344 **** } /* Work out the best current client. */ ! struct client * cmd_find_current_client(struct cmd_q *cmdq) { struct cmd_find_state current; --- 340,346 ---- } /* Work out the best current client. */ ! static struct client * cmd_find_current_client(struct cmd_q *cmdq) { struct cmd_find_state current; *************** *** 384,390 **** } /* Maps string in table. */ ! const char * cmd_find_map_table(const char *table[][2], const char *s) { u_int i; --- 386,392 ---- } /* Maps string in table. */ ! static const char * cmd_find_map_table(const char *table[][2], const char *s) { u_int i; *************** *** 397,403 **** } /* Find session from string. Fills in s. */ ! int cmd_find_get_session(struct cmd_find_state *fs, const char *session) { struct session *s, *s_loop; --- 399,405 ---- } /* Find session from string. Fills in s. */ ! static int cmd_find_get_session(struct cmd_find_state *fs, const char *session) { struct session *s, *s_loop; *************** *** 461,467 **** } /* Find window from string. Fills in s, wl, w. */ ! int cmd_find_get_window(struct cmd_find_state *fs, const char *window) { log_debug("%s: %s", __func__, window); --- 463,469 ---- } /* Find window from string. Fills in s, wl, w. */ ! static int cmd_find_get_window(struct cmd_find_state *fs, const char *window) { log_debug("%s: %s", __func__, window); *************** *** 497,503 **** * Find window from string, assuming it is in given session. Needs s, fills in * wl and w. */ ! int cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) { struct winlink *wl; --- 499,505 ---- * Find window from string, assuming it is in given session. Needs s, fills in * wl and w. */ ! static int cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) { struct winlink *wl; *************** *** 647,664 **** 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 cmd_find_get_pane(struct cmd_find_state *fs, const char *pane) { log_debug("%s: %s", __func__, pane); --- 649,656 ---- return (-1); } /* Find pane from string. Fills in s, wl, w, wp. */ ! static int cmd_find_get_pane(struct cmd_find_state *fs, const char *pane) { log_debug("%s: %s", __func__, pane); *************** *** 695,701 **** * Find pane from string, assuming it is in given session. Needs s, fills in wl * and w and wp. */ ! int cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane) { log_debug("%s: %s", __func__, pane); --- 687,693 ---- * Find pane from string, assuming it is in given session. Needs s, fills in wl * and w and wp. */ ! static int cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane) { log_debug("%s: %s", __func__, pane); *************** *** 722,728 **** * Find pane from string, assuming it is in the given window. Needs w, fills in * wp. */ ! int cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane) { const char *errstr; --- 714,720 ---- * Find pane from string, assuming it is in the given window. Needs w, fills in * wp. */ ! static int cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane) { const char *errstr;