changeset: 667:faf3f46ada6b
tag: tip
user: StephenB <mail4stb_AT_gmail.com>
date: Tue Dec 28 19:47:47 2010 +0000
files: tools.suckless.org/dmenu/patches/dmenu-4.2.1-tok.diff tools.suckless.org/dmenu/patches/dmenu-tip-tok.diff tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md
description:
replaced dmenu-tip-tok.diff (old) with dmenu-4.2.1-tok.diff
diff -r d9fa8a2ad430 -r faf3f46ada6b tools.suckless.org/dmenu/patches/dmenu-4.2.1-tok.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/dmenu/patches/dmenu-4.2.1-tok.diff Tue Dec 28 19:47:47 2010 +0000
_AT_@ -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
+_AT_@ -5,6 +5,7 @@ dmenu \- dynamic menu
+ .B dmenu
+ .RB [ \-b ]
+ .RB [ \-i ]
++.RB [ \-t ]
+ .RB [ \-l
+ .IR lines ]
+ .RB [ \-m
+_AT_@ -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
+_AT_@ -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);
+_AT_@ -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[]) {
+_AT_@ -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 */
+_AT_@ -368,7 +372,7 @@ keypress(XKeyEvent *ev) {
+ }
+
+ void
+-match(void) {
++matchstr(void) {
+ size_t len;
+ Item *item, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend;
+
+_AT_@ -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;
+_AT_@ -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 -r d9fa8a2ad430 -r faf3f46ada6b tools.suckless.org/dmenu/patches/dmenu-tip-tok.diff
--- a/tools.suckless.org/dmenu/patches/dmenu-tip-tok.diff Fri Dec 24 17:17:27 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
_AT_@ -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
-_AT_@ -5,6 +5,7 @@
- .B dmenu
- .RB [ \-b ]
- .RB [ \-i ]
-+.RB [ \-t ]
- .RB [ \-l
- .IR lines ]
- .RB [ \-p
-_AT_@ -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
-_AT_@ -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);
-_AT_@ -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) {
-_AT_@ -322,7 +324,7 @@
- }
-
- void
--match(void) {
-+matchstr(void) {
- size_t len;
- Item *item, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend;
-
-_AT_@ -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;
-_AT_@ -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);
- }
-_AT_@ -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 -r d9fa8a2ad430 -r faf3f46ada6b tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md
--- a/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md Fri Dec 24 17:17:27 2010 +0000
+++ b/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md Tue Dec 28 19:47:47 2010 +0000
_AT_@ -14,19 +14,19 @@
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_AT_orange.fr](mailto:julien.steinhauser_AT_orange.fr)>, taken from [
https://bbs.archlinux.org/viewtopic.php?pid=429090#p429090](fresch's patch))
Received on Tue Dec 28 2010 - 20:47:52 CET