- if (xflags & XFLG_WORD_SPLIT) {
- int add = 0;
- /* Count maximum extra tokens we might encounter. */
- for (cp = pattern; *cp; cp++) {
- if (isspace(*(unsigned char *)cp)) {
- add_cnt += add;
- add = 0;
- } else
- add = 1;
- }
- }
-
- cp = get_exclude_tok(pattern, &pat_len, &incl, xflags);
- if (!pat_len)
- return;
-
- /* Check for the special "!" token that clears the list. Yes, we
- * only honor it at the start of a XFLG_WORD_SPLIT string. */
- if (incl < 0) {
- free_exclude_list(listp);
- if (!--add_cnt)
- return;
- cp = get_exclude_tok(cp + pat_len, &pat_len, &incl, xflags);
+ cp = pattern;
+ pat_len = 0;
+ while (1) {
+ cp = get_exclude_tok(cp + pat_len, &pat_len, &mflags, xflags);