mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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.
This commit is contained in:
6
search.c
6
search.c
@@ -17,6 +17,7 @@
|
|||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <fnmatch.h>
|
||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "calmwm.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_INIT(resultq);
|
||||||
|
|
||||||
TAILQ_FOREACH(mi, menuq, entry) {
|
TAILQ_FOREACH(mi, menuq, entry) {
|
||||||
if (strsubmatch(search, mi->text, 1) == 0)
|
if (strsubmatch(search, mi->text, 1) == 0 &&
|
||||||
continue;
|
fnmatch(search, mi->text, 0) == FNM_NOMATCH)
|
||||||
|
continue;
|
||||||
for (mj = TAILQ_FIRST(resultq); mj != NULL;
|
for (mj = TAILQ_FIRST(resultq); mj != NULL;
|
||||||
mj = TAILQ_NEXT(mj, resultentry)) {
|
mj = TAILQ_NEXT(mj, resultentry)) {
|
||||||
if (strcasecmp(mi->text, mj->text) < 0) {
|
if (strcasecmp(mi->text, mj->text) < 0) {
|
||||||
|
Reference in New Issue
Block a user