X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fhelp.cpp;h=57b73a6b0a94198d90fdda62c68afb58ba4c8780;hb=HEAD;hp=9822b47eb90b0e5cf0e7eb940f4a04fa458a64ba;hpb=5b915816f16e7cb3134dd7279abad79b31c2486c;p=lttng-tools.git diff --git a/src/bin/lttng/commands/help.cpp b/src/bin/lttng/commands/help.cpp index 9822b47eb..57b73a6b0 100644 --- a/src/bin/lttng/commands/help.cpp +++ b/src/bin/lttng/commands/help.cpp @@ -6,27 +6,28 @@ */ #define _LGPL_SOURCE +#include "../command.hpp" + +#include + #include #include #include #include -#include "../command.hpp" -#include - #ifdef LTTNG_EMBED_HELP static const char *help_msg = #include -; + ; #endif static const char *lttng_help_msg = #ifdef LTTNG_EMBED_HELP #include #else -NULL + nullptr #endif -; + ; enum { OPT_HELP = 1, @@ -35,9 +36,9 @@ enum { static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ - {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, - {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL}, - {0, 0, 0, 0, 0, 0, 0} + { "help", 'h', POPT_ARG_NONE, nullptr, OPT_HELP, nullptr, nullptr }, + { "list-options", 0, POPT_ARG_NONE, nullptr, OPT_LIST_OPTIONS, nullptr, nullptr }, + { nullptr, 0, 0, nullptr, 0, nullptr, nullptr } }; /* @@ -49,10 +50,10 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[]) const char *arg_cmd_name; static poptContext pc; const struct cmd_struct *cmd; - int found = 0; + bool found = false; const char *cmd_argv[2]; - pc = poptGetContext(NULL, argc, argv, long_options, 0); + pc = poptGetContext(nullptr, argc, argv, long_options, 0); poptReadDefaultConfig(pc, 0); while ((opt = poptGetNextOpt(pc)) != -1) { @@ -71,7 +72,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[]) /* Get command name */ arg_cmd_name = poptGetArg(pc); - if (arg_cmd_name == NULL) { + if (arg_cmd_name == nullptr) { /* Fall back to lttng(1) */ ret = utils_show_help(1, "lttng", lttng_help_msg); if (ret) { @@ -92,9 +93,9 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[]) /* Make sure command name exists */ cmd = &commands[0]; - while (cmd->name != NULL) { + while (cmd->name != nullptr) { if (strcmp(cmd->name, arg_cmd_name) == 0) { - found = 1; + found = true; break; }