From patchwork Fri Dec 8 08:22:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 32019 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 5F5FF2E83; Fri, 8 Dec 2017 09:23:08 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 87C7A2E83 for ; Fri, 8 Dec 2017 09:23:06 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Dec 2017 10:23:03 +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 vB88N2L3001013; Fri, 8 Dec 2017 10:23:03 +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 vB88N2cV045168; Fri, 8 Dec 2017 16:23:02 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id vB88N2iY045167; Fri, 8 Dec 2017 16:23:02 +0800 From: Xueming Li To: Wu Jingjing , Harry van Haaren Cc: Xueming Li , dev@dpdk.org Date: Fri, 8 Dec 2017 16:22:17 +0800 Message-Id: <20171208082225.44913-2-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171208082225.44913-1-xuemingl@mellanox.com> References: <20171208082225.44913-1-xuemingl@mellanox.com> In-Reply-To: <20171019140649.26668-2-xuemingl@mellanox.com> References: <20171019140649.26668-2-xuemingl@mellanox.com> Subject: [dpdk-dev] [RFC v1 1/9] lib/cmdline: add echo support in batch loading from file 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" Add echo option to echo commandline to screen when running loaded scripts from file. Signed-off-by: Xueming Li --- lib/librte_cmdline/cmdline_socket.c | 5 +++-- lib/librte_cmdline/cmdline_socket.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/librte_cmdline/cmdline_socket.c b/lib/librte_cmdline/cmdline_socket.c index 3fc243b70..e57ddeffb 100644 --- a/lib/librte_cmdline/cmdline_socket.c +++ b/lib/librte_cmdline/cmdline_socket.c @@ -73,7 +73,8 @@ #include "cmdline.h" struct cmdline * -cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path) +cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path, + int echo) { int fd; @@ -86,7 +87,7 @@ cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path) dprintf("open() failed\n"); return NULL; } - return cmdline_new(ctx, prompt, fd, -1); + return cmdline_new(ctx, prompt, fd, echo ? 1 : -1); } struct cmdline * diff --git a/lib/librte_cmdline/cmdline_socket.h b/lib/librte_cmdline/cmdline_socket.h index aa6068e7e..208134b12 100644 --- a/lib/librte_cmdline/cmdline_socket.h +++ b/lib/librte_cmdline/cmdline_socket.h @@ -68,7 +68,8 @@ extern "C" { #endif -struct cmdline *cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path); +struct cmdline *cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, + const char *path, int echo); struct cmdline *cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt); void cmdline_stdin_exit(struct cmdline *cl);