| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(port): the ifdefs in here are a first step towards trying to determine | 5 // TODO(port): the ifdefs in here are a first step towards trying to determine |
| 6 // the correct abstraction for all the OS functionality required at this | 6 // the correct abstraction for all the OS functionality required at this |
| 7 // stage of process initialization. It should not be taken as a final | 7 // stage of process initialization. It should not be taken as a final |
| 8 // abstraction. | 8 // abstraction. |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 #endif | 331 #endif |
| 332 | 332 |
| 333 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 333 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 334 | 334 |
| 335 #if defined(OS_WIN) | 335 #if defined(OS_WIN) |
| 336 // Must do this before any other usage of command line! | 336 // Must do this before any other usage of command line! |
| 337 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) | 337 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) |
| 338 return 1; | 338 return 1; |
| 339 #endif | 339 #endif |
| 340 | 340 |
| 341 #if defined(OS_LINUX) |
| 342 // Show the man page on --help or -h. |
| 343 if (parsed_command_line.HasSwitch(L"help") || |
| 344 parsed_command_line.HasSwitch(L"h")) { |
| 345 FilePath binary(parsed_command_line.argv()[0]); |
| 346 int ret = execlp("man", "man", binary.BaseName().value().c_str(), NULL); |
| 347 LOG(FATAL) << "execlp failed: " << strerror(ret); |
| 348 } |
| 349 #endif |
| 350 |
| 341 #if defined(OS_POSIX) | 351 #if defined(OS_POSIX) |
| 342 // Always ignore SIGPIPE. We check the return value of write(). | 352 // Always ignore SIGPIPE. We check the return value of write(). |
| 343 CHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR); | 353 CHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR); |
| 344 #endif // OS_POSIX | 354 #endif // OS_POSIX |
| 345 | 355 |
| 346 int browser_pid; | 356 int browser_pid; |
| 347 std::wstring process_type = | 357 std::wstring process_type = |
| 348 parsed_command_line.GetSwitchValue(switches::kProcessType); | 358 parsed_command_line.GetSwitchValue(switches::kProcessType); |
| 349 if (process_type.empty()) { | 359 if (process_type.empty()) { |
| 350 browser_pid = base::GetCurrentProcId(); | 360 browser_pid = base::GetCurrentProcId(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 _CrtDumpMemoryLeaks(); | 532 _CrtDumpMemoryLeaks(); |
| 523 #endif // _CRTDBG_MAP_ALLOC | 533 #endif // _CRTDBG_MAP_ALLOC |
| 524 | 534 |
| 525 _Module.Term(); | 535 _Module.Term(); |
| 526 #endif | 536 #endif |
| 527 | 537 |
| 528 logging::CleanupChromeLogging(); | 538 logging::CleanupChromeLogging(); |
| 529 | 539 |
| 530 return rv; | 540 return rv; |
| 531 } | 541 } |
| OLD | NEW |