From 20c8d350318da96dc41b182214f70d3751724f7d Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 29 Apr 2024 21:13:22 -0400 Subject: [PATCH] fix: add build patch for `FNM_EXTMATCH` run into the following build failure ``` cc -Isrc/tio.p -Isrc -I../src -I/opt/homebrew/Cellar/glib/2.80.0_2/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.80.0_2/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.43/include -I/opt/homebrew/Cellar/inih/58/include -I/opt/homebrew/include/lua -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -std=gnu99 -O3 -Wno-unused-result -DHAVE_IOSSIOSPEED -MD -MQ src/tio.p/misc.c.o -MF src/tio.p/misc.c.o.d -o src/tio.p/misc.c.o -c ../src/misc.c ../src/misc.c:201:38: error: use of undeclared identifier 'FNM_EXTMATCH' if (fnmatch(pattern, string, FNM_EXTMATCH) == 0) ^ 1 error generated. ``` Signed-off-by: Rui Chen --- src/misc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/misc.c b/src/misc.c index 082488a..091675a 100644 --- a/src/misc.c +++ b/src/misc.c @@ -198,7 +198,11 @@ bool match_patterns(const char *string, const char *patterns) while (pattern != NULL) { // Check if the string matches the current pattern - if (fnmatch(pattern, string, FNM_EXTMATCH) == 0) + #ifdef FNM_EXTMATCH + if (fnmatch(pattern, string, FNM_EXTMATCH) == 0) + #else + if (fnmatch(pattern, string, 0) == 0) + #endif { free(patterns_copy); return true;