diff options
author | oga <oga> | 2009-06-26 12:45:12 +0000 |
---|---|---|
committer | oga <oga> | 2009-06-26 12:45:12 +0000 |
commit | 590eb4f37b8da3eba787e63acaf6e5be3ee911fc (patch) | |
tree | 31b895405d3c55e484be6081c094ceeeab5eb289 | |
parent | f44862be9c4d3332d3f9ee9760e7014814eaeeb3 (diff) | |
download | cwm-590eb4f37b8da3eba787e63acaf6e5be3ee911fc.tar.gz cwm-590eb4f37b8da3eba787e63acaf6e5be3ee911fc.tar.xz cwm-590eb4f37b8da3eba787e63acaf6e5be3ee911fc.zip |
use fnmatch to glob the entries in the exec menu.
allows shell globbing constructs such as *ctl, etc in the exec menu (m-? by default). Adapted from a diff from Thomas Pfaff, okan@ got almost the same diff as me when reworking it, and oked this one.
-rw-r--r-- | search.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/search.c b/search.c index 01a130e..2ee57ba 100644 --- a/search.c +++ b/search.c @@ -17,6 +17,7 @@ * $Id$ */ +#include <fnmatch.h> #include "headers.h" #include "calmwm.h" @@ -178,8 +179,9 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) TAILQ_INIT(resultq); TAILQ_FOREACH(mi, menuq, entry) { - if (strsubmatch(search, mi->text, 1) == 0) - continue; + if (strsubmatch(search, mi->text, 1) == 0 && + fnmatch(search, mi->text, 0) == FNM_NOMATCH) + continue; for (mj = TAILQ_FIRST(resultq); mj != NULL; mj = TAILQ_NEXT(mj, resultentry)) { if (strcasecmp(mi->text, mj->text) < 0) { |