11a1589223
Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
43 lines
1.7 KiB
C
43 lines
1.7 KiB
C
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
#pragma once
|
|
|
|
/***
|
|
This file is part of systemd.
|
|
|
|
Copyright 2010 Lennart Poettering
|
|
***/
|
|
|
|
#include <dirent.h>
|
|
#include <errno.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "macro.h"
|
|
#include "path-util.h"
|
|
|
|
int dirent_ensure_type(DIR *d, struct dirent *de);
|
|
|
|
bool dirent_is_file(const struct dirent *de) _pure_;
|
|
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_;
|
|
|
|
struct dirent* readdir_no_dot(DIR *dirp);
|
|
|
|
#define FOREACH_DIRENT(de, d, on_error) \
|
|
for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \
|
|
if (!de) { \
|
|
if (errno > 0) { \
|
|
on_error; \
|
|
} \
|
|
break; \
|
|
} else if (hidden_or_backup_file((de)->d_name)) \
|
|
continue; \
|
|
else
|
|
|
|
#define FOREACH_DIRENT_ALL(de, d, on_error) \
|
|
for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \
|
|
if (!de) { \
|
|
if (errno > 0) { \
|
|
on_error; \
|
|
} \
|
|
break; \
|
|
} else
|