mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Add static in cmd-* and fix a few other nits.
This commit is contained in:
90
cmd-find.c
90
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;
|
||||
|
Reference in New Issue
Block a user