index -> strchr / rindex -> strrchr

Douwe Kiela virtus at wanadoo.nl
Sun Aug 29 14:39:01 PDT 2004


Hey folks..
I was browsing around the source and discovered that the non-standard
index() and rindex() functions are used everywhere.. Since standards are
important, I suggest we replace these functions with the standard-compliant
functions that do the exact same thing. I quote:

"index and rindex do the same as strchr and strrchr but are non standard"

I suck at shellscripting, but after a few tries I made a script that uses
sed to replace these functions everywhere in the tree.. the patch for the
usr.bin tree can be found here:

http://virtus.ath.cx/dfbsd/usr.bin.index.diff

The reason I didn't use the script on all dirs is that I wanted to know what
you guys think first before I'm going go all over the source.. if you don't
agree then all the work would've been for nothing (not that is that much
work ;-))

Let me know what you guys think.. if you agree expect some more patches
coming up.

Regards,
Douwe






More information about the Submit mailing list