Add --enable-embedded-help option to embed --help messages in binaries
[lttng-tools.git] / src / common / utils.c
index 4d49728c0f47a23cce6eba1bc2f72f11c2c14836..893122905bd44ca75b9fa3836cdf9098e142dfff 100644 (file)
@@ -1429,11 +1429,17 @@ static const char *get_man_bin_path(void)
 }
 
 LTTNG_HIDDEN
-int utils_show_man_page(int section, const char *page_name)
+int utils_show_help(int section, const char *page_name,
+               const char *help_msg)
 {
        char section_string[8];
        const char *man_bin_path = get_man_bin_path();
-       int ret;
+       int ret = 0;
+
+       if (help_msg) {
+               printf("%s", help_msg);
+               goto end;
+       }
 
        /* Section integer -> section string */
        ret = sprintf(section_string, "%d", section);
@@ -1448,5 +1454,7 @@ int utils_show_man_page(int section, const char *page_name)
         */
        ret = execlp(man_bin_path, "man", "-M", MANPATH,
                section_string, page_name, NULL);
+
+end:
        return ret;
 }
This page took 0.026698 seconds and 4 git commands to generate.