"index" and "strchr" (was Re: uudecode on ISC 386/ix 1.0.6)

Guy Harris guy at auspex.auspex.com
Wed Sep 12 04:39:19 AEST 1990


>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.



More information about the Comp.unix.sysv386 mailing list