]> mj.ucw.cz Git - libucw.git/blobdiff - lib/wordsplit.c
Removed few by now obsolete assertions.
[libucw.git] / lib / wordsplit.c
index b1b2ada3fd58e8f1c38fc88ef1dc4ab3e9cc5f2b..fe657fc729387b0ce623b395f18e86f235caf442 100644 (file)
@@ -12,7 +12,7 @@
 int
 wordsplit(byte *src, byte **dst, uns max)
 {
-  int cnt = 0;
+  uns cnt = 0;
 
   for(;;)
     {
@@ -22,9 +22,21 @@ wordsplit(byte *src, byte **dst, uns max)
        break;
       if (cnt >= max)
        return -1;
-      dst[cnt++] = src;
-      while (*src && !Cspace(*src))
-       src++;
+      if (*src == '"')
+       {
+         src++;
+         dst[cnt++] = src;
+         while (*src && *src != '"')
+           src++;
+         if (*src)
+           *src++ = 0;
+       }
+      else
+       {
+         dst[cnt++] = src;
+         while (*src && !Cspace(*src))
+           src++;
+       }
     }
   return cnt;
 }