Browse Source

Apply case insensitive patch

master
krrishg 4 years ago
parent
commit
f28cd917ad
  1. 23
      config.h
  2. BIN
      dmenu
  3. 11
      dmenu.c
  4. BIN
      dmenu.o
  5. BIN
      drw.o
  6. 42
      patches/dmenu-caseinsensitive-20200523-db6093f.diff
  7. BIN
      stest
  8. BIN
      stest.o
  9. BIN
      util.o

23
config.h

@ -0,0 +1,23 @@
/* See LICENSE file for copyright and license details. */
/* Default settings; can be overriden by command line. */
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
/* -fn option overrides fonts[0]; default X11 font or font set */
static const char *fonts[] = {
"monospace:size=10"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const char *colors[SchemeLast][2] = {
/* fg bg */
[SchemeNorm] = { "#bbbbbb", "#222222" },
[SchemeSel] = { "#eeeeee", "#005577" },
[SchemeOut] = { "#000000", "#00ffff" },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
/*
* Characters not considered part of a word while deleting words
* for example: " /?\"&[]"
*/
static const char worddelimiters[] = " ";

BIN
dmenu

Binary file not shown.

11
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 void
appenditem(struct item *item, struct item **list, struct item **last)
@ -709,9 +710,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 */

BIN
dmenu.o

Binary file not shown.

BIN
drw.o

Binary file not shown.

42
patches/dmenu-caseinsensitive-20200523-db6093f.diff

@ -0,0 +1,42 @@
From 54acbdf72083a5eae5783eed42e162424ab2cec2 Mon Sep 17 00:00:00 2001
From: Kim Torgersen <kim@torgersen.se>
Date: Sat, 23 May 2020 14:48:28 +0200
Subject: [PATCH] case-insensitive item matching default, case-sensitive option
(-s)
---
dmenu.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dmenu.c b/dmenu.c
index 65f25ce..855df59 100644
--- 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 void
appenditem(struct item *item, struct item **list, struct item **last)
@@ -709,9 +710,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 */
--
2.26.2

BIN
stest

Binary file not shown.

BIN
stest.o

Binary file not shown.

BIN
util.o

Binary file not shown.
Loading…
Cancel
Save