index -> strchr / rindex -> strrchr
Douwe Kiela
virtus at wanadoo.nl
Mon Aug 30 13:22:13 PDT 2004
As a follow-up.. I have two questions..
This change is because the *index() functions are marked as LEGACY in "The
Open Group Base Specifications Issue 6, IEEE Std. 1003.1, 2004 Edition",
which means they are non-standard. All LEGACY functions have a provided
replacement function, like index() and rindex() have respectively strchr()
and strrchr(). This is the list of functions currently marked as LEGACY by
the standard:
bcmp - memory operations (LEGACY)
bcopy - memory operations (LEGACY)
bzero - memory operations (LEGACY)
ecvt, fcvt, gcvt - convert a floating-point number to a string (LEGACY) -
[These are already completely removed]
ftime - get date and time (LEGACY)
getwd - get the current working directory pathname (LEGACY)
index - character string operations (LEGACY)
mktemp - make a unique filename (LEGACY)
rindex - character string operations (LEGACY)
utimes - set file access and modification times (LEGACY)
wcswcs - find a wide substring (LEGACY)
I suggest we replace all these functions with their standard-compliant
equivalents, for example bcmp with memcmp and so forth. I also suggest we
make a note of this in the style(9) document, an example of what I am
thinking about can be found here:
http://leaf.dragonflybsd.org/~virtus/style.9.diff
It's a setup, perhaps it should be more clear, refer to the X/Open group
specification and name the replacements.
Furthermore, the manual page of the LEGACY function should note that it's a
LEGACY, and also name the replacement that IS standard compliant. Are there
any objections to any of these changes? If not, I will be patching the
source tree.
My second question is, should I change this everywhere, or just in bin/,
sbin/, usr.bin/ and usr.sbin/ or also in lib/, sys/, et cetera? (I presume
that these changes should not be made in contrib/ and gnu/ directories?
Let me know what you guys think.
Regards,
Douwe
More information about the Submit
mailing list