MCPcopy Create free account
hub / github.com/chenshuo/muduo / parseCommandLine

Function parseCommandLine

examples/memcached/server/server.cc:12–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace muduo::net;
11
12bool parseCommandLine(int argc, char* argv[], MemcacheServer::Options* options)
13{
14 options->tcpport = 11211;
15 options->gperfport = 11212;
16 options->threads = 4;
17
18 po::options_description desc("Allowed options");
19 desc.add_options()
20 ("help,h", "Help")
21 ("port,p", po::value<uint16_t>(&options->tcpport), "TCP port")
22 ("udpport,U", po::value<uint16_t>(&options->udpport), "UDP port")
23 ("gperf,g", po::value<uint16_t>(&options->gperfport), "port for gperftools")
24 ("threads,t", po::value<int>(&options->threads), "Number of worker threads")
25 ;
26
27 po::variables_map vm;
28 po::store(po::parse_command_line(argc, argv, desc), vm);
29 po::notify(vm);
30
31 if (vm.count("help"))
32 {
33 //printf("memcached 1.1.0\n");
34 return false;
35 }
36 return true;
37}
38
39int main(int argc, char* argv[])
40{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected