16 #include <linux/kernel.h> 19 #include <sys/types.h> 30 static char pathname_array[4][
PATH_MAX];
33 return pathname_array[3 & ++idx];
39 if (!memcmp(path,
"./", 2)) {
54 len = vsnprintf(pathname,
PATH_MAX, fmt, args);
63 return scnprintf(bf, size,
"%s%s%s", path1, path1[0] ?
"/" :
"", path2);
66 int path__join3(
char *bf,
size_t size,
const char *path1,
const char *path2,
const char *path3)
68 return scnprintf(bf, size,
"%s%s%s%s%s", path1, path1[0] ?
"/" :
"",
69 path2, path2[0] ?
"/" :
"", path3);
79 return S_ISREG(st.st_mode);
83 bool is_directory(
const char *base_path,
const struct dirent *dent)
88 sprintf(path,
"%s/%s", base_path, dent->d_name);
92 return S_ISDIR(st.st_mode);
bool is_regular_file(const char *file)
static char * cleanup_path(char *path)
static char * get_pathname(void)
int path__join(char *bf, size_t size, const char *path1, const char *path2)
char * mkpath(const char *fmt,...)
bool is_directory(const char *base_path, const struct dirent *dent)
int path__join3(char *bf, size_t size, const char *path1, const char *path2, const char *path3)