MANPATH="$builddir/doc/man"
export MANPATH
+# Use local path to search manual pages for lttng --help.
+LTTNG_MANPATH="$builddir/doc/man"
+export LTTNG_MANPATH
+
+# Use system man instead of /usr/bin/man.
+LTTNG_MAN_BIN_PATH=$(type -p man)
+export LTTNG_MAN_BIN_PATH
+
exec "$@"
/* Environment variable to set man pager binary path. */
#define DEFAULT_MAN_BIN_PATH_ENV "LTTNG_MAN_BIN_PATH"
+/* Environment variable to set man manpath. */
+#define DEFAULT_MANPATH "LTTNG_MANPATH"
+
/* Default man pager binary path. */
#define DEFAULT_MAN_BIN_PATH "/usr/bin/man"
return DEFAULT_MAN_BIN_PATH;
}
+static const char *get_manpath()
+{
+ char *manpath = lttng_secure_getenv(DEFAULT_MANPATH);
+
+ if (manpath) {
+ return manpath;
+ }
+
+ /* As defined during configuration. */
+ return MANPATH;
+}
+
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();
+ const char *manpath = get_manpath();
int ret = 0;
if (help_msg) {
* be installed outside /usr, in which case its man pages are
* not located in the default /usr/share/man directory.
*/
- ret = execlp(man_bin_path, "man", "-M", MANPATH, section_string, page_name, NULL);
+ ret = execlp(man_bin_path, "man", "-M", manpath, section_string, page_name, NULL);
end:
return ret;