[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Mon, 12 Sep 2011 11:45:56 +0200 (CEST)

changeset: 766:61b77b61c3fb
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Mon Sep 12 10:45:45 2011 +0100
files: tools.suckless.org/dmenu/patches/dmenu-4.4-tok.diff tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md
description:
add dmenu-4.4-tok.diff


diff -r deb843bc098f -r 61b77b61c3fb tools.suckless.org/dmenu/patches/dmenu-4.4-tok.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/dmenu/patches/dmenu-4.4-tok.diff Mon Sep 12 10:45:45 2011 +0100
_AT_@ -0,0 +1,103 @@
+diff -r f6b31468f983 dmenu.1
+--- a/dmenu.1 Sun Jul 24 20:04:58 2011 +0100
++++ b/dmenu.1 Mon Sep 12 10:43:11 2011 +0100
+_AT_@ -6,6 +6,7 @@
+ .RB [ \-b ]
+ .RB [ \-f ]
+ .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 f6b31468f983 dmenu.c
+--- a/dmenu.c Sun Jul 24 20:04:58 2011 +0100
++++ b/dmenu.c Mon Sep 12 10:43:11 2011 +0100
+_AT_@ -30,7 +30,8 @@
+ static void grabkeyboard(void);
+ static void insert(const char *str, ssize_t n);
+ static void keypress(XKeyEvent *ev);
+-static void match(Bool sub);
++static void matchstr(Bool sub);
++static void matchtok(Bool sub);
+ static size_t nextrune(int inc);
+ static void paste(void);
+ static void readstdin(void);
+_AT_@ -61,6 +62,7 @@
+
+ static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
+ static char *(*fstrstr)(const char *, const char *) = strstr;
++static void (*match)(Bool) = matchstr;
+
+ int
+ main(int argc, char *argv[]) {
+_AT_@ -81,6 +83,8 @@
+ fstrncmp = strncasecmp;
+ fstrstr = cistrstr;
+ }
++ else if(!strcmp(argv[i], "-t"))
++ match = matchtok;
+ else if(i+1 == argc)
+ usage();
+ /* double flags */
+_AT_@ -362,7 +366,7 @@
+ }
+
+ void
+-match(Bool sub) {
++matchstr(Bool sub) {
+ size_t len = strlen(text);
+ Item *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend;
+ Item *item, *lnext;
+_AT_@ -402,6 +406,33 @@
+ calcoffsets();
+ }
+
++void
++matchtok(Bool sub) {
++ 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->text; item++) {
++ 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 inc) {
+ ssize_t n;
+_AT_@ -532,7 +563,7 @@
+
+ void
+ usage(void) {
+- fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font]\n"
++ fputs("usage: dmenu [-b] [-f] [-i] [-t] [-l lines] [-p prompt] [-fn font]\n"
+ " [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr);
+ exit(EXIT_FAILURE);
+ }
diff -r deb843bc098f -r 61b77b61c3fb tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md
--- a/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md Mon Sep 05 12:39:55 2011 +0200
+++ b/tools.suckless.org/dmenu/patches/xmms-like_pattern_matching.md Mon Sep 12 10:45:45 2011 +0100
_AT_@ -23,6 +23,8 @@
 
 * [dmenu-4.2.1-tok.diff](dmenu-4.2.1-tok.diff)
 
+* [dmenu-4.4-tok.diff](dmenu-4.4-tok.diff)
+
 Download xmms (legacy)
 -------------
 
Received on Mon Sep 12 2011 - 11:45:56 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:50 CEST