From b210e870c99e028d5c6ad8d26efe60dbd14c43c2 Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Thu, 23 Jul 2009 21:43:22 +0000 Subject: linux: show the manpage on -h or --help Review URL: http://codereview.chromium.org/160026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21450 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/chrome_dll_main.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'chrome/app') diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 52a9334..652217e 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -338,6 +338,16 @@ int ChromeMain(int argc, const char** argv) { return 1; #endif +#if defined(OS_LINUX) + // Show the man page on --help or -h. + if (parsed_command_line.HasSwitch(L"help") || + parsed_command_line.HasSwitch(L"h")) { + FilePath binary(parsed_command_line.argv()[0]); + int ret = execlp("man", "man", binary.BaseName().value().c_str(), NULL); + LOG(FATAL) << "execlp failed: " << strerror(ret); + } +#endif + #if defined(OS_POSIX) // Always ignore SIGPIPE. We check the return value of write(). CHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR); -- cgit v1.1