/* see cmd_names[] below, one for each unique "ID" in command-lines.in */
struct cmd_name {
- const char *enum_name; /* "foo_CMD" */
- int cmd_enum; /* foo_CMD */
- const char *name; /* "foo" from string after ID: */
+ const char name[68]; /* "foo" from string after ID: */
+ uint16_t cmd_enum; /* foo_CMD */
};
/* create table of value names, e.g. String, and corresponding enum from vals.h */
/* create table of command IDs */
static const struct cmd_name cmd_names[CMD_COUNT + 1] = {
-#define cmd(a, b) { # a, a, # b },
+#define cmd(a, b) { # b, a },
#include "../include/cmds.h"
#undef cmd
};
/* Sort all commands by its name for quick binary search */
qsort(commands_idx, COMMAND_COUNT, sizeof(long), _command_name_compare);
- for (i = 0; command_names[i].name; i++)
+ for (i = 0; i < LVM_COMMAND_COUNT; ++i)
_set_valid_args_for_command_name(i);
_cmdline.num_command_names = i; /* Also counted how many command entries we have */
{
int i;
- for (i = 0; command_names[i].name; i++)
+ for (i = 0; i < LVM_COMMAND_COUNT; ++i)
_usage(command_names[i].name, 1, 1);
print_usage_notes(NULL);