aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/main.c b/main.c
index 9c10958..bf53763 100644
--- a/main.c
+++ b/main.c
@@ -168,6 +168,14 @@ initfont(const char *fontstr) {
168 dc.font.height = dc.font.ascent + dc.font.descent; 168 dc.font.height = dc.font.ascent + dc.font.descent;
169} 169}
170 170
171static int
172strido(const char *text, const char *pattern) {
173 for(; *text && *pattern; text++)
174 if (*text == *pattern)
175 pattern++;
176 return !*pattern;
177}
178
171static void 179static void
172match(char *pattern) { 180match(char *pattern) {
173 unsigned int plen; 181 unsigned int plen;
@@ -192,6 +200,19 @@ match(char *pattern) {
192 for(i = allitems; i; i=i->next) 200 for(i = allitems; i; i=i->next)
193 if(plen && strncmp(pattern, i->text, plen) 201 if(plen && strncmp(pattern, i->text, plen)
194 && strstr(i->text, pattern)) { 202 && strstr(i->text, pattern)) {
203 if(!j)
204 item = i;
205 else
206 j->right = i;
207 i->left = j;
208 i->right = NULL;
209 j = i;
210 nitem++;
211 }
212 for(i = allitems; i; i=i->next)
213 if(plen && strncmp(pattern, i->text, plen)
214 && !strstr(i->text, pattern)
215 && strido(i->text,pattern)) {
195 if(!j) 216 if(!j)
196 item = i; 217 item = i;
197 else 218 else