about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc9
-rw-r--r--src/libmain/shared.hh3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 5f92c3df34a0..f8149fc608fd 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -91,6 +91,7 @@ string getArg(const string & opt,
     return *i;
 }
 
+
 /* Initialize and reorder arguments, then call the actual argument
    processor. */
 static void initAndRun(int argc, char * * argv)
@@ -275,6 +276,14 @@ static void * oomHandler(size_t requested)
 }
 
 
+void showManPage(const string & name)
+{
+    string cmd = "man " + name;
+    if (system(cmd.c_str()) != 0)
+        throw Error(format("command `%1%' failed") % cmd);
+}
+
+
 int exitCode = 0;
 char * * argvSaved = 0;
 
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index c69879a12356..9e5ec8360952 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -41,6 +41,9 @@ template<class N> N getIntArg(const string & opt,
     return n;
 }
 
+/* Show the manual page for the specified program. */
+void showManPage(const string & name);
+
 /* Whether we're running setuid. */
 extern bool setuidMode;