[comp.unix.sysv386] "index" and "strchr"

guy@auspex.auspex.com (Guy Harris) (09/12/90)

>I pulled uudecode.c from uunet, but it needs something called index()
>which isn't defined in a SysV environment.

No, it just needs something that does what "index()" does.  AT&T renamed
"index()" (which is what it was called in V7) to "strchr()" somewhere
along the line; just replace all calls to "index()" (and declarations of
same; if there's a "#include <strings.h>", replace it with "#include
<string.h>") with calls to (and declarations of) "strchr()".

The same applies to "rindex()" and "strrchr()".

4.3BSD and later releases have both the "*index()" and "str*chr()"
routines, and S5R4 will have "index()" and "rindex()" either in a
standard or BSD-compatibility library.  ANSI C specifies "strchr()" and
"strrchr()", so future programs should probably be written using them,
with #defines or whatever to enable them to compile on older systems
with the older routines.