Document Number: WG14 N704/X3J11 97-067 C9X Revision Proposal ===================== Title: ____strdup___________________________________________ Author: _____________Larry Jones____________________________ Author Affiliation: _SDRC___________________________________ Postal Address: _____2000 Eastman Dr, Milford, OH 45150_____ E-mail Address: _____larry.jones@sdrc.com___________________ Telephone Number: ___513-576-2070___________________________ Fax Number: _________513-576-2843___________________________ Sponsor: ____________Larry Jones____________________________ Date: _______________23 May 1997____________________________ Proposal Category: __ Editorial change/non-normative contribution __ Correction X_ New feature __ Addition to obsolescent feature list __ Addition to Future Directions __ Other (please specify) Area of Standard Affected: __ Environment __ Language __ Preprocessor X_ Library __ Macro/typedef/tag name X_ Function __ Header __ Other (please specify) ______________________________ Prior Art: AT&T SVID2, X/Open CAE, GNU libc, 4.4BSD, others_ Target Audience: C Programmers______________________________ ____________________________________________________________ ____________________________________________________________ Related Documents (if any): ________________________________ ____________________________________________________________ ____________________________________________________________ Proposal Attached: X_ Yes __ No, but what's your interest? Abstract: The strdup function is provided by most Unix systems (it is required by the Unix System V Interface Definition) and by many other implementations. Although the function is not difficult for a user to implement, it is also not difficult to do so incorrectly. Providing such a function as part of the standard library would eliminate a lot of duplicate effort on the part of programmers and greatly increase their convenience at very little cost to implementors. Proposal: In subclause 7.14.6 Miscellaneous functions (String handling ), add a new subclause as follows: 7.14.6.X The strdup function Synopsis #include char *strdup(const char *s); Description The strdup function creates a new string which is a duplicate of the string pointed to by s. Space for the new string is obtained by calling malloc. Returns The strdup function returns a pointer to the new string or a null pointer if the space can not be allocated. Add the corresponding entry to Annex D Library summary.