From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com,
david.hunt@intel.com
Subject: [dpdk-dev] [RFC 6/7] l2fwd: rework long options parsing
Date: Mon, 19 Sep 2016 15:42:46 +0200 [thread overview]
Message-ID: <1474292567-21912-7-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1474292567-21912-1-git-send-email-olivier.matz@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
examples/l2fwd/main.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 41ac1e1..028900b 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -376,6 +376,24 @@ l2fwd_parse_timer_period(const char *q_arg)
return n;
}
+static const char short_options[] =
+ "p:" /* portmask */
+ "q:" /* number of queues */
+ "T:" /* timer period */
+ ;
+
+enum {
+ /* long options mapped to a short option */
+
+ /* first long only option value must be >= 256, so that we won't
+ * conflict with short options */
+ CMD_LINE_OPT_MIN_NUM = 256,
+};
+
+static const struct option lgopts[] = {
+ {NULL, 0, 0, 0}
+};
+
/* Parse the argument given in the command line of the application */
static int
l2fwd_parse_args(int argc, char **argv)
@@ -384,9 +402,6 @@ l2fwd_parse_args(int argc, char **argv)
char **argvopt;
int option_index;
char *prgname = argv[0];
- static struct option lgopts[] = {
- {NULL, 0, 0, 0}
- };
argvopt = argv;
@@ -425,11 +440,6 @@ l2fwd_parse_args(int argc, char **argv)
timer_period = timer_secs;
break;
- /* long options */
- case 0:
- l2fwd_usage(prgname);
- return -1;
-
default:
l2fwd_usage(prgname);
return -1;
--
2.8.1
next prev parent reply other threads:[~2016-09-19 13:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 13:42 [dpdk-dev] [RFC 0/7] changing mbuf pool handler Olivier Matz
2016-09-19 13:42 ` [dpdk-dev] [RFC 1/7] mbuf: set the handler at mbuf pool creation Olivier Matz
2016-09-19 13:42 ` [dpdk-dev] [RFC 2/7] mbuf: use helper to create the pool Olivier Matz
2017-01-16 15:30 ` Santosh Shukla
2017-01-31 10:31 ` Olivier Matz
2016-09-19 13:42 ` [dpdk-dev] [RFC 3/7] testpmd: new parameter to set mbuf pool ops Olivier Matz
2016-09-19 13:42 ` [dpdk-dev] [RFC 4/7] l3fwd: rework long options parsing Olivier Matz
2016-09-19 13:42 ` [dpdk-dev] [RFC 5/7] l3fwd: new parameter to set mbuf pool ops Olivier Matz
2016-09-19 13:42 ` Olivier Matz [this message]
2016-09-19 13:42 ` [dpdk-dev] [RFC 7/7] l2fwd: " Olivier Matz
2016-09-22 11:52 ` [dpdk-dev] [RFC 0/7] changing mbuf pool handler Hemant Agrawal
2016-10-03 15:49 ` Olivier Matz
2016-10-05 9:41 ` Hunt, David
2016-10-05 11:49 ` Hemant Agrawal
2016-10-05 13:15 ` Hunt, David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474292567-21912-7-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz@6wind.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jerin.jacob@caviumnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).