From: Story, L. <Lenny.Story@Alcatel.com> - 2003-05-07 13:47:29
|
Greetings, It seems that strtok is broken, by excluding the last tokenized element in the string. Referencing the source below, the token pointers are only returned if a delimiter is found AFTER the current token. Which is used as the location to place the null. In the case of a string which does not have a delimeter as the tail end of the string, the last token element is then skipped. /**************************************/ /*********** CURRENT CODE *************/ /**************************************/ char * strtok (char * str, char * control ) { static char * s; register char * s1; if ( str ) s = str ; s1 = s ; while (*s) { if(strchr(control,*s)) { *s++ = '\0'; return s1 ; } s++ ; } return (NULL); } |
From: Bernhard H. <ber...@be...> - 2003-05-07 19:45:31
|
> It seems that strtok is broken, by excluding the last tokenized element in > the string. Could you please file a bug report? Thanks, Bernhard |