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

Diff for /src/usr.bin/tmux/cmd.c between version 1.110 and 1.111

version 1.110, 2015/12/13 15:32:12 version 1.111, 2015/12/13 16:44:35
Line 433 
Line 433 
         struct cmd_state_flag   *statef = NULL;          struct cmd_state_flag   *statef = NULL;
         const char              *flag;          const char              *flag;
         int                      flags = cmd->entry->flags, everything = 0;          int                      flags = cmd->entry->flags, everything = 0;
         int                      allflags = 0, targetflags;          int                      allflags = 0, targetflags, error;
         struct session          *s;          struct session          *s;
         struct window           *w;          struct window           *w;
         struct winlink          *wl;          struct winlink          *wl;
         struct window_pane      *wp;          struct window_pane      *wp;
         struct cmd_find_state   *fs;          struct cmd_find_state    fs;
   
         /* Set up state for either -t or -s. */          /* Set up state for either -t or -s. */
         if (c == 't') {          if (c == 't') {
Line 480 
Line 480 
         case CMD_SESSION_T|CMD_PANE_T:          case CMD_SESSION_T|CMD_PANE_T:
         case CMD_SESSION_S|CMD_PANE_S:          case CMD_SESSION_S|CMD_PANE_S:
                 if (flag != NULL && flag[strcspn(flag, ":.")] != '\0') {                  if (flag != NULL && flag[strcspn(flag, ":.")] != '\0') {
                         fs = cmd_find_target(cmdq, flag, CMD_FIND_PANE,                          error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_PANE,
                             targetflags);                              targetflags);
                         if (fs == NULL)                          if (error != 0)
                                 return (-1);                                  return (-1);
                         statef->s = fs->s;                          statef->s = fs.s;
                         statef->wl = fs->wl;                          statef->wl = fs.wl;
                         statef->wp = fs->wp;                          statef->wp = fs.wp;
                 } else {                  } else {
                         fs = cmd_find_target(cmdq, flag, CMD_FIND_SESSION,                          error = cmd_find_target(&fs, cmdq, flag,
                             targetflags);                              CMD_FIND_SESSION, targetflags);
                         if (fs == NULL)                          if (error != 0)
                                 return (-1);                                  return (-1);
                         statef->s = fs->s;                          statef->s = fs.s;
   
                         if (flag == NULL) {                          if (flag == NULL) {
                                 statef->wl = statef->s->curw;                                  statef->wl = statef->s->curw;
Line 516 
Line 516 
                 break;                  break;
         case CMD_MOVEW_R|CMD_INDEX_T:          case CMD_MOVEW_R|CMD_INDEX_T:
         case CMD_MOVEW_R|CMD_INDEX_S:          case CMD_MOVEW_R|CMD_INDEX_S:
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_SESSION, targetflags);                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_SESSION,
                 if (fs != NULL)                      targetflags);
                         statef->s = fs->s;                  if (error == 0)
                           statef->s = fs.s;
                 else {                  else {
                         fs = cmd_find_target(cmdq, flag, CMD_FIND_WINDOW,                          error = cmd_find_target(&fs, cmdq, flag,
                             CMD_FIND_WINDOW_INDEX);                              CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX);
                         if (fs == NULL)                          if (error != 0)
                                 return (-1);                                  return (-1);
                         statef->s = fs->s;                          statef->s = fs.s;
                         statef->idx = fs->idx;                          statef->idx = fs.idx;
                 }                  }
                 break;                  break;
         case CMD_SESSION_T:          case CMD_SESSION_T:
         case CMD_SESSION_S:          case CMD_SESSION_S:
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_SESSION, targetflags);                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_SESSION,
                 if (fs == NULL)                      targetflags);
                   if (error != 0)
                         return (-1);                          return (-1);
                 statef->s = fs->s;                  statef->s = fs.s;
                 break;                  break;
         case CMD_WINDOW_MARKED_T:          case CMD_WINDOW_MARKED_T:
         case CMD_WINDOW_MARKED_S:          case CMD_WINDOW_MARKED_S:
Line 541 
Line 543 
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case CMD_WINDOW_T:          case CMD_WINDOW_T:
         case CMD_WINDOW_S:          case CMD_WINDOW_S:
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_WINDOW, targetflags);                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_WINDOW,
                 if (fs == NULL)                      targetflags);
                   if (error != 0)
                         return (-1);                          return (-1);
                 statef->s = fs->s;                  statef->s = fs.s;
                 statef->wl = fs->wl;                  statef->wl = fs.wl;
                 break;                  break;
         case CMD_PANE_MARKED_T:          case CMD_PANE_MARKED_T:
         case CMD_PANE_MARKED_S:          case CMD_PANE_MARKED_S:
