From c9694ee63d451da62dc50b234b3080a35a40e844 Mon Sep 17 00:00:00 2001 From: Jerzi Kaminsky Date: Fri, 14 Apr 2017 23:37:43 +0300 Subject: Add resolve_path() to utils --- include/util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/util.h b/include/util.h index 839af265..e5365458 100644 --- a/include/util.h +++ b/include/util.h @@ -49,4 +49,12 @@ pid_t get_parent_pid(pid_t pid); */ uint32_t parse_color(const char *color); +/** + * Given a path string, recurseively resolves any symlinks to their targets + * (which may be a file, directory) and returns the result. + * argument is returned. Caller must free the returned buffer. + * If an error occures, if the path does not exist or if the path corresponds + * to a dangling symlink, NULL is returned. + */ +char* resolve_path(const char* path); #endif -- cgit v1.2.3-54-g00ecf