Fix lexical_cast handling of port command line argument.

This commit is contained in:
chris_kohlhoff 2005-10-03 09:19:04 +00:00
parent c7364276d9
commit 012e97b5f0
2 changed files with 10 additions and 2 deletions

View File

@ -17,7 +17,7 @@ int main(int argc, char* argv[])
std::cerr << "Usage: http_server <port> <doc_root>\n";
return 1;
}
short port = boost::lexical_cast<short>(argv[1]);
unsigned short port = boost::lexical_cast<unsigned short>(argv[1]);
std::string doc_root = argv[2];
// Block all signals for background thread.
@ -51,6 +51,10 @@ int main(int argc, char* argv[])
{
std::cerr << "asio error: " << e << "\n";
}
catch (std::exception& e)
{
std::cerr << "exception: " << e.what() << "\n";
}
return 0;
}

View File

@ -33,7 +33,7 @@ int main(int argc, char* argv[])
std::cerr << "Usage: http_server <port> <doc_root>\n";
return 1;
}
short port = boost::lexical_cast<short>(argv[1]);
unsigned short port = boost::lexical_cast<unsigned short>(argv[1]);
std::string doc_root = argv[2];
// Initialise server.
@ -50,6 +50,10 @@ int main(int argc, char* argv[])
{
std::cerr << "asio error: " << e << "\n";
}
catch (std::exception& e)
{
std::cerr << "exception: " << e.what() << "\n";
}
return 0;
}