Metaswitch/sprout — pull request #808 by rkday (2014-10-07 21:39:22+00:00)
Title: Use a --option=value format to better catch missing command-line arguments

Fixes #803.

These were both caused by the fact that getopt_long treats "--option --otheroption" as "--option with a value of '--otheroption'", not "--option with no value, and --otheroption with no value". So missing a Homestead hostname got "--hss --chronos" (so getopt didn't see a --chronos option and complained about that).

This pull request switches to the --option=value syntax. "--option= --otheroption=" *is* treated as "--option with no value, and --otheroption with no value", so that's OK. If you're happy with this I'll create similar ones for homestead, chronos, ralf, bono and memento-http.

Tested by:
* starting up Sprout and checking I got the expected LOG_INFO messages about startup
* deleting the hs_hostname and checking for the "S/I-CSCF enabled with no Homestead server" log as expected

Success:

```
07-10-2014 21:08:09.728 UTC Status main.cpp:1048: Access logging enabled to /var/log/sprout
07-10-2014 21:08:09.728 UTC Status main.cpp:1052: Log level set to 5
07-10-2014 21:08:09.728 UTC Info main.cpp:1062: Command-line options were: /usr/share/clearwater/bin/sprout --domain=example.com --localhost=10.0.2.15 --realm=example.com --memstore=/etc/clearwater/cluster_settings --hss=10.0.2.15:8888 -\
-chronos=localhost --xdms=10.0.2.15:7888 --sas=0.0.0.0,sprout@10.0.2.15 --pjsip-threads=1 --worker-threads=50 --record-routing-model=pcscf --default-session-expires=600 --authentication --http_address=10.0.2.15 --http_port=9888 --analyti\
cs=/var/log/sprout --log-file=/var/log/sprout --log-level=5 --scscf=5054 --scscf_uri=sip:10.0.2.15:5054;transport=TCP
07-10-2014 21:08:09.728 UTC Info main.cpp:467: Override home domain set to example.com
07-10-2014 21:08:09.728 UTC Info main.cpp:447: Override private and public local host names 10.0.2.15
07-10-2014 21:08:09.728 UTC Info main.cpp:524: Authentication realm example.com
07-10-2014 21:08:09.728 UTC Info main.cpp:529: Using memcached store with configuration file /etc/clearwater/cluster_settings
07-10-2014 21:08:09.728 UTC Info main.cpp:557: HSS server set to 10.0.2.15:8888
07-10-2014 21:08:09.728 UTC Info main.cpp:567: Chronos service set to localhost
07-10-2014 21:08:09.728 UTC Info main.cpp:562: XDM server set to 10.0.2.15:7888
07-10-2014 21:08:09.728 UTC Info main.cpp:545: SAS set to 0.0.0.0
07-10-2014 21:08:09.728 UTC Info main.cpp:546: System name is set to sprout@10.0.2.15
07-10-2014 21:08:09.728 UTC Info main.cpp:640: Use 1 PJSIP threads
07-10-2014 21:08:09.728 UTC Info main.cpp:645: Use 50 worker threads
07-10-2014 21:08:09.728 UTC Info main.cpp:435: Record-Routing model is set to 1
07-10-2014 21:08:09.728 UTC Info main.cpp:697: Default session expiry set to 600
07-10-2014 21:08:09.728 UTC Info main.cpp:656: Authentication enabled
07-10-2014 21:08:09.728 UTC Info main.cpp:661: HTTP address set to 10.0.2.15
07-10-2014 21:08:09.728 UTC Info main.cpp:668: HTTP port set to 9888
07-10-2014 21:08:09.728 UTC Info main.cpp:651: Analytics directory set to /var/log/sprout
07-10-2014 21:08:09.728 UTC Info main.cpp:380: S-CSCF enabled on port 5054
07-10-2014 21:08:09.728 UTC Info main.cpp:477: Override sprout cluster URI set to sip:10.0.2.15:5054;transport=TCP
```

Deliberate bug:

```
07-10-2014 21:08:01.740 UTC Info main.cpp:1062: Command-line options were: /usr/share/clearwater/bin/sprout --domain=example.com --localhost=10.0.2.15 --realm=example.com --memstore=/etc/clearwater/cluster_settings --hss= --chronos=local\
host --xdms=10.0.2.15:7888 --sas=0.0.0.0,sprout@10.0.2.15 --pjsip-threads=1 --worker-threads=50 --record-routing-model=pcscf --default-session-expires=600 --authentication --http_address=10.0.2.15 --http_port=9888 --analytics=/var/log/sp\
rout --log-file=/var/log/sprout --log-level=5 --scscf=5054 --scscf_uri=sip:10.0.2.15:5054;transport=TCP
...
07-10-2014 21:08:01.740 UTC Error main.cpp:1111: S/I-CSCF enabled with no Homestead server
```