version 1.16, 2014/10/20 22:29:25 |
version 1.17, 2015/12/13 14:32:38 |
|
|
"rename-session", "rename", |
"rename-session", "rename", |
"t:", 1, 1, |
"t:", 1, 1, |
CMD_TARGET_SESSION_USAGE " new-name", |
CMD_TARGET_SESSION_USAGE " new-name", |
0, |
CMD_SESSION_T, |
cmd_rename_session_exec |
cmd_rename_session_exec |
}; |
}; |
|
|
|
|
cmd_rename_session_exec(struct cmd *self, struct cmd_q *cmdq) |
cmd_rename_session_exec(struct cmd *self, struct cmd_q *cmdq) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct session *s; |
struct session *s = cmdq->state.tflag.s; |
const char *newname; |
const char *newname; |
|
|
newname = args->argv[0]; |
newname = args->argv[0]; |
|
|
cmdq_error(cmdq, "duplicate session: %s", newname); |
cmdq_error(cmdq, "duplicate session: %s", newname); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
|
|
if ((s = cmd_find_session(cmdq, args_get(args, 't'), 0)) == NULL) |
|
return (CMD_RETURN_ERROR); |
|
|
|
RB_REMOVE(sessions, &sessions, s); |
RB_REMOVE(sessions, &sessions, s); |
free(s->name); |
free(s->name); |