aboutsummaryrefslogtreecommitdiffstats
path: root/search.c
diff options
context:
space:
mode:
authoroga2009-06-26 12:45:12 +0000
committeroga2009-06-26 12:45:12 +0000
commit1ed46514e2424200a583b872ebb6ea9eee569375 (patch)
treea21eaa34e69d8490134f3b9bc512b274dc2fb571 /search.c
parentf041981121a18d2b5c0697db9469c8c6ab474386 (diff)
downloadcwm-1ed46514e2424200a583b872ebb6ea9eee569375.tar.gz
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.
Diffstat (limited to 'search.c')
-rw-r--r--search.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/search.c b/search.c
index a3efec2..b3ae65b 100644
--- a/search.c
+++ b/search.c
@@ -14,9 +14,10 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: search.c,v 1.16 2009/06/17 12:30:17 okan Exp $
+ * $Id: search.c,v 1.17 2009/06/26 12:45:12 oga Exp $
*/
+#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) {