From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 152AC1B1B6 for ; Wed, 15 Nov 2017 16:46:32 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 15 Nov 2017 17:46:26 +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 vAFFkPCu005012; Wed, 15 Nov 2017 17:46:26 +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 vAFFkPcF008997; Wed, 15 Nov 2017 23:46:25 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id vAFFkPhL008996; Wed, 15 Nov 2017 23:46:25 +0800 From: Xueming Li To: Olivier Matz , Jingjing Wu Cc: Xueming Li , dev@dpdk.org Date: Wed, 15 Nov 2017 23:45:43 +0800 Message-Id: <20171115154545.8936-2-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171115154545.8936-1-xuemingl@mellanox.com> References: <20171115154545.8936-1-xuemingl@mellanox.com> Subject: [dpdk-dev] [PATCH 1/3] 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: , X-List-Received-Date: Wed, 15 Nov 2017 15:46:33 -0000 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); -- 2.13.3