From patchwork Thu May 19 16:26:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 68148 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3277225qge; Thu, 19 May 2016 08:46:58 -0700 (PDT) X-Received: by 10.140.108.116 with SMTP id i107mr14098523qgf.36.1463672818158; Thu, 19 May 2016 08:46:58 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s190si3800003qkf.74.2016.05.19.08.46.57; Thu, 19 May 2016 08:46:58 -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 BCD5E617F3; Thu, 19 May 2016 15:46:57 +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 7096261873; Thu, 19 May 2016 15:31:53 +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 888D5618BF; Thu, 19 May 2016 15:31:45 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id E4B6D6180B for ; Thu, 19 May 2016 15:28:47 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id m64so38675830lfd.1 for ; Thu, 19 May 2016 08:28:47 -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=mLNN8pqAImtCN7Ic3yrl3WTbefH/oZUptMuTpI0QCwk=; b=hkGh8BcGhjwZFywk417OXnZsXOuYdHre18kqyDJMf3lrWaXDi2128jA21W5oderv0D JrYLDMrdmRzfOBA28+zHG3fpiXELYvByi96iGuSWXiswAtv0K5KsUnXXcbwD8DcPqXMx r1ToRnKu/Gtxx+78DVn2teEuCg4SWnw/ap6sze6/dEKZIBYx1yeGTA/ylyXhSzK2AZz2 5wAyByU4JwVrbWjvgEQaxe/WxCQ2d5rlHPVp1hdYOdLIBp4lyCQ0KEH/XIOzTXLnYYhF W5cvUcTmKqM0CLDlDkLOk9Ayj1GwuVQfWaz/mv8SNYX8Fi77S+2nwuaCC38hxKwhW495 Tbng== X-Gm-Message-State: AOPr4FX/RqE3kxzKgafMlhvZwGDq/RQSeo7/bUTmzRSrGM7YrEasNj7IWfS3z0x1/IshZUvixyc= X-Received: by 10.25.210.144 with SMTP id j138mr4358190lfg.77.1463671726902; Thu, 19 May 2016 08:28:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 08:28:46 -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:26:57 +0200 Message-Id: <1463675234-6739-19-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 18/35] example: classifier: 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" 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 --- example/classifier/odp_classifier.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 5982446..20e64ec 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 */