Add --enable-embedded-help option to embed --help messages in binaries
[lttng-tools.git] / src / bin / lttng / commands / help.c
index 29f56bab1778f3dd38ce5186bc5da6a21b7ebc7e..5db141959d1bd089d7f8a65ea93fc957893464d3 100644 (file)
 #include "../command.h"
 #include <common/utils.h>
 
+static const char *help_msg =
+#ifdef LTTNG_EMBED_HELP
+#include <lttng-help.1.h>
+#else
+NULL
+#endif
+;
+
+static const char *lttng_help_msg =
+#ifdef LTTNG_EMBED_HELP
+#include <lttng.1.h>
+#else
+NULL
+#endif
+;
+
 enum {
        OPT_HELP = 1,
        OPT_LIST_OPTIONS,
@@ -69,14 +85,14 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
 
        if (cmd_name == NULL) {
                /* Fall back to lttng(1) */
-               ret = utils_show_man_page(1, "lttng");
-
+               ret = utils_show_help(1, "lttng", lttng_help_msg);
                if (ret) {
-                       ERR("Cannot view man page lttng(1)");
+                       ERR("Cannot show --help for `lttng`");
                        perror("exec");
                        ret = CMD_ERROR;
-                       goto end;
                }
+
+               goto end;
        }
 
        /* Make sure command name exists */
This page took 0.023459 seconds and 4 git commands to generate.