imported brians code
[nestedvm.git] / src / tests / EchoHelper.c
diff --git a/src/tests/EchoHelper.c b/src/tests/EchoHelper.c
new file mode 100644 (file)
index 0000000..f1cf1a4
--- /dev/null
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <string.h>
+
+int main() {
+    char buf[1024];
+    char *p;
+    printf("Hello! Welcome to EchoHelper.c\n");
+    while(fgets(buf,sizeof(buf),stdin) != NULL) {
+        for(p=buf;*p && *p!='\n' && *p!='\r';p++);
+        *p = '\0';
+        fprintf(stdout,"You said: %s\n",buf);
+        fprintf(stderr,"They said: %s\n",buf);
+        if(strcmp(buf,"exit")==0) break;
+    }
+    return 0;
+}