mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
honor PATH search order for exec; from Andres Perera.
This commit is contained in:
parent
ec4474a33a
commit
9cad4c73b3
6
search.c
6
search.c
@ -217,6 +217,7 @@ void
|
|||||||
search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||||
{
|
{
|
||||||
struct menu *mi, *mj;
|
struct menu *mi, *mj;
|
||||||
|
int r;
|
||||||
|
|
||||||
TAILQ_INIT(resultq);
|
TAILQ_INIT(resultq);
|
||||||
|
|
||||||
@ -225,10 +226,11 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
|||||||
fnmatch(search, mi->text, 0) == FNM_NOMATCH)
|
fnmatch(search, mi->text, 0) == FNM_NOMATCH)
|
||||||
continue;
|
continue;
|
||||||
TAILQ_FOREACH(mj, resultq, resultentry) {
|
TAILQ_FOREACH(mj, resultq, resultentry) {
|
||||||
if (strcasecmp(mi->text, mj->text) < 0) {
|
r = strcasecmp(mi->text, mj->text);
|
||||||
|
if (r < 0)
|
||||||
TAILQ_INSERT_BEFORE(mj, mi, resultentry);
|
TAILQ_INSERT_BEFORE(mj, mi, resultentry);
|
||||||
|
if (r <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mj == NULL)
|
if (mj == NULL)
|
||||||
TAILQ_INSERT_TAIL(resultq, mi, resultentry);
|
TAILQ_INSERT_TAIL(resultq, mi, resultentry);
|
||||||
|
Loading…
Reference in New Issue
Block a user