made port non-optional for -S <port> ....

This is because the gnu getopt extension for optional arguments is very confusing:  -S7022 is accepted but -S 7022 is not.

Switching to non-optional will save the confusion.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6006 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-12-17 20:34:38 +00:00
parent 5803a5ab65
commit ab01e46f44

View File

@ -109,12 +109,12 @@ int main(int argc, char **argv)
std::string sshUser = "user";
std::string sshPwdHash = "";
std::string sshRsaFile = "";
std::string sshPortStr = "7022";
std::string sshPortStr = "0";
uint16_t extPort = 0;
bool extPortSet = false;
while((c = getopt(argc, argv,"ChTL:P:K:GS::E:")) != -1)
while((c = getopt(argc, argv,"ChTL:P:K:GS:E:")) != -1)
{
switch(c)
{
@ -124,10 +124,7 @@ int main(int argc, char **argv)
break;
case 'S':
enableSsh = true;
if (optarg)
{
sshPortStr = optarg; // optional.
}
sshPortStr = optarg; // no longer optional.
strictCheck = false;
break;
case 'E':
@ -168,7 +165,7 @@ int main(int argc, char **argv)
std::cerr << "Specific Help Options: " << std::endl;
std::cerr << "\t-G Generate a Password Hash for SSH Server" << std::endl;
std::cerr << "\t-T Enable Terminal Interface" << std::endl;
std::cerr << "\t-S [port] Enable SSH Server, optionally specify port" << std::endl;
std::cerr << "\t-S <port> Enable SSH Server on specified port" << std::endl;
std::cerr << "\t-E <port> Specify Alternative External Port (provided to Clients)" << std::endl;
std::cerr << "\t-L <user> Specify SSH login user (default:user)" << std::endl;
std::cerr << "\t-P <pwdhash> Enable SSH login via Password" << std::endl;