Tools/NetTest - Add a runner to test networking stack
[tpg/acess2.git] / Tools / NetTest / mode_cmdline.c
diff --git a/Tools/NetTest/mode_cmdline.c b/Tools/NetTest/mode_cmdline.c
new file mode 100644 (file)
index 0000000..5a17517
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ */
+#include <nettest.h>
+#include <stdio.h>
+#include <string.h>
+
+// === CODE ===
+void NetTest_Suite_Cmdline(void)
+{
+       char line[BUFSIZ];
+       while( fgets(line, sizeof(line)-1, stdin) )
+       {
+               const char *cmd = strtok(line, " ");
+               if(!cmd)
+                       continue;
+               if( strcmp(cmd, "exit") == 0 ) {
+                       return ;
+               }
+               else if( strcmp(cmd, "request") == 0 ) {
+                       //const char *addr = strtok(NULL, " ");
+                       
+               }
+               else {
+                       fprintf(stderr, "ERROR: Unknown command '%s'\n", cmd);
+               }
+       }
+}

UCC git Repository :: git.ucc.asn.au