[BACK]Return to cmd-find.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-find.c between version 1.32 and 1.33

version 1.32, 2016/03/03 14:14:46 version 1.33, 2016/10/10 21:51:39
Line 27 
Line 27 
   
 #include "tmux.h"  #include "tmux.h"
   
 struct session  *cmd_find_try_TMUX(struct client *, struct window *);  static struct session *cmd_find_try_TMUX(struct client *, struct window *);
 int              cmd_find_client_better(struct client *, struct client *);  static int      cmd_find_client_better(struct client *, struct client *);
 struct client   *cmd_find_best_client(struct client **, u_int);  static struct client *cmd_find_best_client(struct client **, u_int);
 int              cmd_find_session_better(struct session *, struct session *,  static int      cmd_find_session_better(struct session *, struct session *,
                      int);                      int);
 struct session  *cmd_find_best_session(struct session **, u_int, int);  static struct session *cmd_find_best_session(struct session **, u_int, int);
 int              cmd_find_best_session_with_window(struct cmd_find_state *);  static int      cmd_find_best_session_with_window(struct cmd_find_state *);
 int              cmd_find_best_winlink_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 *);  static int      cmd_find_current_session_with_client(struct cmd_find_state *);
 int              cmd_find_current_session(struct cmd_find_state *);  static int      cmd_find_current_session(struct cmd_find_state *);
 struct client   *cmd_find_current_client(struct cmd_q *);  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 *);  static int      cmd_find_get_session(struct cmd_find_state *, const char *);
 int     cmd_find_get_window(struct cmd_find_state *, const char *);  static int      cmd_find_get_window(struct cmd_find_state *, const char *);
 int     cmd_find_get_window_with_session(struct cmd_find_state *, const char *);  static int      cmd_find_get_window_with_session(struct cmd_find_state *,
 int     cmd_find_get_window_with_pane(struct cmd_find_state *);                      const char *);
 int     cmd_find_get_pane(struct cmd_find_state *, const char *);  static int      cmd_find_get_pane(struct cmd_find_state *, const char *);
 int     cmd_find_get_pane_with_session(struct cmd_find_state *, const char *);  static int      cmd_find_get_pane_with_session(struct cmd_find_state *,
 int     cmd_find_get_pane_with_window(struct cmd_find_state *, const char *);                      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 }          { NULL, NULL }
 };  };
 const char *cmd_find_window_table[][2] = {  static const char *cmd_find_window_table[][2] = {
         { "{start}", "^" },          { "{start}", "^" },
         { "{last}", "!" },          { "{last}", "!" },
         { "{end}", "$" },          { "{end}", "$" },
Line 61 
Line 63 
         { "{previous}", "-" },          { "{previous}", "-" },
         { NULL, NULL }          { NULL, NULL }
 };  };
 const char *cmd_find_pane_table[][2] = {  static const char *cmd_find_pane_table[][2] = {
         { "{last}", "!" },          { "{last}", "!" },
         { "{next}", "+" },          { "{next}", "+" },
         { "{previous}", "-" },          { "{previous}", "-" },
Line 81 
Line 83 
 };  };
   
 /* Get session from TMUX if present. */  /* Get session from TMUX if present. */
 struct session *  static struct session *
 cmd_find_try_TMUX(struct client *c, struct window *w)  cmd_find_try_TMUX(struct client *c, struct window *w)
 {  {
         struct environ_entry    *envent;          struct environ_entry    *envent;
Line 108 
Line 110 
 }  }
   
 /* Is this client better? */  /* Is this client better? */
 int  static int
 cmd_find_client_better(struct client *c, struct client *than)  cmd_find_client_better(struct client *c, struct client *than)
 {  {
         if (than == NULL)          if (than == NULL)
Line 117 
Line 119 
 }  }
   
 /* Find best client from a list, or all if list is NULL. */  /* 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)  cmd_find_best_client(struct client **clist, u_int csize)
 {  {
         struct client   *c_loop, *c;          struct client   *c_loop, *c;
Line 143 
Line 145 
 }  }
   
 /* Is this session better? */  /* Is this session better? */
 int  static int
 cmd_find_session_better(struct session *s, struct session *than, int flags)  cmd_find_session_better(struct session *s, struct session *than, int flags)
 {  {
         int     attached;          int     attached;
Line 161 
Line 163 
 }  }
   
 /* Find best session from a list, or all if list is NULL. */  /* 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)  cmd_find_best_session(struct session **slist, u_int ssize, int flags)
 {  {
         struct session   *s_loop, *s;          struct session   *s_loop, *s;
Line 183 
Line 185 
 }  }
   
 /* Find best session and winlink for window. */  /* Find best session and winlink for window. */
 int  static int
 cmd_find_best_session_with_window(struct cmd_find_state *fs)  cmd_find_best_session_with_window(struct cmd_find_state *fs)
 {  {
         struct session  **slist = NULL;          struct session  **slist = NULL;
Line 220 
Line 222 
  * Find the best winlink for a window (the current if it contains the pane,   * Find the best winlink for a window (the current if it contains the pane,
  * otherwise the first).   * otherwise the first).
  */   */
 int  static int
 cmd_find_best_winlink_with_window(struct cmd_find_state *fs)  cmd_find_best_winlink_with_window(struct cmd_find_state *fs)
 {  {
         struct winlink   *wl, *wl_loop;          struct winlink   *wl, *wl_loop;
Line 244 
Line 246 
 }  }
   
 /* Find current session when we have an unattached client. */  /* Find current session when we have an unattached client. */
 int  static int
 cmd_find_current_session_with_client(struct cmd_find_state *fs)  cmd_find_current_session_with_client(struct cmd_find_state *fs)
 {  {
         struct window_pane      *wp;          struct window_pane      *wp;
Line 308 
Line 310 
  * Work out the best current state. If this function succeeds, the state is   * Work out the best current state. If this function succeeds, the state is
  * guaranteed to be completely filled in.   * guaranteed to be completely filled in.
  */   */
 int  static int
 cmd_find_current_session(struct cmd_find_state *fs)  cmd_find_current_session(struct cmd_find_state *fs)
 {  {
         /* If we know the current client, use it. */          /* If we know the current client, use it. */
Line 338 
Line 340 
 }  }
   
 /* Work out the best current client. */  /* Work out the best current client. */
 struct client *  static struct client *
 cmd_find_current_client(struct cmd_q *cmdq)  cmd_find_current_client(struct cmd_q *cmdq)
 {  {
         struct cmd_find_state    current;          struct cmd_find_state    current;
Line 384 
Line 386 
 }  }
   
 /* Maps string in table. */  /* Maps string in table. */
 const char *  static const char *
 cmd_find_map_table(const char *table[][2], const char *s)  cmd_find_map_table(const char *table[][2], const char *s)
 {  {
         u_int   i;          u_int   i;
Line 397 
Line 399 
 }  }
   
 /* Find session from string. Fills in s. */  /* Find session from string. Fills in s. */
 int  static int
 cmd_find_get_session(struct cmd_find_state *fs, const char *session)  cmd_find_get_session(struct cmd_find_state *fs, const char *session)
 {  {
         struct session  *s, *s_loop;          struct session  *s, *s_loop;
Line 461 
Line 463 
 }  }
   
 /* Find window from string. Fills in s, wl, w. */  /* Find window from string. Fills in s, wl, w. */
 int  static int
 cmd_find_get_window(struct cmd_find_state *fs, const char *window)  cmd_find_get_window(struct cmd_find_state *fs, const char *window)
 {  {
         log_debug("%s: %s", __func__, window);          log_debug("%s: %s", __func__, window);
Line 497 
Line 499 
  * Find window from string, assuming it is in given session. Needs s, fills in   * Find window from string, assuming it is in given session. Needs s, fills in
  * wl and w.   * wl and w.
  */   */
 int  static int
 cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)  cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)
 {  {
         struct winlink  *wl;          struct winlink  *wl;
Line 647 
Line 649 
         return (-1);          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. */  /* 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)  cmd_find_get_pane(struct cmd_find_state *fs, const char *pane)
 {  {
         log_debug("%s: %s", __func__, pane);          log_debug("%s: %s", __func__, pane);
Line 695 
Line 687 
  * Find pane from string, assuming it is in given session. Needs s, fills in wl   * Find pane from string, assuming it is in given session. Needs s, fills in wl
  * and w and wp.   * and w and wp.
  */   */
 int  static int
 cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane)  cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane)
 {  {
         log_debug("%s: %s", __func__, pane);          log_debug("%s: %s", __func__, pane);
Line 722 
Line 714 
  * Find pane from string, assuming it is in the given window. Needs w, fills in   * Find pane from string, assuming it is in the given window. Needs w, fills in
  * wp.   * wp.
  */   */
 int  static int
 cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)  cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
 {  {
         const char              *errstr;          const char              *errstr;

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33