+ while (*p && strncmp(p, buf, num))
+ p = hist_entry_next(p);
+
+ if(!strncmp(p, buf, num)) {
+ hist_cur = hist_entry_next(p);
+ return p;
+ }
+
+ return NULL;
+}
+
+static char *hist_search_forward (char* buf, uint8_t num)
+{
+ char *p = hist_cur;
+
+ if(p != hist_head && (p = hist_entry_prev(p)) != NULL) {
+ do {
+ p = hist_entry_prev(p);
+ } while (p && strncmp(p, buf, num) != 0);
+
+ //if(!strncmp(p, buf, num)) {
+ if(p) {
+ hist_cur = hist_entry_next(p);
+ return p;
+ }