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

Diff for /src/usr.bin/tmux/cmd-find-window.c between version 1.7 and 1.8

version 1.7, 2010/12/20 00:03:55 version 1.8, 2011/01/04 00:42:46
Line 34 
Line 34 
   
 const struct cmd_entry cmd_find_window_entry = {  const struct cmd_entry cmd_find_window_entry = {
         "find-window", "findw",          "find-window", "findw",
           "t:", 1, 1,
         CMD_TARGET_WINDOW_USAGE " match-string",          CMD_TARGET_WINDOW_USAGE " match-string",
         CMD_ARG1, "",          0,
         cmd_target_init,          NULL,
         cmd_target_parse,          NULL,
         cmd_find_window_exec,          cmd_find_window_exec
         cmd_target_free,  
         cmd_target_print  
 };  };
   
 struct cmd_find_window_data {  struct cmd_find_window_data {
Line 50 
Line 49 
 int  int
 cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct cmd_target_data          *data = self->data;          struct args                     *args = self->args;
         struct cmd_find_window_data     *cdata;          struct cmd_find_window_data     *cdata;
         struct session                  *s;          struct session                  *s;
         struct winlink                  *wl, *wm;          struct winlink                  *wl, *wm;
Line 58 
Line 57 
         struct window_pane              *wp;          struct window_pane              *wp;
         ARRAY_DECL(, u_int)              list_idx;          ARRAY_DECL(, u_int)              list_idx;
         ARRAY_DECL(, char *)             list_ctx;          ARRAY_DECL(, char *)             list_ctx;
         char                            *sres, *sctx, *searchstr;          char                            *str, *sres, *sctx, *searchstr;
         u_int                            i, line;          u_int                            i, line;
   
         if (ctx->curclient == NULL) {          if (ctx->curclient == NULL) {
Line 67 
Line 66 
         }          }
         s = ctx->curclient->session;          s = ctx->curclient->session;
   
         if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)          if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
                 return (-1);                  return (-1);
   
           str = args->argv[0];
   
         ARRAY_INIT(&list_idx);          ARRAY_INIT(&list_idx);
         ARRAY_INIT(&list_ctx);          ARRAY_INIT(&list_ctx);
   
         xasprintf(&searchstr, "*%s*", data->arg);          xasprintf(&searchstr, "*%s*", str);
         RB_FOREACH(wm, winlinks, &s->windows) {          RB_FOREACH(wm, winlinks, &s->windows) {
                 i = 0;                  i = 0;
                 TAILQ_FOREACH(wp, &wm->window->panes, entry) {                  TAILQ_FOREACH(wp, &wm->window->panes, entry) {
Line 82 
Line 83 
                         if (fnmatch(searchstr, wm->window->name, 0) == 0)                          if (fnmatch(searchstr, wm->window->name, 0) == 0)
                                 sctx = xstrdup("");                                  sctx = xstrdup("");
                         else {                          else {
                                 sres = window_pane_search(wp, data->arg, &line);                                  sres = window_pane_search(wp, str, &line);
                                 if (sres == NULL &&                                  if (sres == NULL &&
                                     fnmatch(searchstr, wp->base.title, 0) != 0)                                      fnmatch(searchstr, wp->base.title, 0) != 0)
                                         continue;                                          continue;
Line 106 
Line 107 
         xfree(searchstr);          xfree(searchstr);
   
         if (ARRAY_LENGTH(&list_idx) == 0) {          if (ARRAY_LENGTH(&list_idx) == 0) {
                 ctx->error(ctx, "no windows matching: %s", data->arg);                  ctx->error(ctx, "no windows matching: %s", str);
                 ARRAY_FREE(&list_idx);                  ARRAY_FREE(&list_idx);
                 ARRAY_FREE(&list_ctx);                  ARRAY_FREE(&list_ctx);
                 return (-1);                  return (-1);

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8