From 2648076370b06752a3c3fe70dc47868b66ced7fa Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sun, 28 May 2023 12:58:26 +0200 Subject: WIP search wildcard_cmp: Allow case-insensitive searches --- cftw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cftw.c') diff --git a/cftw.c b/cftw.c index c4986fd..d11cb87 100644 --- a/cftw.c +++ b/cftw.c @@ -29,12 +29,13 @@ int cftw(const char *const dirpath, int (*const fn)(const char *, if (!strcmp(path, ".") || !strcmp(path, "..")) continue; + const char *const sep = dirpath[strlen(dirpath) - 1] == '/' ? "" : "/"; struct stat sb; struct dynstr d; dynstr_init(&d); - if (dynstr_append(&d, "%s/%s", dirpath, path)) + if (dynstr_append(&d, "%s%s%s", dirpath, sep, path)) { fprintf(stderr, "%s: dynstr_append failed\n", __func__); return -1; -- cgit v1.2.3