Lines Matching refs:ml
636 struct mlist *ml; in cmd_updown() local
655 for (ml = curr_mlist->curr_mp;;) in cmd_updown()
657 ml = (action == EC_UP) ? ml->prev : ml->next; in cmd_updown()
658 if (ml == curr_mlist) in cmd_updown()
665 if (strncmp(cmdbuf, ml->string, updown_match) == 0) in cmd_updown()
671 curr_mlist->curr_mp = ml; in cmd_updown()
672 s = ml->string; in cmd_updown()
695 static void ml_link(struct mlist *mlist, struct mlist *ml) in ml_link() argument
697 ml->next = mlist; in ml_link()
698 ml->prev = mlist->prev; in ml_link()
699 mlist->prev->next = ml; in ml_link()
700 mlist->prev = ml; in ml_link()
706 static void ml_unlink(struct mlist *ml) in ml_unlink() argument
708 ml->prev->next = ml->next; in ml_unlink()
709 ml->next->prev = ml->prev; in ml_unlink()
718 struct mlist *ml; in cmd_addhist() local
729 for (ml = mlist->next; ml->string != NULL; ml = next) in cmd_addhist()
731 next = ml->next; in cmd_addhist()
732 if (strcmp(ml->string, cmd) == 0) in cmd_addhist()
734 ml_unlink(ml); in cmd_addhist()
735 free(ml->string); in cmd_addhist()
736 free(ml); in cmd_addhist()
745 ml = mlist->prev; in cmd_addhist()
746 if (ml == mlist || strcmp(ml->string, cmd) != 0) in cmd_addhist()
752 ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); in cmd_addhist()
753 ml->string = save(cmd); in cmd_addhist()
754 ml->modified = modified; in cmd_addhist()
755 ml_link(mlist, ml); in cmd_addhist()
761 mlist->curr_mp = ml->next; in cmd_addhist()
1335 static int mlist_size(struct mlist *ml) in mlist_size() argument
1338 for (ml = ml->next; ml->string != NULL; ml = ml->next) in mlist_size()
1407 struct mlist *ml = NULL; in read_cmdhist2() local
1439 ml = &mlist_search; in read_cmdhist2()
1444 ml = &mlist_shell; in read_cmdhist2()
1447 ml = NULL; in read_cmdhist2()
1452 ml = NULL; in read_cmdhist2()
1455 if (ml != NULL) in read_cmdhist2()
1460 (*action)(uparam, ml, line+1); in read_cmdhist2()
1478 static void addhist_init(void *uparam, struct mlist *ml, char *string) in addhist_init() argument
1480 if (ml != NULL) in addhist_init()
1481 cmd_addhist(ml, string, 0); in addhist_init()
1501 static void write_mlist_header(struct mlist *ml, FILE *f) in write_mlist_header() argument
1503 if (ml == &mlist_search) in write_mlist_header()
1506 else if (ml == &mlist_shell) in write_mlist_header()
1514 static void write_mlist(struct mlist *ml, FILE *f) in write_mlist() argument
1516 for (ml = ml->next; ml->string != NULL; ml = ml->next) in write_mlist()
1518 if (!ml->modified) in write_mlist()
1520 fprintf(f, "\"%s\n", ml->string); in write_mlist()
1521 ml->modified = 0; in write_mlist()
1523 ml->modified = 0; /* entire mlist is now unmodified */ in write_mlist()
1550 static void copy_hist(void *uparam, struct mlist *ml, char *string) in copy_hist() argument
1554 if (ml != NULL && ml != ctx->mlist) { in copy_hist()
1560 ctx->mlist = ml; in copy_hist()
1579 } else if (ml != NULL) in copy_hist()