Line 322 need to add one line " *ptr = dest; " to keep *ptr with the same value of *saveptr in glibc __strtok_r.
I found strtok_s() leads to an endless loop while running hmmio.c (Line 1411-1415) in hmmer of SPEC 2006. Using gdb to check it I found the *ptr remains the same value while glibc not.
The trick is that when we cannot find delimiter in src we have to point the *ptr to the end of dest,while in strtok_s *ptr points to the start.
hmmio.c source code:
while (sptr != NULL) { fprintf(fp, "%s%s\n", pfx, sptr); sptr = strtok(NULL, "\n"); }
__strtok_r in glibc : https://github.com/lattera/glibc/blob/master/string/strtok_r.c