static struct filterlist *filters = NULL;
static struct filterlist **filtertail = &filters;
+static int file_is_boring(char *fn)
+{
+ char *boring_suffixes[] = { REMOVECONFFEXTS, NULL };
+ char *boring_prefixes[] = { ".", NULL };
+ char *boring_files[] = { ".swp", NULL };
+ int i;
+
+ for (i = 0; boring_prefixes[i] != NULL; i++) {
+ if (strncmp(fn, boring_prefixes[i],
+ strlen(boring_prefixes[i])) == 0) {
+ return 1;
+ }
+ }
+
+ for (i = 0; boring_files[i] != NULL; i++) {
+ if (strcmp(fn, boring_files[i]) == 0) {
+ return 1;
+ }
+ }
+
+ for (i = 0; boring_suffixes[i] != NULL; i++) {
+ if (strcmp(fn + strlen(fn) - strlen(boring_suffixes[i]),
+ boring_suffixes[i]) == 0) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static void
loadfilter(const char *fn)
{
sprintf(file, "%s/%s", dirname, dent->d_name);
if (stat(file, &statbuf) != 0)
ohshite(_("error stating file '%s'"), file);
- if (S_ISREG(statbuf.st_mode)) {
+ if (S_ISREG(statbuf.st_mode) && !file_is_boring(file)) {
names[i++] = m_strdup(file);
if (i == names_len) {
names_len *= 2;