Browse Source

implement wl_find()

rlar 14 years ago
parent
commit
e2be942b72
  1. 2
      src/include/ngspice/wordlist.h
  2. 14
      src/misc/wlist.c

2
src/include/ngspice/wordlist.h

@ -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

14
src/misc/wlist.c

@ -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…
Cancel
Save