diff options
author | Florin Coras <fcoras@cisco.com> | 2022-01-11 13:58:54 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-01-11 22:54:15 +0000 |
commit | 406669e7cdb0d94400089439576f38731ee97f13 (patch) | |
tree | 496243c7e93bc2f3f3826ca55596fa5cf077ebcf /src/plugins/hs_apps/vcl/vcl_test_server.c | |
parent | 1705a6baefe205bb6792b547c7376eee3f328a71 (diff) |
hsa: allow use of default port for vcl test apps
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I30ec7af3baf56d74a5050ea9335053e6e12de630
Diffstat (limited to 'src/plugins/hs_apps/vcl/vcl_test_server.c')
-rw-r--r-- | src/plugins/hs_apps/vcl/vcl_test_server.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/hs_apps/vcl/vcl_test_server.c b/src/plugins/hs_apps/vcl/vcl_test_server.c index 93c244484c8..2abb9924e70 100644 --- a/src/plugins/hs_apps/vcl/vcl_test_server.c +++ b/src/plugins/hs_apps/vcl/vcl_test_server.c @@ -502,18 +502,20 @@ vcl_test_server_process_opts (vcl_test_server_main_t * vsm, int argc, print_usage_and_exit (); } - if (argc < (optind + 1)) + if (argc > (optind + 1)) { - fprintf (stderr, "SERVER: ERROR: Insufficient number of arguments!\n"); + fprintf (stderr, "Incorrect number of arguments!\n"); print_usage_and_exit (); } - - if (sscanf (argv[optind], "%d", &v) == 1) - vsm->server_cfg.port = (uint16_t) v; - else + else if (argc > 1 && argc == (optind + 1)) { - fprintf (stderr, "SERVER: ERROR: Invalid port (%s)!\n", argv[optind]); - print_usage_and_exit (); + if (sscanf (argv[optind], "%d", &v) == 1) + vsm->server_cfg.port = (uint16_t) v; + else + { + fprintf (stderr, "Invalid port (%s)!\n", argv[optind]); + print_usage_and_exit (); + } } vcl_test_init_endpoint_addr (vsm); |