25 #include <sys/types.h>
45 if (!stat(path, &sr)) {
55 extern int is_dir(
const char *path) {
57 if (!stat(path, &sr) && S_ISDIR(sr.st_mode)) {
69 if (!stat(path, &sr) && (S_IXUSR & sr.st_mode)) {
85 extern int mk_dir(
const char *dir) {
87 extern int mk_dir(
const char *dir, mode_t mode, uid_t user, gid_t group) {
92 if ((stat(dir, &sr) && (errno == ENOENT)) && !mkdir(dir)) {
94 if ((stat(dir, &sr) && (errno == ENOENT)) && !mkdir(dir, mode) && !chown(dir, user, group)) {
int is_exec(const char *path)
Determine if a file is executable.
int mk_dir(const char *dir, mode_t mode, uid_t user, gid_t group)
Create a directory.
int is_file(const char *path)
Determine if a file exists.
int is_dir(const char *path)
Determine if a path is a directory.