fixing sloppy errors introduced with new strqtok
[dcpu16] / common.c
index 9dbadf369983950b2126efc8a5dcde63a307d2f2..ce1b6c0305aa3b86b4754fdf7da5c46134dc09ad 100644 (file)
--- a/common.c
+++ b/common.c
@@ -126,7 +126,11 @@ char *strqtok_r(char *str, const char *sep, int esc, const char *quote, char **l
     }
 
     /* next token starts after any leading seps */
-    *lasts += strspn(*lasts, sep);
+    while (**lasts && strchr(sep, **lasts)) {
+        **lasts = '\0';
+        (*lasts)++;
+    }
+
     tok = *lasts;
     if (*tok == '\0')
         return NULL;