Apply case-insenstive patch

This commit is contained in:
Mike Wilson
2025-06-18 11:32:38 -04:00
parent cf82fbbff8
commit d050236423
2 changed files with 8 additions and 6 deletions

View File

@@ -8,4 +8,5 @@
### Patches
* [Fuzzymatch](https://tools.suckless.org/dmenu/patches/fuzzymatch/)
* [fuzzymatch](https://tools.suckless.org/dmenu/patches/fuzzymatch/)
* [case-insensitive](https://tools.suckless.org/dmenu/patches/case-insensitive/)

11
dmenu.c
View File

@@ -56,8 +56,9 @@ static Clr *scheme[SchemeLast];
#include "config.h"
static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
static char *(*fstrstr)(const char *, const char *) = strstr;
static char * cistrstr(const char *s, const char *sub);
static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp;
static char *(*fstrstr)(const char *, const char *) = cistrstr;
static unsigned int
textw_clamp(const char *str, unsigned int n)
@@ -821,9 +822,9 @@ main(int argc, char *argv[])
fuzzy = 0;
else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
fast = 1;
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
fstrncmp = strncasecmp;
fstrstr = cistrstr;
else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */
fstrncmp = strncmp;
fstrstr = strstr;
} else if (i + 1 == argc)
usage();
/* these options take one argument */