[net.micro.att] BSD - SYS V compatability

revc@gwsd.UUCP (Bob Van Cleef) (07/23/85)

[]

I would like to thank everyone who responded to my question on
the function index().  It seems that I got bit by a well known
difference between BSD and SYS V.  In fact, if I had checked my
notes...
--------------
If you are running SYS V you should already have getopt.
It is on page 3-103 in the SYS V Rel.1 "C Programming Manual". 
(Which doesn't have the Sect. 3 man pages or an index to the functions.) 

You can make the posted routines work, by changing index to strchr 
and rindex to strrchr.
--------------
When compiling:

	cc -O -o xxx -Dindex=strchr xxx.c
or
	cc -O -o xxx -Drindex=strrchr xxx.c

--------------
Or add to the source file:

	#define index(a,b) strchr(a,b)

--------------
For standard distribution files: (Lets make them portable people!)
Add -DUSG in your makefile:

	#ifdef	USG
	#define index	strchr
	#define rindex	strchr
	#endif

--------------
Thanks again to everyone who responded.

Bob


-- 
Bob Van Cleef			...sdcsvax!gwsd!revc
Gateway Computer Systems	 (619) 457-2701
4980 Carroll Canyon Road
San Diego, CA 92121