X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=utilities%2Fovs-benchmark.c;h=0bb316f30af7df0f73c7d92cf78d28f3b76ee5d2;hb=c5cf10598f8c9f4428291e9df3ecd72a05fb1ccf;hp=8bea9f085ac402b184115ee8151f18bd10edee82;hpb=d5155945e03ffef6ff4de05d1ec5dfd0951e0860;p=sliver-openvswitch.git diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index 8bea9f085..0bb316f30 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -49,7 +49,7 @@ static double max_rate; static double timeout; -static const struct command all_commands[]; +static const struct command *get_all_commands(void); static void parse_options(int argc, char *argv[]); static void usage(void); @@ -72,7 +72,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER); parse_options(argc, argv); - run_command(argc - optind, argv + optind, all_commands); + run_command(argc - optind, argv + optind, get_all_commands()); return 0; } @@ -101,11 +101,11 @@ parse_target(const char *s_, struct in_addr *addr, *min = *max = 0; if (colon && colon[1] != '\0') { const char *ports = colon + 1; - if (sscanf(ports, "%hu-%hu", min, max) == 2) { + if (ovs_scan(ports, "%hu-%hu", min, max)) { if (*min > *max) { ovs_fatal(0, "%s: minimum is greater than maximum", s_); } - } else if (sscanf(ports, "%hu", min) == 1) { + } else if (ovs_scan(ports, "%hu", min)) { *max = *min; } else { ovs_fatal(0, "%s: number or range expected", s_); @@ -118,7 +118,7 @@ parse_target(const char *s_, struct in_addr *addr, static void parse_options(int argc, char *argv[]) { - static struct option long_options[] = { + static const struct option long_options[] = { {"local", required_argument, NULL, 'l'}, {"remote", required_argument, NULL, 'r'}, {"batches", required_argument, NULL, 'b'}, @@ -617,3 +617,8 @@ static const struct command all_commands[] = { { "help", 0, 0, cmd_help }, { NULL, 0, 0, NULL }, }; + +static const struct command *get_all_commands(void) +{ + return all_commands; +}