--- exclude.c 20 Feb 2005 17:04:53 -0000 1.112 +++ exclude.c 25 Feb 2005 16:50:24 -0000 @@ -73,6 +73,7 @@ static BOOL parent_dirscan = False; static struct filter_struct **mergelist_parents; static int mergelist_cnt = 0; static int mergelist_size = 0; +static int reversing_file = 0; /* Each filter_list_struct describes a singly-linked list by keeping track * of both the head and tail pointers. The list is slightly unusual in that @@ -231,6 +232,9 @@ static void add_rule(struct filter_list_ if (!listp->tail) { ret->next = listp->head; listp->head = listp->tail = ret; + } else if (reversing_file) { + ret->next = listp->head; + listp->head = ret; } else { ret->next = listp->tail->next; listp->tail->next = ret; @@ -1017,6 +1021,10 @@ void parse_filter_file(struct filter_lis s = line; } *s = '\0'; + if (*line == '[' && strcmp(line+1, "last-match]") == 0) { + reversing_file = 1; + continue; + } /* Skip an empty token and (when line parsing) comments. */ if (*line && (word_split || (*line != ';' && *line != '#'))) parse_rule(listp, line, mflags, xflags); @@ -1024,6 +1032,7 @@ void parse_filter_file(struct filter_lis break; } fclose(fp); + reversing_file = 0; } /* If the "for_xfer" flag is set, the prefix is made compatible with the