version 1.10, 2012/06/18 09:16:15 |
version 1.11, 2012/07/11 07:10:15 |
|
|
* Note this deliberately has no alias to make it hard to hit by accident. |
* Note this deliberately has no alias to make it hard to hit by accident. |
*/ |
*/ |
|
|
int cmd_kill_session_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmd_ctx *); |
|
|
const struct cmd_entry cmd_kill_session_entry = { |
const struct cmd_entry cmd_kill_session_entry = { |
"kill-session", NULL, |
"kill-session", NULL, |
|
|
cmd_kill_session_exec |
cmd_kill_session_exec |
}; |
}; |
|
|
int |
enum cmd_retval |
cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct session *s, *s2, *s3; |
struct session *s, *s2, *s3; |
|
|
if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) |
if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) |
return (-1); |
return (CMD_RETURN_ERROR); |
|
|
if (args_has(args, 'a')) { |
if (args_has(args, 'a')) { |
RB_FOREACH_SAFE(s2, sessions, &sessions, s3) { |
RB_FOREACH_SAFE(s2, sessions, &sessions, s3) { |
|
|
server_destroy_session(s); |
server_destroy_session(s); |
session_destroy(s); |
session_destroy(s); |
} |
} |
return (0); |
return (CMD_RETURN_NORMAL); |
} |
} |