+static void write_excludes(int fd)
+{
+ struct exclude_struct *ent;
+
+ write_sbuf(fd, " <<'#E#'\n");
+ 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);
+ if (ent->match_flags & MATCHFLG_DIRECTORY)
+ write_byte(fd, '/');
+ write_byte(fd, eol_nulls ? 0 : '\n');
+ }
+ if (eol_nulls)
+ write_sbuf(fd, ";\n");
+ write_sbuf(fd, "#E#");
+}
+