OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <errno.h> | 5 #include <errno.h> |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <sys/wait.h> | 8 #include <sys/wait.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // Note that 0 is a valid port (used for dynamic port allocation). | 399 // Note that 0 is a valid port (used for dynamic port allocation). |
400 if (!base::StringToInt(s, &value) || value < 0 || | 400 if (!base::StringToInt(s, &value) || value < 0 || |
401 value > std::numeric_limits<uint16>::max()) { | 401 value > std::numeric_limits<uint16>::max()) { |
402 LOG(ERROR) << "Could not convert string " << s << " to port"; | 402 LOG(ERROR) << "Could not convert string " << s << " to port"; |
403 ExitWithUsage(); | 403 ExitWithUsage(); |
404 } | 404 } |
405 return value; | 405 return value; |
406 } | 406 } |
407 | 407 |
408 int RunHostForwarder(int argc, char** argv) { | 408 int RunHostForwarder(int argc, char** argv) { |
409 CommandLine::Init(argc, argv); | 409 base::CommandLine::Init(argc, argv); |
410 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 410 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); |
411 bool kill_server = false; | 411 bool kill_server = false; |
412 | 412 |
413 Pickle pickle; | 413 Pickle pickle; |
414 pickle.WriteString( | 414 pickle.WriteString( |
415 cmd_line.HasSwitch("serial-id") ? | 415 cmd_line.HasSwitch("serial-id") ? |
416 cmd_line.GetSwitchValueASCII("serial-id") : std::string()); | 416 cmd_line.GetSwitchValueASCII("serial-id") : std::string()); |
417 | 417 |
418 const std::vector<std::string> args = cmd_line.GetArgs(); | 418 const std::vector<std::string> args = cmd_line.GetArgs(); |
419 if (cmd_line.HasSwitch("kill-server")) { | 419 if (cmd_line.HasSwitch("kill-server")) { |
420 kill_server = true; | 420 kill_server = true; |
(...skipping 27 matching lines...) Expand all Loading... |
448 | 448 |
449 return client_delegate.has_failed() || daemon_delegate.has_failed(); | 449 return client_delegate.has_failed() || daemon_delegate.has_failed(); |
450 } | 450 } |
451 | 451 |
452 } // namespace | 452 } // namespace |
453 } // namespace forwarder2 | 453 } // namespace forwarder2 |
454 | 454 |
455 int main(int argc, char** argv) { | 455 int main(int argc, char** argv) { |
456 return forwarder2::RunHostForwarder(argc, argv); | 456 return forwarder2::RunHostForwarder(argc, argv); |
457 } | 457 } |
OLD | NEW |