From 89511934b805999e0c12071750c52c1c45d35536 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 12 May 2021 23:46:22 -0400 Subject: Proper namespace for the header file. Bump version. --- include/cleanpath.h | 64 ------------------------------------------- include/cleanpath/cleanpath.h | 64 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 include/cleanpath.h create mode 100644 include/cleanpath/cleanpath.h (limited to 'include') diff --git a/include/cleanpath.h b/include/cleanpath.h deleted file mode 100644 index 9f38188..0000000 --- a/include/cleanpath.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef CLEANPATH_CLEANPATH_H -#define CLEANPATH_CLEANPATH_H - -// Define some platform detection shortcuts -#define OS_DARWIN 0 -#define OS_WINDOWS 0 -#define OS_LINUX 0 -#define OS_SUPPORTED 0 - -#if defined(__APPLE__) && defined(__MACH__) -# undef OS_DARWIN -# define OS_DARWIN 1 -# undef OS_SUPPORTED -# define OS_SUPPORTED 1 - -#elif defined(_WIN32) -# undef OS_WINDOWS -# define OS_WINDOWS 1 -# undef OS_SUPPORTED -# define OS_SUPPORTED 1 - -#elif defined(__linux) || defined(__linux__) -# undef OS_LINUX -# define OS_LINUX 1 -# undef OS_SUPPORTED -# define OS_SUPPORTED 1 -#endif - -#include -#include -#include - -#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 ":" -#define CLEANPATH_MSG_NOAVAIL "" - -#if OS_WINDOWS -#undef CLEANPATH_SEP -#define CLEANPATH_SEP ";" -#undef CLEANPATH_MSG_NOAVAIL -#define CLEANPATH_MSG_NOAVAIL " [not implemented] " -#endif - -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 diff --git a/include/cleanpath/cleanpath.h b/include/cleanpath/cleanpath.h new file mode 100644 index 0000000..afee624 --- /dev/null +++ b/include/cleanpath/cleanpath.h @@ -0,0 +1,64 @@ +#ifndef CLEANPATH_CLEANPATH_H +#define CLEANPATH_CLEANPATH_H + +// Define some platform detection shortcuts +#define OS_DARWIN 0 +#define OS_WINDOWS 0 +#define OS_LINUX 0 +#define OS_SUPPORTED 0 + +#if defined(__APPLE__) && defined(__MACH__) +# undef OS_DARWIN +# define OS_DARWIN 1 +# undef OS_SUPPORTED +# define OS_SUPPORTED 1 + +#elif defined(_WIN32) +# undef OS_WINDOWS +# define OS_WINDOWS 1 +# undef OS_SUPPORTED +# define OS_SUPPORTED 1 + +#elif defined(__linux) || defined(__linux__) +# undef OS_LINUX +# define OS_LINUX 1 +# undef OS_SUPPORTED +# define OS_SUPPORTED 1 +#endif + +#include +#include +#include + +#define CLEANPATH_VERSION "1.0.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 ":" +#define CLEANPATH_MSG_NOAVAIL "" + +#if OS_WINDOWS +#undef CLEANPATH_SEP +#define CLEANPATH_SEP ";" +#undef CLEANPATH_MSG_NOAVAIL +#define CLEANPATH_MSG_NOAVAIL " [not implemented] " +#endif + +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 -- cgit