commit d515b78ab792ea8b0ab7d4042cde1079a0cbdbc1
parent 31e2614cbe56690c99a55b1cbb04259d2eadadab
Author: Friedel Schön <[email protected]>
Date: Mon, 9 Dec 2024 12:48:49 +0100
apply caseinsensitive patch
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dmenu.1 b/dmenu.1
@@ -3,7 +3,7 @@
dmenu \- dynamic menu
.SH SYNOPSIS
.B dmenu
-.RB [ \-bfiv ]
+.RB [ \-bfsv ]
.RB [ \-l
.IR lines ]
.RB [ \-m
@@ -46,8 +46,8 @@ dmenu appears at the bottom of the screen.
dmenu grabs the keyboard before reading stdin if not reading from a tty. This
is faster, but will lock up X until stdin reaches end\-of\-file.
.TP
-.B \-i
-dmenu matches menu items case insensitively.
+.B \-s
+dmenu matches menu items case sensitively.
.TP
.BI \-l " lines"
dmenu lists items vertically, with the given number of lines.
diff --git a/dmenu.c b/dmenu.c
@@ -55,8 +55,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)
@@ -787,9 +788,9 @@ main(int argc, char *argv[])
topbar = 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 */