]> granicus.if.org Git - mutt/commitdiff
patch-bac.imapnextword-1. From Brendan Cully.
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 26 Jul 2001 17:42:48 +0000 (17:42 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 26 Jul 2001 17:42:48 +0000 (17:42 +0000)
imap/util.c

index b3aabc7c9663df2be9136b7c64a4590dc090d51a..d65d7e2388931e26dc9d55ce26fcd501760e996f 100644 (file)
@@ -346,8 +346,22 @@ char* imap_get_qualifier (char* buf)
 /* imap_next_word: return index into string where next IMAP word begins */
 char *imap_next_word (char *s)
 {
-  while (*s && !ISSPACE (*s))
+  int quoted = 0;
+
+  while (*s) {
+    if (*s == '\\') {
+      s++;
+      if (*s)
+       s++;
+      continue;
+    }
+    if (*s == '\"')
+      quoted = quoted ? 0 : 1;
+    if (!quoted && ISSPACE (*s))
+      break;
     s++;
+  }
+
   SKIPWS (s);
   return s;
 }