int cmd_lock_client_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_target_data *data = self->data; struct client *c; if ((c = cmd_find_client(ctx, data->target)) == NULL) return (-1); server_lock_client(c); recalculate_sizes(); return (0); }
static enum cmd_retval cmd_lock_server_exec(struct cmd *self, __unused struct cmd_q *cmdq) { if (self->entry == &cmd_lock_server_entry) server_lock(); else if (self->entry == &cmd_lock_session_entry) server_lock_session(cmdq->state.tflag.s); else server_lock_client(cmdq->state.c); recalculate_sizes(); return (CMD_RETURN_NORMAL); }
enum cmd_retval cmd_lock_server_exec(struct cmd *self, unused struct cmd_q *cmdq) { struct args *args = self->args; struct client *c; struct session *s; if (self->entry == &cmd_lock_server_entry) server_lock(); else if (self->entry == &cmd_lock_session_entry) { s = cmd_find_session(cmdq, args_get(args, 't'), 0); if (s == NULL) return (CMD_RETURN_ERROR); server_lock_session(s); } else { c = cmd_find_client(cmdq, args_get(args, 't'), 0); if (c == NULL) return (CMD_RETURN_ERROR); server_lock_client(c); } recalculate_sizes(); return (CMD_RETURN_NORMAL); }