implement wl_find()
This commit is contained in:
parent
60398d113c
commit
e2be942b72
|
|
@ -31,6 +31,8 @@ void wl_append_word(wordlist **first, wordlist **last, char *word);
|
|||
wordlist *wl_chop(wordlist *wlist);
|
||||
wordlist *wl_chop_rest(wordlist *wlist);
|
||||
|
||||
wordlist *wl_find(const char *string, wordlist *wlist);
|
||||
|
||||
|
||||
/* For quoting individual characters. '' strings are all quoted, but
|
||||
* `` and "" strings are maintained as single words with the quotes
|
||||
|
|
|
|||
|
|
@ -353,3 +353,17 @@ wl_chop_rest(wordlist *wl)
|
|||
rest->wl_prev = NULL;
|
||||
return rest;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* search for a string in a wordlist
|
||||
*/
|
||||
|
||||
wordlist *
|
||||
wl_find(const char *string, wordlist *wl)
|
||||
{
|
||||
for (; wl; wl = wl->wl_next)
|
||||
if (eq(string, wl->wl_word))
|
||||
break;
|
||||
return wl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue