X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Flttng.c;h=b498539c76ea7847baafb177f23ee792f50fa901;hb=8190767eb2133d712c22d87a26efa4790ec9dd3a;hp=aa13bc45dd57f621e539b62d4e1aa6f401947767;hpb=f67353ba14d7c2c860b4ed59247a38da77a481ce;p=lttng-tools.git diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index aa13bc45d..b498539c7 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -65,27 +65,29 @@ static struct option long_options[] = { /* First level command */ static struct cmd_struct commands[] = { - { "list", cmd_list}, - { "status", cmd_status}, + { "add-context", cmd_add_context}, + { "calibrate", cmd_calibrate}, { "create", cmd_create}, { "destroy", cmd_destroy}, - { "start", cmd_start}, - { "stop", cmd_stop}, - { "enable-event", cmd_enable_events}, + { "disable-channel", cmd_disable_channels}, { "disable-event", cmd_disable_events}, { "enable-channel", cmd_enable_channels}, - { "disable-channel", cmd_disable_channels}, - { "add-context", cmd_add_context}, + { "enable-event", cmd_enable_events}, + { "help", NULL}, + { "list", cmd_list}, + { "load", cmd_load}, + { "metadata", cmd_metadata}, + { "save", cmd_save}, { "set-session", cmd_set_session}, - { "version", cmd_version}, - { "calibrate", cmd_calibrate}, - { "view", cmd_view}, { "snapshot", cmd_snapshot}, - { "save", cmd_save}, - { "load", cmd_load}, + { "start", cmd_start}, + { "status", cmd_status}, + { "stop", cmd_stop}, { "track", cmd_track}, { "untrack", cmd_untrack}, - { "metadata", cmd_metadata}, + { "help", NULL}, + { "version", cmd_version}, + { "view", cmd_view}, { NULL, NULL} /* Array closure */ }; @@ -216,8 +218,14 @@ static int handle_command(int argc, char **argv) goto end; } + /* Special case for help command which needs the commands array */ + if (strcmp(argv[0], "help") == 0) { + ret = cmd_help(argc, (const char**) argv, commands); + goto end; + } + cmd = &commands[i]; - while (cmd->func != NULL) { + while (cmd->name != NULL) { /* Find command */ if (strcmp(argv[0], cmd->name) == 0) { ret = cmd->func(argc, (const char**) argv);