add case insensitive patch
This commit is contained in:
parent
07d57cf2f5
commit
bc3aad5943
6
dmenu.1
6
dmenu.1
@ -3,7 +3,7 @@
|
||||
dmenu \- dynamic menu
|
||||
.SH SYNOPSIS
|
||||
.B dmenu
|
||||
.RB [ \-bFfiv ]
|
||||
.RB [ \-bFfsv ]
|
||||
.RB [ \-l
|
||||
.IR lines ]
|
||||
.RB [ \-m
|
||||
@ -58,8 +58,8 @@ disables fuzzy matching.
|
||||
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.
|
||||
|
11
dmenu.c
11
dmenu.c
@ -58,8 +58,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)
|
||||
@ -890,9 +891,9 @@ main(int argc, char *argv[])
|
||||
fast = 1;
|
||||
else if (!strcmp(argv[i], "-c")) /* centers dmenu on screen */
|
||||
centered = 1;
|
||||
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
||||
fstrncmp = strncasecmp;
|
||||
fstrstr = cistrstr;
|
||||
else if (!strcmp(argv[i], "-s")) { /* case sensitivity */
|
||||
fstrncmp = strncmp;
|
||||
fstrstr = strstr;
|
||||
} else if (i + 1 == argc)
|
||||
usage();
|
||||
/* these options take one argument */
|
||||
|
Loading…
Reference in New Issue
Block a user