+ struct filter_chmod_struct *chmod;
+ struct chmod_mode_struct *modes = NULL;
+
+ if (!parse_chmod(modestr, &modes))
+ return NULL;
+
+ if (!(chmod = new(struct filter_chmod_struct)))
+ out_of_memory("make_chmod_struct");
+ chmod->ref_cnt = 1;
+ chmod->modestr = modestr;
+ chmod->modes = modes;
+ return chmod;
+}
+
+#define MATCHFLGS_FROM_CONTAINER (MATCHFLG_ABS_PATH | MATCHFLG_INCLUDE \
+ | MATCHFLG_DIRECTORY | MATCHFLG_NEGATE \
+ | MATCHFLG_PERISHABLE | MATCHFLGS_ATTRS)
+
+/* Gets the next include/exclude rule from *rulestr_ptr and advances
+ * *rulestr_ptr to point beyond it. Stores the pattern's start (within
+ * *rulestr_ptr) and length in *pat_ptr and *pat_len_ptr, and returns a newly
+ * allocated filter_struct containing the rest of the information. Returns
+ * NULL if there are no more rules in the input.
+ *
+ * The template provides defaults for the new rule to inherit, and the
+ * template mflags and the xflags additionally affect parsing. */
+static struct filter_struct *parse_rule_tok(const char **rulestr_ptr,
+ struct filter_struct *template, int xflags,
+ const char **pat_ptr, unsigned int *pat_len_ptr)
+{
+ const uchar *s = (const uchar *)*rulestr_ptr;
+ char *val;
+ struct filter_struct *filter;