aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunk@roden.local.stsci.edu>2021-05-04 17:34:38 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-05-04 21:14:16 -0400
commitea6e2613aca23c84373e686d739498969062f79e (patch)
treeba9cf39409056cad0b65a4ee953856230e73196b /include
downloadcleanpath-ea6e2613aca23c84373e686d739498969062f79e.tar.gz
Initial commit
Diffstat (limited to 'include')
-rw-r--r--include/cleanpath.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/cleanpath.h b/include/cleanpath.h
new file mode 100644
index 0000000..4e7d35d
--- /dev/null
+++ b/include/cleanpath.h
@@ -0,0 +1,27 @@
+#ifndef CLEANPATH_CLEANPATH_H
+#define CLEANPATH_CLEANPATH_H
+
+#define CLEANPATH_VERSION "0.1.0"
+#define CLEANPATH_FILTER_NONE -1
+#define CLEANPATH_FILTER_EXACT 0
+#define CLEANPATH_FILTER_LOOSE 1
+#define CLEANPATH_FILTER_REGEX 2
+#define CLEANPATH_PART_MAX 1024
+#define CLEANPATH_VAR "PATH"
+#define CLEANPATH_SEP ":"
+
+struct CleanPath {
+ char *data; // Pointer to the path string
+ size_t data_len; // Length of the path string
+ char *sep; // Pointer to the separator used to split the data string
+ char *part[CLEANPATH_PART_MAX]; // Array of pointers to path elements
+ size_t part_nelem; // Total number of elements in part array
+};
+
+// Prototypes
+struct CleanPath *cleanpath_init(const char *path, const char *sep);
+void cleanpath_filter(struct CleanPath *path, unsigned mode, const char *pattern);
+char *cleanpath_read(struct CleanPath *path);
+void cleanpath_free(struct CleanPath *path);
+
+#endif //CLEANPATH_CLEANPATH_H \ No newline at end of file