diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-09-22 16:29:15 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-09-22 16:29:15 -0400 |
commit | 23ac7eaad399b66ed86a770a4975467d31e72ed0 (patch) | |
tree | b8ba9f3400ba60d99e17151b57e911a3fec6b81f /shell | |
parent | 1f7a4668a5e1d56ac2ff3e37476608787426f4c2 (diff) | |
download | mongo-23ac7eaad399b66ed86a770a4975467d31e72ed0.tar.gz |
handle ./mongo localhost:1000 - make it go to port 1000
Diffstat (limited to 'shell')
-rw-r--r-- | shell/dbshell.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp index 5bdcb3afbae..633ffcd23d8 100644 --- a/shell/dbshell.cpp +++ b/shell/dbshell.cpp @@ -122,9 +122,18 @@ inline void setupSignals() {} #endif string fixHost( string url , string host , string port ){ + //cout << "fixHost url: " << url << " host: " << host << " port: " << port << endl; + if ( host.size() == 0 && port.size() == 0 ){ - if ( url.find( "/" ) == string::npos && url.find( "." ) != string::npos ) - return url + "/test"; + if ( url.find( "/" ) == string::npos ){ + // check for ips + if ( url.find( "." ) != string::npos ) + return url + "/test"; + + if ( url.find( ":" ) != string::npos && + isdigit( url[url.find(":")+1] ) ) + return url + "/test"; + } return url; } |