#include <ncbi.h>
#include <gishlib.h>

Nlm_CharPtr LIBCALL
str_tok(s, ts)
	register Nlm_CharPtr	s, ts;
{
    static Nlm_CharPtr  s_save;
    static Nlm_Char ch_save;
    Nlm_CharPtr retval;
    register int    ch;

    if (s == NULL) {
        s = s_save;
        *s++ = ch_save;
        if (ch_save == NULLB)
            return NULL;
    }
    /* find first letter of text */
    while ((ch = *s) != NULLB && str_chr(ts, ch) != NULL)
        ++s;
    s_save = retval = s;
    ch_save = ch;
    if (ch == NULLB)
        return NULL;
    /* skip over text */
    while ((ch = *s) != NULLB && str_chr(ts, ch) == NULL)
        ++s;
    ch_save = ch;
    s_save = s;
    *s = NULLB;
    return retval;
}
