summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-02-14 01:07:01 +0100
committerLennart Poettering <lennart@poettering.net>2010-02-14 01:07:01 +0100
commitc85dc17be718014260e10e41d15ba8f7329fed26 (patch)
tree7a6a41ca48f4bb0a6e073ad1dce0b09acac61f7d /util.c
parenta6a80b4f440bcc1c6087572503c08a72ee674075 (diff)
util: unify code to check whether certain file names should be ignored when listing files
Diffstat (limited to 'util.c')
-rw-r--r--util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/util.c b/util.c
index 496f55166b..e31649861d 100644
--- a/util.c
+++ b/util.c
@@ -1058,6 +1058,20 @@ char *ascii_strlower(char *path) {
return p;
}
+bool ignore_file(const char *filename) {
+ assert(filename);
+
+ return
+ filename[0] == '.' ||
+ endswith(filename, "~") ||
+ endswith(filename, ".rpmnew") ||
+ endswith(filename, ".rpmsave") ||
+ endswith(filename, ".rpmorig") ||
+ endswith(filename, ".dpkg-old") ||
+ endswith(filename, ".dpkg-new") ||
+ endswith(filename, ".swp");
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",