diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2025-01-06 10:14:49 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2025-01-06 10:14:49 +0100 |
commit | 5c02778ff8ebbfa3404f96561d94ce852be8648e (patch) | |
tree | aee8f926c0dbb8cbc9fa91d0610fc115c78875ee | |
parent | e40d56152d68aa7fcf05b551e08c94d498ca9163 (diff) | |
download | liberty-5c02778ff8ebbfa3404f96561d94ce852be8648e.tar.gz liberty-5c02778ff8ebbfa3404f96561d94ce852be8648e.tar.xz liberty-5c02778ff8ebbfa3404f96561d94ce852be8648e.zip |
wdye: improve portability
-rw-r--r-- | tools/wdye/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tools/wdye/wdye.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/tools/wdye/CMakeLists.txt b/tools/wdye/CMakeLists.txt index 9044078..a69f7ee 100644 --- a/tools/wdye/CMakeLists.txt +++ b/tools/wdye/CMakeLists.txt @@ -19,7 +19,10 @@ pkg_search_module (lua REQUIRED option (WITH_CURSES "Offer terminal sequences using Curses" "${CURSES_FOUND}") -include_directories ("${PROJECT_BINARY_DIR}") +# -liconv may or may not be a part of libc +find_path (iconv_INCLUDE_DIRS iconv.h) + +include_directories ("${PROJECT_BINARY_DIR}" ${iconv_INCLUDE_DIRS}) file (CONFIGURE OUTPUT "${PROJECT_BINARY_DIR}/config.h" CONTENT [[ #define PROGRAM_NAME "${PROJECT_NAME}" #define PROGRAM_VERSION "${PROJECT_VERSION}" diff --git a/tools/wdye/wdye.c b/tools/wdye/wdye.c index 6ac5c0b..ac2b66b 100644 --- a/tools/wdye/wdye.c +++ b/tools/wdye/wdye.c @@ -73,7 +73,7 @@ execvpe (const char *file, char *const argv[], char *const envp[]) // This is a particularly inefficient algorithm, but it can match binary data. static const char * -memmem (const struct str *haystack, const struct str *needle, bool nocase) +str_memmem (const struct str *haystack, const struct str *needle, bool nocase) { if (haystack->len < needle->len) return NULL; @@ -999,7 +999,7 @@ pattern_match (struct pattern *self) } case PATTERN_EXACT: { - const char *match = memmem (buffer, &self->exact, self->nocase); + const char *match = str_memmem (buffer, &self->exact, self->nocase); if (!match) return false; |