From 53bf5ef8c2a87633afb98302ae0ebf06f435e49e Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Tue, 15 Apr 2008 08:14:07 +0000 Subject: [PATCH] fixed qe_collate to sort system buffers last --- util.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index f92b04c..2400539 100644 --- a/util.c +++ b/util.c @@ -445,7 +445,7 @@ void splitpath(char *dirname, int dirname_size, } /* smart compare strings, lexicographical order, but collate numbers in - * numeric order */ + * numeric order, and push * at end */ int qe_collate(const char *s1, const char *s2) { int last, c1, c2, res, flags; @@ -462,7 +462,14 @@ int qe_collate(const char *s1, const char *s2) break; } } - res = (c1 < c2) ? -1 : 1; + if (c1 == '*') + res = 1; + else + if (c2 == '*') + res = -1; + else + res = (c1 < c2) ? -1 : 1; + for (;;) { flags = qe_isdigit(c1) * 2 + qe_isdigit(c2); if (flags == 3) {