mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
Mass rename struct cmd_q to struct cmdq_item and related.
This commit is contained in:
@ -33,7 +33,7 @@
|
||||
|
||||
#define NEW_SESSION_TEMPLATE "#{session_name}:"
|
||||
|
||||
static enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
|
||||
static enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmdq_item *);
|
||||
|
||||
const struct cmd_entry cmd_new_session_entry = {
|
||||
.name = "new-session",
|
||||
@ -64,12 +64,12 @@ const struct cmd_entry cmd_has_session_entry = {
|
||||
};
|
||||
|
||||
static enum cmd_retval
|
||||
cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = cmdq->client;
|
||||
struct client *c = item->client;
|
||||
struct session *s, *as;
|
||||
struct session *groupwith = cmdq->state.tflag.s;
|
||||
struct session *groupwith = item->state.tflag.s;
|
||||
struct window *w;
|
||||
struct environ *env;
|
||||
struct termios tio, *tiop;
|
||||
@ -91,37 +91,37 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
}
|
||||
|
||||
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) {
|
||||
cmdq_error(cmdq, "command or window name given with target");
|
||||
cmdq_error(item, "command or window name given with target");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
newname = args_get(args, 's');
|
||||
if (newname != NULL) {
|
||||
if (!session_check_name(newname)) {
|
||||
cmdq_error(cmdq, "bad session name: %s", newname);
|
||||
cmdq_error(item, "bad session name: %s", newname);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
if ((as = session_find(newname)) != NULL) {
|
||||
if (args_has(args, 'A')) {
|
||||
/*
|
||||
* This cmdq is now destined for
|
||||
* This item is now destined for
|
||||
* attach-session. Because attach-session
|
||||
* will have already been prepared, copy this
|
||||
* session into its tflag so it can be used.
|
||||
*/
|
||||
cmd_find_from_session(&cmdq->state.tflag, as);
|
||||
return (cmd_attach_session(cmdq,
|
||||
cmd_find_from_session(&item->state.tflag, as);
|
||||
return (cmd_attach_session(item,
|
||||
args_has(args, 'D'), 0, NULL,
|
||||
args_has(args, 'E')));
|
||||
}
|
||||
cmdq_error(cmdq, "duplicate session: %s", newname);
|
||||
cmdq_error(item, "duplicate session: %s", newname);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if ((target = args_get(args, 't')) != NULL) {
|
||||
if (groupwith == NULL) {
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
cmdq_error(item, "no such session: %s", target);
|
||||
goto error;
|
||||
}
|
||||
} else
|
||||
@ -139,7 +139,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
|
||||
/* Get the new session working directory. */
|
||||
if (args_has(args, 'c')) {
|
||||
ft = format_create(cmdq, 0);
|
||||
ft = format_create(item, 0);
|
||||
format_defaults(ft, c, NULL, NULL, NULL);
|
||||
to_free = cwd = format_expand(ft, args_get(args, 'c'));
|
||||
format_free(ft);
|
||||
@ -158,8 +158,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
* over.
|
||||
*/
|
||||
if (!detached && !already_attached && c->tty.fd != -1) {
|
||||
if (server_client_check_nested(cmdq->client)) {
|
||||
cmdq_error(cmdq, "sessions should be nested with care, "
|
||||
if (server_client_check_nested(item->client)) {
|
||||
cmdq_error(item, "sessions should be nested with care, "
|
||||
"unset $TMUX to force");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
@ -172,7 +172,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
/* Open the terminal if necessary. */
|
||||
if (!detached && !already_attached) {
|
||||
if (server_client_open(c, &cause) != 0) {
|
||||
cmdq_error(cmdq, "open terminal failed: %s", cause);
|
||||
cmdq_error(item, "open terminal failed: %s", cause);
|
||||
free(cause);
|
||||
goto error;
|
||||
}
|
||||
@ -189,14 +189,14 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
if (detached && args_has(args, 'x')) {
|
||||
sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
cmdq_error(cmdq, "width %s", errstr);
|
||||
cmdq_error(item, "width %s", errstr);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (detached && args_has(args, 'y')) {
|
||||
sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
cmdq_error(cmdq, "height %s", errstr);
|
||||
cmdq_error(item, "height %s", errstr);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@ -246,7 +246,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
sy, &cause);
|
||||
environ_free(env);
|
||||
if (s == NULL) {
|
||||
cmdq_error(cmdq, "create session failed: %s", cause);
|
||||
cmdq_error(item, "create session failed: %s", cause);
|
||||
free(cause);
|
||||
goto error;
|
||||
}
|
||||
@ -301,11 +301,11 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
if ((template = args_get(args, 'F')) == NULL)
|
||||
template = NEW_SESSION_TEMPLATE;
|
||||
|
||||
ft = format_create(cmdq, 0);
|
||||
ft = format_create(item, 0);
|
||||
format_defaults(ft, c, s, NULL, NULL);
|
||||
|
||||
cp = format_expand(ft, template);
|
||||
cmdq_print(cmdq, "%s", cp);
|
||||
cmdq_print(item, "%s", cp);
|
||||
free(cp);
|
||||
|
||||
format_free(ft);
|
||||
@ -318,7 +318,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
free((void *)to_free);
|
||||
|
||||
cmd_find_from_session(&fs, s);
|
||||
hooks_insert(s->hooks, cmdq, &fs, "after-new-session");
|
||||
hooks_insert(s->hooks, item, &fs, "after-new-session");
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
|
||||
|
Reference in New Issue
Block a user