From: Erik P. <epe...@iv...> - 2004-02-17 03:38:27
|
On Mon, 16 Feb 2004, The Storys wrote: > I think that the strchr routine is making assumptions about the string which > create alot of problems. Mainly that it assumes their is only a single Set > of matches in a string. Rather than multiples. > > Specifically, it searches a string from the end to the front, and if this > string is part of a Strtok operation, it may end up finding matching > characters at the end first rather than the next available set like i belive > it should. > > Current Implementation : > /*****************************************************************/ > char * strrchr (char * string, char ch) ^^^^^^^ note the double r > Of course, as always, i could just be on crack .... > > Anyone have ideas on this ? > > -Lenny strchr() searches from the beginning of the string to the end, and strrchr() searches from the end of the string to the beginning. Look in device/lib/strchr.c and you will find an implementation that works the way you expect. (Of course, after a long day/night of coding, my eyes might not notice the double r either) Erik |