test/test_physfs.c
changeset 74 a4a5066fb640
parent 72 ad828df14344
child 101 bd18e17ad6ad
--- a/test/test_physfs.c	Thu Aug 23 17:09:20 2001 +0000
+++ b/test/test_physfs.c	Thu Aug 23 18:01:43 2001 +0000
@@ -572,10 +572,35 @@
 #if (defined HAVE_READLINE)
         buf = readline("> ");
 #else
+        int i;
         buf = malloc(512);
         memset(buf, '\0', 512);
-        scanf("%s", buf);
+        printf("> ");
+        for (i = 0; i < 511; i++)
+        {
+            int ch = fgetc(stdin);
+            if (ch == EOF)
+            {
+                strcpy(buf, "quit");
+                break;
+            } /* if */
+            else if ((ch == '\n') || (ch == '\r'))
+            {
+                buf[i] = '\0';
+                break;
+            } /* else if */
+            else if (ch == '\b')
+            {
+                if (i > 0)
+                    i--;
+            } /* else if */
+            else
+            {
+                buf[i] = (char) ch;
+            } /* else */
+        } /* for */
 #endif
+
         rc = process_command(buf);
         free(buf);
     } while (rc);