Insert items into the filter list at the tail rather than at the head,
this makes it easier for users to understand what's going on.
void loadfilter(char *fn) {
FILE* file;
char linebuf[1024];
+ struct filterlist *filtertail;
file = fopen(fn, "r");
if (!file) {
ohshite(_("Error allocating memory for filter entry"));
}
strcpy(filter->filterstring, &linebuf[1]);
- filter->next = filters;
- filters = filter;
+
+ if (! filters) {
+ filters = filter;
+ filtertail = filter;
+ filter->next = NULL;
+ } else {
+ filtertail->next = filter;
+ filtertail = filtertail->next;
+ }
}
if (ferror(file)) ohshite(_("read error in configuration file `%.255s'"), fn);