aboutsummaryrefslogtreecommitdiff
path: root/cftw.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-05-28 12:58:26 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-06-06 01:55:05 +0200
commit2648076370b06752a3c3fe70dc47868b66ced7fa (patch)
tree9a0d7f4dfc1cc4e48c4afcca9be74e96c8824b8c /cftw.c
parent17502e7e32c041761dc383a481861997aee7ad28 (diff)
downloadslcl-search.tar.gz
WIP searchsearch
wildcard_cmp: Allow case-insensitive searches
Diffstat (limited to 'cftw.c')
-rw-r--r--cftw.c3
1 files changed, 2 insertions, 1 deletions
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;