+ /* if not found, try to find from the beginning/end of list */
+ if (dir > 0) {
+ for (item = menu->list ; item; item = item->next) {
+ for (s = item->label; s && *s; s++) {
+ if (strncasecmp(s, text, textlen) == 0) {
+ return item;
+ }
+ }
+ }
+ } else {
+ for (item = lastitem ; item; item = item->prev) {
+ for (s = item->label; s && *s; s++) {
+ if (strncasecmp(s, text, textlen) == 0) {
+ return item;
+ }
+ }
+ }
+ }