version 1.45, 2015/02/05 10:32:39 |
version 1.46, 2015/06/17 16:50:28 |
|
|
struct winlink *wl; |
struct winlink *wl; |
const char *cmd, *path, *template; |
const char *cmd, *path, *template; |
char **argv, *cause, *cp; |
char **argv, *cause, *cp; |
int argc, idx, last, detached, cwd, fd = -1; |
int argc, idx, detached, cwd, fd = -1; |
struct format_tree *ft; |
struct format_tree *ft; |
struct environ_entry *envent; |
struct environ_entry *envent; |
|
|
|
|
wl = cmd_find_window(cmdq, args_get(args, 't'), &s); |
wl = cmd_find_window(cmdq, args_get(args, 't'), &s); |
if (wl == NULL) |
if (wl == NULL) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
idx = wl->idx + 1; |
if ((idx = winlink_shuffle_up(s, wl)) == -1) { |
|
|
/* Find the next free index. */ |
|
for (last = idx; last < INT_MAX; last++) { |
|
if (winlink_find_by_index(&s->windows, last) == NULL) |
|
break; |
|
} |
|
if (last == INT_MAX) { |
|
cmdq_error(cmdq, "no free window indexes"); |
cmdq_error(cmdq, "no free window indexes"); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
|
|
|
/* Move everything from last - 1 to idx up a bit. */ |
|
for (; last > idx; last--) { |
|
wl = winlink_find_by_index(&s->windows, last - 1); |
|
server_link_window(s, wl, s, last, 0, 0, NULL); |
|
server_unlink_window(s, wl); |
|
} |
} |
} else { |
} else { |
idx = cmd_find_index(cmdq, args_get(args, 't'), &s); |
idx = cmd_find_index(cmdq, args_get(args, 't'), &s); |