diff options
author | Christophe Milard <christophe.milard@linaro.org> | 2016-04-14 15:56:47 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-05-23 15:06:59 +0300 |
commit | 86315b84bb3876636c59b4e2d75da996e74da3cd (patch) | |
tree | e9bd4a532983cc2f93b56a6e90312eff3da209ff /example | |
parent | b5e4ed8b0f592a7b51fd2e494bf4af0d2d6f189c (diff) |
example: classifier: adding helper cmd line parsing
odp_classifier now calls the helper command line parsing so that helper
can collect its options. Hence enabling process mode run.
Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
Reviewed-by: Brian Brooks <brian.brooks@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'example')
-rw-r--r-- | example/classifier/odp_classifier.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 598244600..20e64ece3 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -792,7 +792,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) int interface = 0; int policy = 0; - static struct option longopts[] = { + static const struct option longopts[] = { {"count", required_argument, NULL, 'c'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ {"policy", required_argument, NULL, 'p'}, /* return 'p' */ @@ -802,10 +802,16 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} }; + static const char *shortopts = "+c:t:i:p:m:t:h"; + + /* let helper collect its own arguments (e.g. --odph_proc) */ + odph_parse_options(argc, argv, shortopts, longopts); + + opterr = 0; /* do not issue errors on helper options */ while (1) { - opt = getopt_long(argc, argv, "+c:t:i:p:m:t:h", - longopts, &long_index); + opt = getopt_long(argc, argv, shortopts, + longopts, &long_index); if (opt == -1) break; /* No more options */ |