test/test_physfs.c
changeset 165 cbb1b0dcf6da
parent 164 a93a65be81fb
child 170 d826bf2c38c8
--- a/test/test_physfs.c	Wed Apr 03 07:40:27 2002 +0000
+++ b/test/test_physfs.c	Thu Apr 04 17:55:13 2002 +0000
@@ -102,10 +102,18 @@
 
 static int cmd_addarchive(char *args)
 {
-    char *ptr = strchr(args, ' ');
+    char *ptr = strrchr(args, ' ');
     int appending = atoi(ptr + 1);
     *ptr = '\0';
 
+    if (*args == '\"')
+    {
+        args++;
+        *(ptr - 1) = '\0';
+    }
+
+    /*printf("[%s], [%d]\n", args, appending);*/
+
     if (PHYSFS_addToSearchPath(args, appending))
         printf("Successful.\n");
     else
@@ -369,12 +377,15 @@
 static int count_args(const char *str)
 {
     int retval = 0;
+    int in_quotes = 0;
 
     if (str != NULL)
     {
         for (; *str != '\0'; str++)
         {
-            if (*str == ' ')
+            if (*str == '\"')
+                in_quotes = !in_quotes;
+            else if ((*str == ' ') && (!in_quotes))
                 retval++;
         } /* for */
         retval++;