1. use '#include <string.h>' only.
2. convert all calls to index() and rindex() to strchr() and strrchr()
respectively.
string.h strings.h
------------------------------------------------------
AIX index index
strdup
strchr
------------------------------------------------------
RedHat index index
strdup
strchr
------------------------------------------------------
SOLARIS 8 & 9 index
strdup
strchr
------------------------------------------------------
HPUX index
strdup
strchr
This made my compiler shut up. But this may not work on other OSes.
According to www.gnu.org:
"Some systems give these functions the names index and rindex; other
systems use the names strchr and strrchr. Some systems support both
pairs of names, but neither pair works on all systems."
(http://www.gnu.org/prep/standards/html_node/System-Functions.html)
They recommend using strchr/strrchr and if they don't exist "define
them as macros in terms of the other pair." Unfortunately, their
assumption that macros HAVE_STRCHR and HAVE_STRRCHR exist is invalid
under Solaris 8 at least.
So we'll have fun, fun, fun 'til the *nix puts the strchr() away.
-- Leslie Arvin
ar...@purdue.edu, Office: FREH G409, Phone: 765-496-3971
Network Systems Administrator, ITI-Unix Platforms
Purdue University, Information Technology at Purdue
I can feel your pain :) I had some problems dealing with that
and I tought it was fixed by including strings.h (the CFLAG
is -include strings.h, not string.h) on Solaris. I was looking
at some man pages and I think we need to stop using
index/rindex and only use strchr/strrchr everywhere.
Look at what the openbsd man page says:
"
The index() function is deprecated and shouldn't be used in new code.
"
Thanks,
--
Daniel B. Cid
dcid @ ( at ) ossec.net