diff options
author | anselm@anselm1 <unknown> | 2008-03-12 21:37:43 +0000 |
---|---|---|
committer | anselm@anselm1 <unknown> | 2008-03-12 21:37:43 +0000 |
commit | 38b866ba3453e2a7567b084a353e50a36ed92221 (patch) | |
tree | 6bb12f58a285958e90e0504c58d2c50b3d5d2869 /dmenu.c | |
parent | 540a78761b26b2af4f47e46d27ad6406548c8a1c (diff) | |
download | dmenu-38b866ba3453e2a7567b084a353e50a36ed92221.tar.gz dmenu-38b866ba3453e2a7567b084a353e50a36ed92221.tar.bz2 dmenu-38b866ba3453e2a7567b084a353e50a36ed92221.zip |
applied Sanders patch
Diffstat (limited to 'dmenu.c')
-rw-r--r-- | dmenu.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -37,7 +37,6 @@ struct Item { Item *next; /* traverses all items */ Item *left, *right; /* traverses items matching current search pattern */ char *text; - Bool matched; }; /* forward declarations */ @@ -89,6 +88,7 @@ Item *next = NULL; Item *prev = NULL; Item *curr = NULL; Window root, win; +int (*fstrncmp)(const char *, const char *, size_t n) = strncmp; char *(*fstrstr)(const char *, const char *) = strstr; Item * @@ -97,7 +97,6 @@ appenditem(Item *i, Item *last) { item = i; else last->right = i; - i->matched = True; i->left = last; i->right = NULL; last = i; @@ -505,13 +504,10 @@ match(char *pattern) { plen = strlen(pattern); item = j = NULL; nitem = 0; - for(i = allitems; i; i=i->next) - i->matched = False; for(i = allitems; i; i = i->next) - if(!i->matched && !strncasecmp(pattern, i->text, plen)) + if(!fstrncmp(pattern, i->text, plen)) j = appenditem(i, j); - for(i = allitems; i; i = i->next) - if(!i->matched && fstrstr(i->text, pattern)) + else if(fstrstr(i->text, pattern)) j = appenditem(i, j); curr = prev = next = sel = item; calcoffsets(); @@ -662,8 +658,10 @@ main(int argc, char *argv[]) { /* command line args */ for(i = 1; i < argc; i++) - if(!strcmp(argv[i], "-i")) + if(!strcmp(argv[i], "-i")) { + fstrncmp = strncasecmp; fstrstr = cistrstr; + } else if(!strcmp(argv[i], "-fn")) { if(++i < argc) font = argv[i]; } |