aboutsummaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-10-07 14:56:09 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-10-07 14:59:03 +0200
commit145dfce5f04a3a74a49cc016f15b0aa6d9996662 (patch)
tree919357d5a18934222741732c8444db7711421aa3 /include/common.h
parent7e1be3986b3b8229f0162431b6e02c24e04a5dba (diff)
Cleanup: move directory handling code to libcommon
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index 19c95a3..0e9da0c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -138,4 +138,22 @@ void sqfs_writer_cleanup(sqfs_writer_t *sqfs);
void sqfs_perror(const char *file, const char *action, int error_code);
+
+/*
+ A wrapper around mkdir() that behaves like 'mkdir -p'. It tries to create
+ every component of the given path and skips already existing entries.
+
+ Returns 0 on success.
+*/
+int mkdir_p(const char *path);
+
+/* Returns 0 on success. On failure, prints error message to stderr. */
+int pushd(const char *path);
+
+/* Same as pushd, but the string doesn't have to be null-terminated. */
+int pushdn(const char *path, size_t len);
+
+/* Returns 0 on success. On failure, prints error message to stderr. */
+int popd(void);
+
#endif /* COMMON_H */