| 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 // This class works with command lines: building and parsing. | 5 // This class works with command lines: building and parsing. |
| 6 // Switches can optionally have a value attached using an equals sign, | 6 // Switches can optionally have a value attached using an equals sign, |
| 7 // as in "-switch=value". Arguments that aren't prefixed with a | 7 // as in "-switch=value". Arguments that aren't prefixed with a |
| 8 // switch prefix are considered "loose parameters". Switch names are | 8 // switch prefix are considered "loose parameters". Switch names are |
| 9 // case-insensitive. An argument of "--" will terminate switch | 9 // case-insensitive. An argument of "--" will terminate switch |
| 10 // parsing, causing everything after to be considered as loose | 10 // parsing, causing everything after to be considered as loose |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Construct a new, empty command line. | 61 // Construct a new, empty command line. |
| 62 // |program| is the name of the program to run (aka argv[0]). | 62 // |program| is the name of the program to run (aka argv[0]). |
| 63 explicit CommandLine(const FilePath& program); | 63 explicit CommandLine(const FilePath& program); |
| 64 | 64 |
| 65 // Initialize the current process CommandLine singleton. On Windows, | 65 // Initialize the current process CommandLine singleton. On Windows, |
| 66 // ignores its arguments (we instead parse GetCommandLineW() | 66 // ignores its arguments (we instead parse GetCommandLineW() |
| 67 // directly) because we don't trust the CRT's parsing of the command | 67 // directly) because we don't trust the CRT's parsing of the command |
| 68 // line, but it still must be called to set up the command line. | 68 // line, but it still must be called to set up the command line. |
| 69 static void Init(int argc, const char* const* argv); | 69 static void Init(int argc, const char* const* argv); |
| 70 | 70 |
| 71 #if defined(OS_LINUX) || defined(OS_FREEBSD) | 71 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 72 // Sets the current process' arguments that show in "ps" etc. to those | 72 // Sets the current process' arguments that show in "ps" etc. to those |
| 73 // in |current_process_commandline_|. Used by the zygote host so that | 73 // in |current_process_commandline_|. Used by the zygote host so that |
| 74 // renderers show up with --type=renderer. | 74 // renderers show up with --type=renderer. |
| 75 static void SetProcTitle(); | 75 static void SetProcTitle(); |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 // Destroys the current process CommandLine singleton. This is necessary if | 78 // Destroys the current process CommandLine singleton. This is necessary if |
| 79 // you want to reset the base library to its initial state (for example in an | 79 // you want to reset the base library to its initial state (for example in an |
| 80 // outer library that needs to be able to terminate, and be re-initialized). | 80 // outer library that needs to be able to terminate, and be re-initialized). |
| 81 // If Init is called only once, e.g. in main(), calling Reset() is not | 81 // If Init is called only once, e.g. in main(), calling Reset() is not |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 std::vector<StringType> loose_values_; | 232 std::vector<StringType> loose_values_; |
| 233 | 233 |
| 234 // We allow copy constructors, because a common pattern is to grab a | 234 // We allow copy constructors, because a common pattern is to grab a |
| 235 // copy of the current process's command line and then add some | 235 // copy of the current process's command line and then add some |
| 236 // flags to it. E.g.: | 236 // flags to it. E.g.: |
| 237 // CommandLine cl(*CommandLine::ForCurrentProcess()); | 237 // CommandLine cl(*CommandLine::ForCurrentProcess()); |
| 238 // cl.AppendSwitch(...); | 238 // cl.AppendSwitch(...); |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 #endif // BASE_COMMAND_LINE_H_ | 241 #endif // BASE_COMMAND_LINE_H_ |
| OLD | NEW |