On Wed, 17 Jun 2009 11:50:55 +0200
Thomas Pfaff <[email protected]> wrote:
> This diff adds globbing to the exec function so you can type e.g.
> *ctl and get a list of all executable files that ends with ctl.
So, what's the verdict on this one? The fnmatch lookup is case-
sensitive but I think that makes sense; if you use wildcards it
means you want your search to be more specific.
> Index: search.c
> ===================================================================
> RCS file: /cvs/OpenBSD/xenocara/app/cwm/search.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 search.c
> --- search.c 17 Jun 2009 09:18:34 -0000 1.1.1.1
> +++ search.c 17 Jun 2009 09:48:17 -0000
> @@ -17,6 +17,7 @@
> * $Id: search.c,v 1.15 2009/05/18 00:23:35 okan Exp $
> */
>
> +#include <fnmatch.h>
> #include "headers.h"
> #include "calmwm.h"
>
> @@ -181,7 +182,8 @@ search_match_exec(struct menu_q *menuq,
>
> TAILQ_FOREACH(mi, menuq, entry) {
> if (strsubmatch(search, mi->text, 1) == 0)
> - continue;
> + if (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) {