[net.unix] question on rindex

dixon@ihuxa.UUCP (09/20/83)

Thanks to all the people who replied so quickly to my
request for info on rindex(). To summarize their replies:

    rindex() == strrchr()
    index()  == strchr().

You can use #defines to cause the appropriate function to be used. E.g,

#define index(a,b)  strchr(a,b)
#define rindex(a,b) strrchr(a,b).

Index() and rindex() were a part of V7 UNIX but dropped in later releases
of BTL UNIX.

D A Dixon      ihuxa!dixon

kendall@wjh12.UUCP (Kendall) (09/21/83)

Better to define replacement function names like this:
	#define index  strchr
than like this:
	#define index(a,b)  strchr(a,b)
because the former method allows one to pass the replacement name
as a function pointer.

	Sam Kendall			{allegra,ihnp4}!wjh12!kendall
	Delft Consulting Corporation	  decvax!genrad!wjh12!kendall