[dpdk-dev] [PATCH v1] app/testpmd: support command echo in CLI batch loading
Xueming Li
xuemingl at mellanox.com
Tue Dec 26 15:25:55 CET 2017
Use first bit of verbose_level to enable CLI echo of batch loading.
Signed-off-by: Xueming Li <xuemingl at mellanox.com>
---
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 <termios.h>
#include <unistd.h>
#include <inttypes.h>
+#include <fcntl.h>
#ifndef __linux__
#ifndef __FreeBSD__
#include <net/socket.h>
@@ -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);
--
2.13.3
More information about the dev
mailing list