&help_command
};
+/* Aliases provide a mechanism to allow compatibility with old command
+ * names (such as "retrace") for current commands (such as the replay
+ * command). */
+typedef struct {
+ const char *name;
+ const Command *command;
+} Alias;
+
+static const Alias aliases[] = {
+ { "retrace", &retrace_command }
+};
+
static void
usage(void)
{
{
const char *command_name;
const Command *command;
+ const Alias *alias;
int i;
for (i = 1; i < argc; ++i) {
return (command->function) (argc, argv);
}
+ for (i = 0; i < ARRAY_SIZE(aliases); i++) {
+ alias = &aliases[i];
+
+ if (strcmp(command_name, alias->name) == 0)
+ return (alias->command->function) (argc, argv);
+ }
+
std::cerr << "Error: unknown command " << command_name
<< " (see \"apitrace help\").\n";