Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: base/command_line.cc

Issue 495002: Changes to base/ from a combination of FreeBSD and OpenBSD patches. (Closed)
Patch Set: minor tweaks Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #elif defined(OS_FREEBSD) 10 #elif defined(OS_FREEBSD)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 #elif defined(OS_POSIX) 193 #elif defined(OS_POSIX)
194 current_process_commandline_->InitFromArgv(argc, argv); 194 current_process_commandline_->InitFromArgv(argc, argv);
195 #endif 195 #endif
196 196
197 #if defined(OS_LINUX) 197 #if defined(OS_LINUX)
198 if (argv) 198 if (argv)
199 setproctitle_init(const_cast<char**>(argv)); 199 setproctitle_init(const_cast<char**>(argv));
200 #endif 200 #endif
201 } 201 }
202 202
203 #if defined(OS_LINUX) || defined(OS_FREEBSD) 203 #if defined(OS_POSIX) && !defined(OS_MACOSX)
204 // static 204 // static
205 void CommandLine::SetProcTitle() { 205 void CommandLine::SetProcTitle() {
206 // Build a single string which consists of all the arguments separated 206 // Build a single string which consists of all the arguments separated
207 // by spaces. We can't actually keep them separate due to the way the 207 // by spaces. We can't actually keep them separate due to the way the
208 // setproctitle() function works. 208 // setproctitle() function works.
209 std::string title; 209 std::string title;
210 for (size_t i = 1; i < current_process_commandline_->argv_.size(); ++i) { 210 for (size_t i = 1; i < current_process_commandline_->argv_.size(); ++i) {
211 if (!title.empty()) 211 if (!title.empty())
212 title += " "; 212 title += " ";
213 title += current_process_commandline_->argv_[i]; 213 title += current_process_commandline_->argv_[i];
214 } 214 }
215 setproctitle("%s", title.c_str()); 215 setproctitle("%s", title.c_str());
agl 2009/12/14 19:31:26 FreeBSD has a kernel call for setproctitle. You mi
216 } 216 }
217 #endif 217 #endif
218 218
219 void CommandLine::Reset() { 219 void CommandLine::Reset() {
220 DCHECK(current_process_commandline_ != NULL); 220 DCHECK(current_process_commandline_ != NULL);
221 delete current_process_commandline_; 221 delete current_process_commandline_;
222 current_process_commandline_ = NULL; 222 current_process_commandline_ = NULL;
223 } 223 }
224 224
225 bool CommandLine::HasSwitch(const std::string& switch_string) const { 225 bool CommandLine::HasSwitch(const std::string& switch_string) const {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { 393 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) {
394 // The wrapper may have embedded arguments (like "gdb --args"). In this case, 394 // The wrapper may have embedded arguments (like "gdb --args"). In this case,
395 // we don't pretend to do anything fancy, we just split on spaces. 395 // we don't pretend to do anything fancy, we just split on spaces.
396 const std::string wrapper = base::SysWideToNativeMB(wrapper_wide); 396 const std::string wrapper = base::SysWideToNativeMB(wrapper_wide);
397 std::vector<std::string> wrapper_and_args; 397 std::vector<std::string> wrapper_and_args;
398 SplitString(wrapper, ' ', &wrapper_and_args); 398 SplitString(wrapper, ' ', &wrapper_and_args);
399 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); 399 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end());
400 } 400 }
401 401
402 #endif 402 #endif
OLDNEW
« no previous file with comments | « base/command_line.h ('k') | base/debug_util_posix.cc » ('j') | base/file_util_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698