/*
* Move non-matching entries to the end
*/
-static void
+static int
fill(struct entry **dents, int (*filter)(regex_t *, char *), regex_t *re)
{
static int count;
continue;
}
}
+
+ return ndents;
}
static int
if (setfilter(&re, fltr) != 0)
return -1;
- fill(&dents, visible, &re);
+ ndents = fill(&dents, visible, &re);
regfree(&re);
+ if (ndents == 0)
+ return 0;
qsort(dents, ndents, sizeof(*dents), entrycmp);
ndents = dentfill(path, &dents, visible, &re);
regfree(&re);
+ if (ndents == 0)
+ return 0;
qsort(dents, ndents, sizeof(*dents), entrycmp);