message = xvasprintf(format, args);
va_end(args);
- vlog_set_levels(&VLM_db_ctl_base, VLF_CONSOLE, VLL_OFF);
+ vlog_set_levels(&this_module, VLF_CONSOLE, VLL_OFF);
VLOG_ERR("%s", message);
ovs_error(0, "%s", message);
ctl_exit(EXIT_FAILURE);
NULL, "--if-exists,--all", RW},
{"wait-until", 2, INT_MAX, "TABLE RECORD [COLUMN[:KEY]=VALUE]...",
pre_cmd_wait_until, cmd_wait_until, NULL, "", RO},
- {"show", 0, 0, "", pre_cmd_show, cmd_show, NULL, "", RO},
{NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, RO},
};
+static void
+ctl_register_command(const struct ctl_command_syntax *command)
+{
+ shash_add_assert(&all_commands, command->name, command);
+}
+
/* Registers commands represented by 'struct ctl_command_syntax's to
* 'all_commands'. The last element of 'commands' must be an all-NULL
* element. */
const struct ctl_command_syntax *p;
for (p = commands; p->name; p++) {
- shash_add_assert(&all_commands, p->name, p);
+ ctl_register_command(p);
}
}
void (*ctl_exit_func_)(int status))
{
tables = tables_;
- cmd_show_tables = cmd_show_tables_;
ctl_exit_func = ctl_exit_func_;
ctl_register_commands(db_ctl_commands);
+
+ cmd_show_tables = cmd_show_tables_;
+ if (cmd_show_tables) {
+ static const struct ctl_command_syntax show =
+ {"show", 0, 0, "", pre_cmd_show, cmd_show, NULL, "", RO};
+ ctl_register_command(&show);
+ }
}
/* Returns the text for the database commands usage. */