+/* Get the next include/exclude arg from the string. The token will not
+ * be '\0' terminated, so use the returned length to limit the string.
+ * Also, be sure to add this length to the returned pointer before passing
+ * it back to ask for the next token. This routine will not split off a
+ * prefix of "+ " or "- " unless xflags contains XFLG_NO_PREFIXES. The
+ * *incl_ptr value will be 1 for an include, 0 for an exclude, and -1 for
+ * the list-clearing "!" token.
+ */
+static const char *get_exclude_tok(const char *p, int *len_ptr, int *incl_ptr,
+ int xflags)
+{
+ const unsigned char *s = (const unsigned char *)p;
+ int len;
+
+ if (xflags & XFLG_WORD_SPLIT) {
+ /* Skip over any initial whitespace. */
+ while (isspace(*s))
+ s++;
+ /* Update for "!" check. */
+ p = (const char *)s;
+ }
+
+ /* Is this a '+' or '-' followed by a space (not whitespace)? */
+ if (!(xflags & XFLG_NO_PREFIXES)
+ && (*s == '-' || *s == '+') && s[1] == ' ') {
+ *incl_ptr = *s == '+';
+ s += 2;
+ } else
+ *incl_ptr = xflags & XFLG_DEF_INCLUDE;
+
+ if (xflags & XFLG_WORD_SPLIT) {
+ const unsigned char *cp = s;
+ /* Token ends at whitespace or the end of the string. */
+ while (!isspace(*cp) && *cp != '\0')
+ cp++;
+ len = cp - s;
+ } else
+ len = strlen(s);
+
+ if (*p == '!' && len == 1 && !(xflags & XFLG_NO_PREFIXES))
+ *incl_ptr = -1;
+
+ *len_ptr = len;
+ return (const char *)s;
+}
+
+
+void add_exclude(struct exclude_struct ***listp, const char *pattern, int xflags)