aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2021-05-06 17:21:47 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-05-06 17:21:47 -0400
commit008ebd1262268cf1c9a4bbdc0bf78d5c11cd5b1d (patch)
tree2beee75883d125917148ea4e7b29084642fb3b4f /lib
parent9664dec490808a834ca009ac293eca9ef25a6e8e (diff)
downloadcleanpath-008ebd1262268cf1c9a4bbdc0bf78d5c11cd5b1d.tar.gz
Disable regex on windows
Diffstat (limited to 'lib')
-rw-r--r--lib/cleanpath.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/cleanpath.c b/lib/cleanpath.c
index c64da40..d1c9637 100644
--- a/lib/cleanpath.c
+++ b/lib/cleanpath.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
@@ -71,11 +72,15 @@ void cleanpath_filter(struct CleanPath *path, unsigned mode, const char *pattern
match = strstr(path->part[i], pattern) != NULL ? 1 : 0;
break;
case CLEANPATH_FILTER_REGEX:
+#if !OS_WINDOWS
if (regcomp(&regex, pattern, REG_EXTENDED | REG_NOSUB) != 0) {
return;
}
match = regexec(&regex, path->part[i], 0, NULL, 0) == 0 ? 1 : 0;
regfree(&regex);
+#else
+ fprintf(stderr, "WARNING: --regex|-r is not implemented on Windows. Using default filter mode.\n")
+#endif
break;
case CLEANPATH_FILTER_EXACT:
default: