]> git.droids-corp.org - dpdk.git/blobdiff - app/test-pmd/cmdline.c
app/testpmd: load commands from file at startup
[dpdk.git] / app / test-pmd / cmdline.c
index f6bd75b78f55569d7060c93a75fb4872dc94be69..e7418828fea882655bec57ef3aa493e0957f0c20 100644 (file)
@@ -13720,6 +13720,27 @@ cmdline_parse_ctx_t main_ctx[] = {
        NULL,
 };
 
+/* read cmdline commands from file */
+void
+cmdline_read_from_file(const char *filename)
+{
+       struct cmdline *cl;
+
+       cl = cmdline_file_new(main_ctx, "testpmd> ", filename);
+       if (cl == NULL) {
+               printf("Failed to create file based cmdline context: %s\n",
+                      filename);
+               return;
+       }
+
+       cmdline_interact(cl);
+       cmdline_quit(cl);
+
+       cmdline_free(cl);
+
+       printf("Read CLI commands from %s\n", filename);
+}
+
 /* prompt function, called from main on MASTER lcore */
 void
 prompt(void)