From patchwork Tue Dec 26 14:25:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 32755 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EBA041B33D; Tue, 26 Dec 2017 15:26:33 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 0F2AF1B29C for ; Tue, 26 Dec 2017 15:26:31 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 26 Dec 2017 16:26:28 +0200 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id vBQEQRd0024551; Tue, 26 Dec 2017 16:26:28 +0200 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id vBQEQQl2156178; Tue, 26 Dec 2017 22:26:26 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id vBQEQKIb156169; Tue, 26 Dec 2017 22:26:20 +0800 From: Xueming Li To: Cc: Xueming Li , Jingjing Wu , dev@dpdk.org, Olivier MATZ , Burakov Anatoly Date: Tue, 26 Dec 2017 22:25:55 +0800 Message-Id: <20171226142555.156122-1-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171115154545.8936-2-xuemingl@mellanox.com> References: <20171115154545.8936-2-xuemingl@mellanox.com> Subject: [dpdk-dev] [PATCH v1] app/testpmd: support command echo in CLI batch loading X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use first bit of verbose_level to enable CLI echo of batch loading. Signed-off-by: Xueming Li --- app/test-pmd/cmdline.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d96301..0c58dea7b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -40,6 +40,7 @@ #include #include #include +#include #ifndef __linux__ #ifndef __FreeBSD__ #include @@ -15776,9 +15777,19 @@ cmdline_parse_ctx_t main_ctx[] = { void cmdline_read_from_file(const char *filename) { + int fd; struct cmdline *cl; - cl = cmdline_file_new(main_ctx, "testpmd> ", filename); + if (!filename) + return; + fd = open(filename, O_RDONLY, 0); + if (fd < 0) { + printf("File open() failed\n"); + return; + } + + cl = cmdline_new(main_ctx, "testpmd> ", fd, + verbose_level & 0x8000 ? STDOUT_FILENO : -1); if (cl == NULL) { printf("Failed to create file based cmdline context: %s\n", filename);