diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rw-r--r-- | include/cleanpath.h | 5 | ||||
-rw-r--r-- | lib/cleanpath.c | 14 |
4 files changed, 7 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 04e6239..5929cff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,6 @@ set(LIB_SOURCES lib/cleanpath.c) set(MAIN_SOURCES src/main.c) set(INCLUDES include/cleanpath.h) -CHECK_INCLUDE_FILE(sys/limits.h HAVE_SYS_LIMIT_H) -CHECK_INCLUDE_FILE(linux/limits.h HAVE_LINUX_LIMIT_H) - configure_file ("${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/include/config.h") diff --git a/config.h.in b/config.h.in index f8a0396..777f43c 100644 --- a/config.h.in +++ b/config.h.in @@ -1,7 +1,6 @@ #ifndef CLEAN_PATH_CONFIG_H #define CLEAN_PATH_CONFIG_H -#cmakedefine HAVE_SYS_LIMIT_H @HAVE_SYS_LIMIT_H@ -#cmakedefine HAVE_LINUX_LIMIT_H @HAVE_LINUX_LIMIT_H@ +// Reserved for later use #endif
\ No newline at end of file diff --git a/include/cleanpath.h b/include/cleanpath.h index 321f921..6d50db4 100644 --- a/include/cleanpath.h +++ b/include/cleanpath.h @@ -36,6 +36,11 @@ #define CLEANPATH_VAR "PATH" #define CLEANPATH_SEP ":" +#if OS_WINDOWS +#undef CLEANPATH_SEP +#define CLEANPATH_SEP ";" +#endif + struct CleanPath { char *data; // Pointer to the path string size_t data_len; // Length of the path string diff --git a/lib/cleanpath.c b/lib/cleanpath.c index c7f8bc9..b849199 100644 --- a/lib/cleanpath.c +++ b/lib/cleanpath.c @@ -4,18 +4,6 @@ #include "config.h" #include "cleanpath.h" -#if OS_LINUX -#if HAVE_SYS_LIMIT_H -#include <sys/limits.h> -#endif // HAVE_SYS_LIMIT_H - -#if HAVE_LINUX_LIMIT_H -#include <linux/limits.h> -#endif // HAVE_LINUX_LIMIT_H -#else -#include <limits.h> -#endif - /** * Split path into parts by sep * @param path a string (e.g. "/path1:/path2:/pathN") @@ -33,7 +21,7 @@ struct CleanPath *cleanpath_init(const char *path, const char *sep) { } result = calloc(1, sizeof(*result)); - result->data = strndup(path, ARG_MAX); + result->data = strdup(path); result->data_len = strlen(result->data) + 2; // + 2 to handle an empty PATH result->sep = strdup(sep); |