Add --enable-embedded-help option to embed --help messages in binaries
[lttng-tools.git] / src / bin / lttng / utils.c
index 802e0971bd6785c2853e0ffeb1d88b0edc03a5a4..06df5090ac767307eb37328d418c49b6fc7ca922 100644 (file)
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <inttypes.h>
+#include <unistd.h>
 
 #include <common/error.h>
 #include <common/utils.h>
+#include <common/defaults.h>
 
 #include "conf.h"
 #include "utils.h"
@@ -479,3 +481,19 @@ void print_session_stats(const char *session_name)
 end:
        return;
 }
+
+int show_cmd_help(const char *cmd_name, const char *help_msg)
+{
+       int ret;
+       char page_name[32];
+
+       ret = sprintf(page_name, "lttng-%s", cmd_name);
+       assert(ret > 0 && ret < 32);
+       ret = utils_show_help(1, page_name, help_msg);
+       if (ret && !help_msg) {
+               ERR("Cannot view man page `lttng-%s(1)`", cmd_name);
+               perror("exec");
+       }
+
+       return ret;
+}
This page took 0.02329 seconds and 4 git commands to generate.