diff options
author | okan <okan> | 2013-04-05 17:36:02 +0000 |
---|---|---|
committer | okan <okan> | 2013-04-05 17:36:02 +0000 |
commit | a957ed7c7dcc287afcf33547326717701a0445de (patch) | |
tree | 9f032ccf42487135023d2ff3c357438fdab683f0 /search.c | |
parent | cfc19dba7e48ca1afeaf5a910c2591d8f32c2547 (diff) | |
parent | f18d2c94c2efe8d580aa9b1cd71f83bfe10474aa (diff) | |
download | cwm-a957ed7c7dcc287afcf33547326717701a0445de.tar.gz cwm-a957ed7c7dcc287afcf33547326717701a0445de.tar.xz cwm-a957ed7c7dcc287afcf33547326717701a0445de.zip |
cvsimport
Diffstat (limited to 'search.c')
-rw-r--r-- | search.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/search.c b/search.c index b74c2ef..d419d70 100644 --- a/search.c +++ b/search.c @@ -33,8 +33,11 @@ #include "calmwm.h" -#define PATH_EXEC 0x1 +#define PATH_ANY 0x0001 +#define PATH_EXEC 0x0002 +static void search_match_path(struct menu_q *, struct menu_q *, + char *, int); static int strsubmatch(char *, char *, int); /* @@ -189,16 +192,16 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in globfree(&g); } -void +void search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) { return (search_match_path(menuq, resultq, search, PATH_EXEC)); } -void +void search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search) { - return (search_match_path(menuq, resultq, search, 0)); + return (search_match_path(menuq, resultq, search, PATH_ANY)); } void @@ -217,6 +220,7 @@ void search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) { struct menu *mi, *mj; + int r; TAILQ_INIT(resultq); @@ -225,10 +229,11 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) fnmatch(search, mi->text, 0) == FNM_NOMATCH) continue; 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); + if (r <= 0) break; - } } if (mj == NULL) TAILQ_INSERT_TAIL(resultq, mi, resultentry); |