aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2013-04-03 19:28:00 +0000
committerokan2013-04-03 19:28:00 +0000
commitadbf049a260d761120d72f367da62352505e57e4 (patch)
tree2b737e99ee12663903082c8ac1e3180aaaf67ae4
parent4b8a3bc2b98550fcd3752bc06b7400efc34e1592 (diff)
downloadcwm-adbf049a260d761120d72f367da62352505e57e4.tar.gz
honor PATH search order for exec; from Andres Perera.
Diffstat (limited to '')
-rw-r--r--search.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/search.c b/search.c
index f7abb84..1a4e3eb 100644
--- a/search.c
+++ b/search.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: search.c,v 1.27 2013/03/09 21:55:56 okan Exp $
+ * $OpenBSD: search.c,v 1.28 2013/04/03 19:28:00 okan Exp $
*/
#include <sys/param.h>
@@ -217,6 +217,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 +226,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);