diff common/portpath.h @ 146:306e4db11761

Added portable path name handling functions. Windows implementation missing.
author Sascha Wilde <wilde@intevation.de>
date Mon, 24 Mar 2014 17:23:06 +0100
parents
children 92d7e0b40808
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/portpath.h	Mon Mar 24 17:23:06 2014 +0100
@@ -0,0 +1,41 @@
+#ifndef PORTPATH_H
+#define PORTPATH_H
+
+/**
+ * @file  portpath.h
+ * @brief Platform independent functions for file and path handling.
+ * @details portpath contains functions to handle file and path names
+ * in a platform independent way.  The code unsing this functions
+ * should be protable between GNU/Linux and Windows32 systems.
+ */
+
+/**
+ * @brief portable version of dirname
+ * @details return the directory component of the given path.
+ * The argument path may be altered by the function.
+ * @param[inout] path the pathname
+ * @returns a pointer to the string containing the directory component
+ */
+char *port_dirname(char *path);
+
+
+/**
+ * @brief portable version of dirname
+ * @details return the directory component of the given path.
+ * The argument path may be altered by the function.
+ * @param[inout] path the pathname
+ * @returns a pointer to the string containing the directory component
+ */
+char *port_dirname(char *path);
+
+/**
+ * @brief portable version of realpath
+ * @details return the expanded absolute pathname for the given path.
+ * The buffer for the resolved path is allocated by this function and
+ * should be freed by the caller.
+ * @param[in] path the original pathname
+ * @returns a pointer to the resolved path or NULL on error
+ */
+char *port_realpath(char *path);
+
+#endif

http://wald.intevation.org/projects/trustbridge/