From patchwork Thu May 19 16:27:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68157 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3279089qge; Thu, 19 May 2016 08:50:53 -0700 (PDT) X-Received: by 10.140.29.97 with SMTP id a88mr14693864qga.45.1463673053635; Thu, 19 May 2016 08:50:53 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r4si13180068qkd.50.2016.05.19.08.50.53; Thu, 19 May 2016 08:50:53 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 57C7061676; Thu, 19 May 2016 15:50:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1D20B618E5; Thu, 19 May 2016 15:32:33 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 88DC661813; Thu, 19 May 2016 15:32:22 +0000 (UTC) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by lists.linaro.org (Postfix) with ESMTPS id 154FA61818 for ; Thu, 19 May 2016 15:28:56 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id n11so25937876lbh.1 for ; Thu, 19 May 2016 08:28:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tYa8qlcn3ubZQgq7eQg1f9MS+aMZCFLK2LZ9CASfNAg=; b=M51AT3yCCit2BldLEvzygM5fq4eysaEdz7XV3VctWIlWTCVhlxTpTFUE1+hz+FT7mg kTui7x/5df4sePgithwqQtSzNKtTxYP8NWEgqT9IMY9o7XKeouwK5O8NxtUPlorInqi7 74pTxaWkhghmP++xppJGSa1+FZaKYvEUzKBcVs4IEYAplrgV2riaCI5j26z/83lUlUef QbpWcG2W3+B31tgbyQ0qWPlbhxD+q875BuvPSSzhJ2XiRBBfKXzgvMR53KgmlcvaqxjQ tjqkNnaRnr8/MbdZb3T2vhr/KzHXqMLvkCGXAMf5MXrSx8U+WgZbo8kmIpCyIfR13uGh u2/w== X-Gm-Message-State: AOPr4FXpr+7ic6Mr0erVU6fjwZ2ERFrbHClk+N8hGyJms+WjzKJ1tFb5GU9DySS9QWU2LCZWqTk= X-Received: by 10.112.43.225 with SMTP id z1mr3434199lbl.14.1463671735049; Thu, 19 May 2016 08:28:55 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id cv11sm2366290lbb.49.2016.05.19.08.28.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 08:28:54 -0700 (PDT) From: Christophe Milard To: brian.brooks@linaro.org, maxim.uvarov@linaro.com, lng-odp@lists.linaro.org Date: Thu, 19 May 2016 18:27:05 +0200 Message-Id: <1463675234-6739-27-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463675234-6739-1-git-send-email-christophe.milard@linaro.org> References: <1463675234-6739-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv8 26/35] example: pktio: adding helper cmd line parsing X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" pktio now calls the helper command line parsing so that helper can collect its options. Hence enabling process mode run. Signed-off-by: Christophe Milard --- example/packet/odp_pktio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index f500cf0..9028ab2 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -559,8 +559,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) char *token; size_t len; int i; - - static struct option longopts[] = { + static const struct option longopts[] = { {"count", required_argument, NULL, 'c'}, {"time", required_argument, NULL, 't'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ @@ -569,12 +568,18 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} }; + static const char *shortopts = "+c:i:+m:t:h"; + + /* let helper collect its own arguments (e.g. --odph_proc) */ + odph_parse_options(argc, argv, shortopts, longopts); + appl_args->mode = APPL_MODE_PKT_SCHED; appl_args->time = 0; /**< loop forever */ + opterr = 0; /* do not issue errors on helper options */ + while (1) { - opt = getopt_long(argc, argv, "+c:i:+m:t:h", - longopts, &long_index); + opt = getopt_long(argc, argv, shortopts, longopts, &long_index); if (opt == -1) break; /* No more options */