diff options
author | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 01:44:23 +0000 |
---|---|---|
committer | garykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 01:44:23 +0000 |
commit | 0c1195cdd9b3da27748776d109b25bfd71a22ffc (patch) | |
tree | a9027c8abfe2132f4b645cb3957d4bc43acb7afe /remoting/host | |
parent | 85546bf0e8e7ccc43784997279ffe131628ec062 (diff) | |
download | chromium_src-0c1195cdd9b3da27748776d109b25bfd71a22ffc.zip chromium_src-0c1195cdd9b3da27748776d109b25bfd71a22ffc.tar.gz chromium_src-0c1195cdd9b3da27748776d109b25bfd71a22ffc.tar.bz2 |
Extract auth token into separate .chromotingAuthToken file so it can be re-used.
Modify chromoting_simple_host to accept cmd-line args for jid and auth-token.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2757006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49484 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/simple_host_process.cc | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index d7f454c..79db106 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -70,19 +70,46 @@ void SetConsoleEcho(bool on) { int main(int argc, char** argv) { base::AtExitManager exit_manager; + std::string username; + std::string auth_token; + // Check the argument to see if we should use a fake capturer and encoder. bool fake = false; - if (argc > 1 && std::string(argv[1]) == "--fake") { - fake = true; + // True if the JID was specified on the command line. + bool has_jid = false; + // True if the auth token was specified on the command line. + bool has_auth = false; + + for (int i = 1; i < argc; i++) { + std::string arg = argv[i]; + if (arg == "--fake") { + fake = true; + } else if (arg == "--jid") { + if (++i >= argc) { + std::cerr << "Expected JID to follow --jid option" << std::endl; + return 1; + } + has_jid = true; + username = argv[i]; + } else if (arg == "--auth") { + if (++i >= argc) { + std::cerr << "Expected auth token to follow --auth option" << std::endl; + return 1; + } + has_auth = true; + auth_token = argv[i]; + } } // Prompt user for username and auth token. - std::string username; - std::cout << "JID: "; - std::cin >> username; - std::string auth_token; - std::cout << "Auth Token: "; - std::cin >> auth_token; + if (!has_jid) { + std::cout << "JID: "; + std::cin >> username; + } + if (!has_auth) { + std::cout << "Auth Token: "; + std::cin >> auth_token; + } scoped_ptr<remoting::Capturer> capturer; scoped_ptr<remoting::Encoder> encoder; |