util: rename ignore_file() to hidden_file()
hidden_file() is a bit more precise, since dot files usually shouldn't be ignored, but certainly be considered hidden.
This commit is contained in:
parent
358ba19e5e
commit
a34bf9db5d
|
@ -1028,7 +1028,7 @@ static void manager_build_unit_path_cache(Manager *m) {
|
|||
while ((de = readdir(d))) {
|
||||
char *p;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
p = strjoin(streq(*i, "/") ? "" : *i, "/", de->d_name, NULL);
|
||||
|
|
|
@ -148,7 +148,7 @@ static int iterate_dir(
|
|||
if (!de)
|
||||
break;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
f = strjoin(path, "/", de->d_name, NULL);
|
||||
|
|
|
@ -127,7 +127,7 @@ int fdset_new_fill(FDSet **_s) {
|
|||
while ((de = readdir(d))) {
|
||||
int fd = -1;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
r = safe_atoi(de->d_name, &fd);
|
||||
|
|
|
@ -240,7 +240,7 @@ static int remove_marked_symlinks_fd(
|
|||
if (!de)
|
||||
break;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
dirent_ensure_type(d, de);
|
||||
|
@ -415,7 +415,7 @@ static int find_symlinks_fd(
|
|||
if (!de)
|
||||
return r;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
dirent_ensure_type(d, de);
|
||||
|
@ -2094,7 +2094,7 @@ int unit_file_preset_all(
|
|||
if (!de)
|
||||
break;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
if (!unit_name_is_valid(de->d_name, TEMPLATE_VALID))
|
||||
|
@ -2206,7 +2206,7 @@ int unit_file_get_list(
|
|||
if (!de)
|
||||
break;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
if (!unit_name_is_valid(de->d_name, TEMPLATE_VALID))
|
||||
|
|
|
@ -1510,7 +1510,7 @@ char *ascii_strlower(char *t) {
|
|||
return t;
|
||||
}
|
||||
|
||||
_pure_ static bool ignore_file_allow_backup(const char *filename) {
|
||||
_pure_ static bool hidden_file_allow_backup(const char *filename) {
|
||||
assert(filename);
|
||||
|
||||
return
|
||||
|
@ -1527,13 +1527,13 @@ _pure_ static bool ignore_file_allow_backup(const char *filename) {
|
|||
endswith(filename, ".swp");
|
||||
}
|
||||
|
||||
bool ignore_file(const char *filename) {
|
||||
bool hidden_file(const char *filename) {
|
||||
assert(filename);
|
||||
|
||||
if (endswith(filename, "~"))
|
||||
return true;
|
||||
|
||||
return ignore_file_allow_backup(filename);
|
||||
return hidden_file_allow_backup(filename);
|
||||
}
|
||||
|
||||
int fd_nonblock(int fd, bool nonblock) {
|
||||
|
@ -1627,7 +1627,7 @@ int close_all_fds(const int except[], unsigned n_except) {
|
|||
while ((de = readdir(d))) {
|
||||
int fd = -1;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
if (safe_atoi(de->d_name, &fd) < 0)
|
||||
|
@ -2531,7 +2531,7 @@ int dir_is_empty(const char *path) {
|
|||
if (!de)
|
||||
return 1;
|
||||
|
||||
if (!ignore_file(de->d_name))
|
||||
if (!hidden_file(de->d_name))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -3996,7 +3996,7 @@ const char *default_term_for_tty(const char *tty) {
|
|||
bool dirent_is_file(const struct dirent *de) {
|
||||
assert(de);
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
return false;
|
||||
|
||||
if (de->d_type != DT_REG &&
|
||||
|
@ -4015,7 +4015,7 @@ bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) {
|
|||
de->d_type != DT_UNKNOWN)
|
||||
return false;
|
||||
|
||||
if (ignore_file_allow_backup(de->d_name))
|
||||
if (hidden_file_allow_backup(de->d_name))
|
||||
return false;
|
||||
|
||||
return endswith(de->d_name, suffix);
|
||||
|
@ -5909,7 +5909,7 @@ int on_ac_power(void) {
|
|||
if (!de)
|
||||
break;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
device = openat(dirfd(d), de->d_name, O_DIRECTORY|O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
|
|
|
@ -317,7 +317,7 @@ char *ascii_strlower(char *path);
|
|||
bool dirent_is_file(const struct dirent *de) _pure_;
|
||||
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_;
|
||||
|
||||
bool ignore_file(const char *filename) _pure_;
|
||||
bool hidden_file(const char *filename) _pure_;
|
||||
|
||||
bool chars_intersect(const char *a, const char *b) _pure_;
|
||||
|
||||
|
@ -771,7 +771,7 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *root
|
|||
on_error; \
|
||||
} \
|
||||
break; \
|
||||
} else if (ignore_file((de)->d_name)) \
|
||||
} else if (hidden_file((de)->d_name)) \
|
||||
continue; \
|
||||
else
|
||||
|
||||
|
|
|
@ -704,7 +704,7 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
|
|||
_cleanup_free_ char *fpath = NULL, *name = NULL;
|
||||
int r;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
fpath = strjoin(*path, "/", de->d_name, NULL);
|
||||
|
@ -777,7 +777,7 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
|
|||
while ((de = readdir(d))) {
|
||||
int a, b;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
if (de->d_name[0] != 'S' && de->d_name[0] != 'K')
|
||||
|
|
|
@ -438,7 +438,7 @@ static int show_passwords(void) {
|
|||
if (de->d_type != DT_REG)
|
||||
continue;
|
||||
|
||||
if (ignore_file(de->d_name))
|
||||
if (hidden_file(de->d_name))
|
||||
continue;
|
||||
|
||||
if (!startswith(de->d_name, "ask."))
|
||||
|
|
Loading…
Reference in a new issue