[dpdk-dev] [RFC v1 1/9] lib/cmdline: add echo support in batch loading from file

Xueming Li xuemingl at mellanox.com
Fri Dec 8 09:22:17 CET 2017


Add echo option to echo commandline to screen when running loaded
scripts from file.

Signed-off-by: Xueming Li <xuemingl at mellanox.com>
---
 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



More information about the dev mailing list