getsubopt

【原创】memcached 中的命令行参数解析

妖精的绣舞 提交于 2019-12-03 04:40:40
本文主要是以 memcached 源码为例,讲解如何在 linux 下解析命令行参数。 安装 memcached 后,查看其可用选项: [root@Betty ~]# memcached -h memcached 1.4.14 -p <num> TCP port number to listen on (default: 11211) -U <num> UDP port number to listen on (default: 11211, 0 is off) -s <file> UNIX socket path to listen on (disables network support) -a <mask> access mask for UNIX socket, in octal (default: 0700) -l <addr> interface to listen on (default: INADDR_ANY, all addresses) <addr> may be specified as host:port. If you don't specify a port number, the value you specified with -p or -U is used. You may specify multiple addresses separated