***/
#include <alloca.h>
-#include <dirent.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
int readlink_and_make_absolute(const char *p, char **r);
int readlink_and_canonicalize(const char *p, char **r);
-char *file_in_same_dir(const char *path, const char *filename);
-
int rmdir_parents(const char *path, const char *stop);
-bool dirent_is_file(const struct dirent *de) _pure_;
-bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_;
-
-bool hidden_file(const char *filename) _pure_;
-
/* For basic lookup tables with strictly enumerated entries */
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
scope const char *name##_to_string(type i) { \
bool fstype_is_network(const char *fstype);
-bool is_device_path(const char *path);
-
int dir_is_empty(const char *path);
static inline int dir_is_populated(const char *path) {
int glob_exists(const char *path);
int glob_extend(char ***strv, const char *path);
-int dirent_ensure_type(DIR *d, struct dirent *de);
-
int get_files_in_directory(const char *path, char ***list);
bool is_main_thread(void);
int on_ac_power(void);
-#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_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
-
static inline void *mempset(void *s, int c, size_t n) {
memset(s, c, n);
return (uint8_t*)s + n;