xref: /onnv-gate/usr/src/lib/libresolv2/common/bsd/strdup.c (revision 11038:74b12212b8a2)
10Sstevel@tonic-gate #include "port_before.h"
20Sstevel@tonic-gate 
30Sstevel@tonic-gate #include <stdlib.h>
40Sstevel@tonic-gate 
50Sstevel@tonic-gate #include "port_after.h"
60Sstevel@tonic-gate 
70Sstevel@tonic-gate #ifndef NEED_STRDUP
80Sstevel@tonic-gate int __bind_strdup_unneeded;
90Sstevel@tonic-gate #else
100Sstevel@tonic-gate char *
strdup(const char * src)110Sstevel@tonic-gate strdup(const char *src) {
120Sstevel@tonic-gate 	char *dst = malloc(strlen(src) + 1);
130Sstevel@tonic-gate 
140Sstevel@tonic-gate 	if (dst)
150Sstevel@tonic-gate 		strcpy(dst, src);
160Sstevel@tonic-gate 	return (dst);
170Sstevel@tonic-gate }
180Sstevel@tonic-gate #endif
19*11038SRao.Shoaib@Sun.COM 
20*11038SRao.Shoaib@Sun.COM /*! \file */
21