diff options
Diffstat (limited to 'src/util/fs.h')
| -rw-r--r-- | src/util/fs.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util/fs.h b/src/util/fs.h index 7be8527..ad0a449 100644 --- a/src/util/fs.h +++ b/src/util/fs.h @@ -44,4 +44,32 @@ bool is_dir(const char *restrict pathname); */ const char *myhome(); +/** + * creatfile: + * create a file on the file system. + * + * @param path: pathname for the file to create + * @param mode: desired file mode (cf. creat(3p)) + * @return 0 on success, -1 otherwise (errno set) + */ +int creatfile(const char *path, mode_t mode); + +/** + * mktempdir: + * creates a temporary directory in a suitable location. + * + * @param dest: must be a pointer to a buffer of a least PATH_MAX+1 length. + * @return dest if a directory was created successfully, NULL otherwise. + */ +char *mktempdir(char *dest); + +/** + * rmtree: + * delete a directory on the file system and all its descendants. + * + * @param dir: the path to the directory to delete. + * @return 0 on success, -1 otherwise. + */ +int rmtree(const char *dir); + #endif |
