sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit c576c01f3b3d5474b0f31acf4f0ac1337407259d
parent 2c3fff235a764f776279b233ac02aae05c9a2920
Author: StephenB <mail4stb@gmail.com>
Date:   Tue, 28 Dec 2010 19:47:47 +0000

replaced dmenu-tip-tok.diff (old) with dmenu-4.2.1-tok.diff
Diffstat:
Atools.suckless.org/dmenu/patches/dmenu-4.2.1-tok.diff | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dtools.suckless.org/dmenu/patches/dmenu-tip-tok.diff | 103-------------------------------------------------------------------------------
Mtools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md | 8++++----
3 files changed, 105 insertions(+), 107 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/dmenu-4.2.1-tok.diff b/tools.suckless.org/dmenu/patches/dmenu-4.2.1-tok.diff @@ -0,0 +1,101 @@ +--- a/dmenu.1 2010-12-28 17:26:44.368974910 +0000 ++++ b/dmenu.1 2010-12-28 17:28:41.902912662 +0000 +@@ -5,6 +5,7 @@ dmenu \- dynamic menu + .B dmenu + .RB [ \-b ] + .RB [ \-i ] ++.RB [ \-t ] + .RB [ \-l + .IR lines ] + .RB [ \-m +@@ -50,6 +51,9 @@ dmenu appears at the bottom of the scree + .B \-i + dmenu matches menu items case insensitively. + .TP ++.B \-t ++dmenu uses space separated tokens to match menu items. ++.TP + .BI \-l " lines" + dmenu lists items vertically, with the given number of lines. + .TP +--- a/dmenu.c 2010-12-28 17:26:44.368974910 +0000 ++++ b/dmenu.c 2010-12-28 17:53:30.548303785 +0000 +@@ -30,7 +30,8 @@ static char *fstrstr(const char *s, cons + static void grabkeyboard(void); + static void insert(const char *s, ssize_t n); + static void keypress(XKeyEvent *ev); +-static void match(void); ++static void matchstr(void); ++static void matchtok(void); + static size_t nextrune(int incr); + static void paste(void); + static void readstdin(void); +@@ -62,6 +63,7 @@ static Item *prev, *curr, *next; + static Window root, win; + + static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; ++static void (*match)(void) = matchstr; + + int + main(int argc, char *argv[]) { +@@ -78,6 +80,8 @@ main(int argc, char *argv[]) { + topbar = False; + else if(!strcmp(argv[i], "-i")) + fstrncmp = strncasecmp; ++ else if(!strcmp(argv[i], "-t")) ++ match = matchtok; + else if(i == argc-1) + usage(); + /* double flags */ +@@ -368,7 +372,7 @@ keypress(XKeyEvent *ev) { + } + + void +-match(void) { ++matchstr(void) { + size_t len; + Item *item, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; + +@@ -407,6 +411,33 @@ match(void) { + calcoffsets(); + } + ++void ++matchtok(void) { ++ char buf[sizeof text]; ++ char **tokv, *s; ++ int tokc, i; ++ Item *item, *end; ++ ++ tokc = 0; ++ tokv = NULL; ++ strcpy(buf, text); ++ for(s = strtok(buf, " "); s; tokv[tokc-1] = s, s = strtok(NULL, " ")) ++ if(!(tokv = realloc(tokv, ++tokc * sizeof *tokv))) ++ eprintf("cannot realloc %u bytes\n", tokc * sizeof *tokv); ++ ++ matches = end = NULL; ++ for(item = items; item; item = item->next) { ++ for(i = 0; i < tokc; i++) ++ if(!fstrstr(item->text, tokv[i])) ++ break; ++ if(i == tokc) ++ appenditem(item, &matches, &end); ++ } ++ free(tokv); ++ curr = prev = next = sel = matches; ++ calcoffsets(); ++} ++ + size_t + nextrune(int incr) { + size_t n, len; +@@ -536,7 +567,7 @@ setup(void) { + + void + usage(void) { +- fputs("usage: dmenu [-b] [-i] [-l lines] [-m monitor] [-p prompt] [-fn font]\n" ++ fputs("usage: dmenu [-b] [-i] [-t] [-l lines] [-m monitor] [-p prompt] [-fn font]\n" + " [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr); + exit(EXIT_FAILURE); + } diff --git a/tools.suckless.org/dmenu/patches/dmenu-tip-tok.diff b/tools.suckless.org/dmenu/patches/dmenu-tip-tok.diff @@ -1,103 +0,0 @@ -diff -r 23bd778df432 dmenu.1 ---- a/dmenu.1 Fri Aug 20 19:57:13 2010 +0100 -+++ b/dmenu.1 Wed Sep 01 22:39:02 2010 +0100 -@@ -5,6 +5,7 @@ - .B dmenu - .RB [ \-b ] - .RB [ \-i ] -+.RB [ \-t ] - .RB [ \-l - .IR lines ] - .RB [ \-p -@@ -48,6 +49,9 @@ - .B \-i - dmenu matches menu items case insensitively. - .TP -+.B \-t -+dmenu uses space separated tokens to match menu items. -+.TP - .BI \-l " lines" - dmenu lists items vertically, with the given number of lines. - .TP -diff -r 23bd778df432 dmenu.c ---- a/dmenu.c Fri Aug 20 19:57:13 2010 +0100 -+++ b/dmenu.c Wed Sep 01 22:39:02 2010 +0100 -@@ -30,7 +30,8 @@ - static void grabkeyboard(void); - static void insert(const char *s, ssize_t n); - static void keypress(XKeyEvent *ev); --static void match(void); -+static void matchstr(void); -+static void matchtok(void); - static size_t nextrune(int incr); - static void paste(void); - static void readstdin(void); -@@ -61,6 +62,7 @@ - static Window root, win; - - static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; -+static void (*match)(void) = matchstr; - - void - appenditem(Item *item, Item **list, Item **last) { -@@ -322,7 +324,7 @@ - } - - void --match(void) { -+matchstr(void) { - size_t len; - Item *item, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; - -@@ -361,6 +363,33 @@ - calcoffsets(); - } - -+void -+matchtok(void) { -+ char buf[sizeof text]; -+ char **tokv, *s; -+ int tokc, i; -+ Item *item, *end; -+ -+ tokc = 0; -+ tokv = NULL; -+ strcpy(buf, text); -+ for(s = strtok(buf, " "); s; tokv[tokc-1] = s, s = strtok(NULL, " ")) -+ if(!(tokv = realloc(tokv, ++tokc * sizeof *tokv))) -+ eprintf("cannot realloc %u bytes\n", tokc * sizeof *tokv); -+ -+ matches = end = NULL; -+ for(item = items; item; item = item->next) { -+ for(i = 0; i < tokc; i++) -+ if(!fstrstr(item->text, tokv[i])) -+ break; -+ if(i == tokc) -+ appenditem(item, &matches, &end); -+ } -+ free(tokv); -+ curr = prev = next = sel = matches; -+ calcoffsets(); -+} -+ - size_t - nextrune(int incr) { - size_t n, len; -@@ -489,7 +518,7 @@ - - void - usage(void) { -- fputs("usage: dmenu [-b] [-i] [-l lines] [-p prompt] [-fn font] [-nb color]\n" -+ fputs("usage: dmenu [-b] [-i] [-t] [-l lines] [-p prompt] [-fn font] [-nb color]\n" - " [-nf color] [-sb color] [-sf color] [-v]\n", stderr); - exit(EXIT_FAILURE); - } -@@ -509,6 +538,8 @@ - topbar = False; - else if(!strcmp(argv[i], "-i")) - fstrncmp = strncasecmp; -+ else if(!strcmp(argv[i], "-t")) -+ match = matchtok; - else if(i == argc-1) - usage(); - /* double flags */ diff --git a/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md b/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md @@ -14,19 +14,19 @@ It can be useful to ease the matching on huge strings. The patch comes in two flavours: -* **tok** (tokenise), for dmenu tip and upcoming release. Enabled with **-t** command line flag. +* **tok** (tokenise), for dmenu 4.2.1. Enabled with **-t** command line flag. * **xmms**, for legacy dmenu. The original patch submitted by Julien Steinhauser. Enabled with the **-xs** command line flag. Download tok ------------ -* [dmenu-tip-tok.diff](dmenu-tip-tok.diff) (for hg tip (checked against 366) - **use at your own risk**) +* [dmenu-4.2.1-tok.diff](dmenu-4.2.1-tok.diff) -Download xmms +Download xmms (legacy) ------------- -* [dmenu-4.1.1-xmms.diff](dmenu-4.1.1-xmms.diff) (latest dmenu release at time of writing) +* [dmenu-4.1.1-xmms.diff](dmenu-4.1.1-xmms.diff) * [dmenu_xmms.diff](dmenu_xmms.diff) (for **dmenu_3.9** - the original patch submitted by Julien Steinhauser <[julien.steinhauser@orange.fr](mailto:julien.steinhauser@orange.fr)>, taken from [https://bbs.archlinux.org/viewtopic.php?pid=429090#p429090](fresch's patch))