- for (ent = exclude_list.head; ent; ent = ent->next) {
- char *p = ent->pattern;
- if (ent->match_flags & MATCHFLG_INCLUDE)
- write_buf(fd, "+ ", 2);
- else if (((*p == '-' || *p == '+') && p[1] == ' ')
- || *p == '#' || *p == ';')
- write_buf(fd, "- ", 2);
- write_sbuf(fd, p);
+ for (ent = filter_list.head; ent; ent = ent->next) {
+ unsigned int plen;
+ char *p = get_rule_prefix(ent->match_flags, "- ", &plen);
+ write_buf(fd, p, plen);
+ write_sbuf(fd, ent->pattern);