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

Diff for /src/usr.bin/tmux/cmd-new-window.c between version 1.72 and 1.73

version 1.72, 2017/08/30 10:33:57 version 1.73, 2018/03/01 12:53:08
Line 57 
Line 57 
         struct winlink          *wl = item->target.wl;          struct winlink          *wl = item->target.wl;
         struct client           *c = cmd_find_client(item, NULL, 1);          struct client           *c = cmd_find_client(item, NULL, 1);
         int                      idx = item->target.idx;          int                      idx = item->target.idx;
         const char              *cmd, *path, *template, *cwd;          const char              *cmd, *path, *template, *tmp;
         char                   **argv, *cause, *cp, *to_free = NULL;          char                   **argv, *cause, *cp, *cwd, *name;
         int                      argc, detached;          int                      argc, detached;
         struct environ_entry    *envent;          struct environ_entry    *envent;
         struct cmd_find_state    fs;          struct cmd_find_state    fs;
Line 93 
Line 93 
         if (envent != NULL)          if (envent != NULL)
                 path = envent->value;                  path = envent->value;
   
         if (args_has(args, 'c')) {          if ((tmp = args_get(args, 'c')) != NULL)
                 cwd = args_get(args, 'c');                  cwd = format_single(item, tmp, c, s, NULL, NULL);
                 to_free = format_single(item, cwd, c, s, NULL, NULL);          else if (item->client != NULL && item->client->session == NULL)
                 cwd = to_free;                  cwd = xstrdup(item->client->cwd);
         } else if (item->client != NULL && item->client->session == NULL)  
                 cwd = item->client->cwd;  
         else          else
                 cwd = s->cwd;                  cwd = xstrdup(s->cwd);
   
           if ((tmp = args_get(args, 'n')) != NULL)
                   name = format_single(item, tmp, c, s, NULL, NULL);
           else
                   name = NULL;
   
         wl = NULL;          wl = NULL;
         if (idx != -1)          if (idx != -1)
                 wl = winlink_find_by_index(&s->windows, idx);                  wl = winlink_find_by_index(&s->windows, idx);
Line 124 
Line 127 
   
         if (idx == -1)          if (idx == -1)
                 idx = -1 - options_get_number(s->options, "base-index");                  idx = -1 - options_get_number(s->options, "base-index");
         wl = session_new(s, args_get(args, 'n'), argc, argv, path, cwd, idx,          wl = session_new(s, name, argc, argv, path, cwd, idx,
                 &cause);                  &cause);
         if (wl == NULL) {          if (wl == NULL) {
                 cmdq_error(item, "create window failed: %s", cause);                  cmdq_error(item, "create window failed: %s", cause);
Line 149 
Line 152 
         cmd_find_from_winlink(&fs, wl, 0);          cmd_find_from_winlink(&fs, wl, 0);
         hooks_insert(s->hooks, item, &fs, "after-new-window");          hooks_insert(s->hooks, item, &fs, "after-new-window");
   
         free(to_free);          free(name);
           free(cwd);
         return (CMD_RETURN_NORMAL);          return (CMD_RETURN_NORMAL);
   
 error:  error:
         free(to_free);          free(name);
           free(cwd);
         return (CMD_RETURN_ERROR);          return (CMD_RETURN_ERROR);
 }  }

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73