Make resistant to empty lines
[hachu.git] / hachu.c
diff --git a/hachu.c b/hachu.c
index 7c672d4..bb26721 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -2792,8 +2792,10 @@ printf("# setup done");fflush(stdout);
       int i, c;\r
       while(1) {\r
         // wait for input, and read it until we have collected a complete line\r
-        for(i = 0; (inBuf[i] = c = getchar()) != '\n'; i++) if(c == EOF || i>7997) exit(0);\r
-        inBuf[i+1] = 0;\r
+        do {\r
+          for(i = 0; (inBuf[i] = c = getchar()) != '\n'; i++) if(c == EOF || i>7997) exit(0);\r
+          inBuf[i+1] = 0;\r
+        } while(!i); // ignore empty lines\r
 \r
         // extract the first word\r
         sscanf(inBuf, "%s", command);\r