Line 553 
Line 556 
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case CMD_PANE_T:          case CMD_PANE_T:
         case CMD_PANE_S:          case CMD_PANE_S:
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_PANE, targetflags);                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_PANE,
                 if (fs == NULL)                      targetflags);
                   if (error != 0)
                         return (-1);                          return (-1);
                 statef->s = fs->s;                  statef->s = fs.s;
                 statef->wl = fs->wl;                  statef->wl = fs.wl;
                 statef->wp = fs->wp;                  statef->wp = fs.wp;
                 break;                  break;
         case CMD_INDEX_T:          case CMD_INDEX_T:
         case CMD_INDEX_S:          case CMD_INDEX_S:
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_WINDOW,                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_WINDOW,
                     CMD_FIND_WINDOW_INDEX);                      CMD_FIND_WINDOW_INDEX);
                 if (fs == NULL)                  if (error != 0)
                         return (-1);                          return (-1);
                 statef->s = fs->s;                  statef->s = fs.s;
                 statef->idx = fs->idx;                  statef->idx = fs.idx;
                 break;                  break;
         default:          default:
                 fatalx("too many -%c for %s", c, cmd->entry->name);                  fatalx("too many -%c for %s", c, cmd->entry->name);
Line 586 
Line 590 
                 if (state->c != NULL)                  if (state->c != NULL)
                         statef->s = state->c->session;                          statef->s = state->c->session;
                 if (statef->s == NULL) {                  if (statef->s == NULL) {
                         fs = cmd_find_target(cmdq, NULL, CMD_FIND_SESSION,                          error = cmd_find_target(&fs, cmdq, NULL,
                             CMD_FIND_QUIET);                              CMD_FIND_SESSION, CMD_FIND_QUIET);
                         if (fs != NULL)                          if (error == 0)
                                 statef->s = fs->s;                                  statef->s = fs.s;
                 }                  }
                 if (statef->s == NULL) {                  if (statef->s == NULL) {
                         if (flags & CMD_CANFAIL)                          if (flags & CMD_CANFAIL)
Line 599 
Line 603 
                 }                  }
         }          }
         if (statef->wl == NULL) {          if (statef->wl == NULL) {
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_WINDOW, 0);                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_WINDOW, 0);
                 if (fs != NULL) {                  if (error != 0) {
                         statef->s = fs->s;                          statef->s = fs.s;
                         statef->wl = fs->wl;                          statef->wl = fs.wl;
                 }                  }
         }          }
         if (statef->wp == NULL) {          if (statef->wp == NULL) {
                 fs = cmd_find_target(cmdq, flag, CMD_FIND_PANE, 0);                  error = cmd_find_target(&fs, cmdq, flag, CMD_FIND_PANE, 0);
                 if (fs != NULL) {                  if (error != 0) {
                         statef->s = fs->s;                          statef->s = fs.s;
                         statef->wl = fs->wl;                          statef->wl = fs.wl;
                         statef->wp = fs->wp;                          statef->wp = fs.wp;
                 }                  }
         }          }
         return (0);          return (0);

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.111