libcfe  0.12.1
some useful C-functions
check_path_exists.h
Go to the documentation of this file.
1 #ifndef XCHECK_PATH_EXISTS_H
2 #define XCHECK_PATH_EXISTS_H
3 
4 #include <sys/stat.h>
5 
6 /* types */
7 #define TYPE_DIR S_IFDIR
8 #define TYPE_REG S_IFREG
9 #define TYPE_LNK S_IFLNK
10 //#define TYPE_SYM 0008
11 #define TYPE_SOC S_IFSOCK
12 #define TYPE_FIF S_IFIFO
13 #define TYPE_CDEV S_IFCHR
14 #define TYPE_BDEV S_IFBLK
15 #define TYPE_NONE 0
16 #define TYPE_DEV (TYPE_BDEV | TYPE_CDEV)
17 #define TYPE_NODIR (TYPE_REG | TYPE_LNK | TYPE_SOC | TYPE_FIF | TYPE_DEV)
18 
19 /* modes */
20 #define PATH_R 4
21 #define PATH_W 2
22 #define PATH_X 1
23 #define PATH_NOCHECK 0
24 
25 
28 #define check_file_exists(file, mode) check_path_exists(file, S_IFREG, mode)
29 
33 #define check_dir_exists(dir, mode) check_path_exists(dir, S_IFDIR, mode)
34 
44 int check_path_exists(const char *path, mode_t type, mode_t mode);
45 
46 #endif /* XCHECK_PATH_EXISTS_H */
int check_path_exists(const char *path, mode_t type, mode_t mode)