-/* $OpenBSD: cfg.c,v 1.83 2021/04/07 12:50:12 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.84 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
pr = cmd_parse_from_file(f, &pi);
fclose(f);
- if (pr->status == CMD_PARSE_EMPTY)
- return (0);
if (pr->status == CMD_PARSE_ERROR) {
cfg_add_cause("%s", pr->error);
free(pr->error);
pi.c = c;
pr = cmd_parse_from_buffer(buf, len, &pi);
- if (pr->status == CMD_PARSE_EMPTY)
- return (0);
if (pr->status == CMD_PARSE_ERROR) {
cfg_add_cause("%s", pr->error);
free(pr->error);
-/* $OpenBSD: cmd-bind-key.c,v 1.40 2021/08/21 10:22:38 nicm Exp $ */
+/* $OpenBSD: cmd-bind-key.c,v 1.41 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
cmd_free_argv(argc, argv);
}
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- cmdq_error(item, "empty command");
- return (CMD_RETURN_ERROR);
case CMD_PARSE_ERROR:
cmdq_error(item, "%s", pr->error);
free(pr->error);
-/* $OpenBSD: cmd-if-shell.c,v 1.78 2021/08/21 10:22:39 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.79 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
pr = cmd_parse_from_string(cmd, &cdata->input);
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- break;
case CMD_PARSE_ERROR:
if (cdata->item != NULL)
cmdq_error(cdata->item, "%s", pr->error);
-/* $OpenBSD: cmd-parse.y,v 1.38 2021/08/21 14:06:17 nicm Exp $ */
+/* $OpenBSD: cmd-parse.y,v 1.39 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
first = TAILQ_FIRST(&cmd->arguments);
if (first == NULL || first->type != CMD_PARSE_STRING) {
- pr->status = CMD_PARSE_EMPTY;
+ pr->status = CMD_PARSE_SUCCESS;
+ pr->cmdlist = cmd_list_new();
return (1);
}
name = first->string;
/* Check for an empty list. */
if (TAILQ_EMPTY(cmds)) {
- pr->status = CMD_PARSE_EMPTY;
+ pr->status = CMD_PARSE_SUCCESS;
+ pr->cmdlist = cmd_list_new();
return;
}
cmd_parse_log_commands(cmds, __func__);
pr = cmd_parse_from_string(s, pi);
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- break;
case CMD_PARSE_ERROR:
if (error != NULL)
*error = pr->error;
pr = cmd_parse_from_string(s, pi);
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- break;
case CMD_PARSE_ERROR:
if (error != NULL)
*error = pr->error;
memset(&pr, 0, sizeof pr);
if (len == 0) {
- pr.status = CMD_PARSE_EMPTY;
- pr.cmdlist = NULL;
- pr.error = NULL;
+ pr.status = CMD_PARSE_SUCCESS;
+ pr.cmdlist = cmd_list_new();
return (&pr);
}
-/* $OpenBSD: cmd-queue.c,v 1.106 2021/08/21 10:28:05 nicm Exp $ */
+/* $OpenBSD: cmd-queue.c,v 1.107 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
}
}
+/* Empty command callback. */
+static enum cmd_retval
+cmdq_empty_command(__unused struct cmdq_item *item, __unused void *data)
+{
+ return (CMD_RETURN_NORMAL);
+}
+
/* Get a command for the command queue. */
struct cmdq_item *
cmdq_get_command(struct cmd_list *cmdlist, struct cmdq_state *state)
const struct cmd_entry *entry;
int created = 0;
+ if ((cmd = cmd_list_first(cmdlist)) == NULL)
+ return (cmdq_get_callback(cmdq_empty_command, NULL));
+
if (state == NULL) {
state = cmdq_new_state(NULL, NULL, 0);
created = 1;
}
- cmd = cmd_list_first(cmdlist);
while (cmd != NULL) {
entry = cmd_get_entry(cmd);
-/* $OpenBSD: options.c,v 1.63 2021/08/11 20:49:55 nicm Exp $ */
+/* $OpenBSD: options.c,v 1.64 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
if (OPTIONS_IS_COMMAND(o)) {
pr = cmd_parse_from_string(value, NULL);
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- if (cause != NULL)
- *cause = xstrdup("empty command");
- return (-1);
case CMD_PARSE_ERROR:
if (cause != NULL)
*cause = pr->error;
-/* $OpenBSD: server-client.c,v 1.382 2021/08/20 19:08:36 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.383 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
pr = cmd_parse_from_arguments(argc, argv, NULL);
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- cause = xstrdup("empty command");
- goto error;
case CMD_PARSE_ERROR:
cause = pr->error;
goto error;
-/* $OpenBSD: tmux.h,v 1.1131 2021/08/21 14:06:17 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1132 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
/* Command parse result. */
enum cmd_parse_status {
- CMD_PARSE_EMPTY,
CMD_PARSE_ERROR,
CMD_PARSE_SUCCESS
};
-/* $OpenBSD: window-customize.c,v 1.11 2021/06/10 07:50:04 nicm Exp $ */
+/* $OpenBSD: window-customize.c,v 1.12 2021/08/21 17:25:32 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
pr = cmd_parse_from_string(s, NULL);
switch (pr->status) {
- case CMD_PARSE_EMPTY:
- error = xstrdup("empty command");
- goto fail;
case CMD_PARSE_ERROR:
error = pr->error;
goto fail;