xref: /titanic_50/usr/src/lib/libresolv2/common/bsd/strdup.c (revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829)
17c478bd9Sstevel@tonic-gate #include "port_before.h"
27c478bd9Sstevel@tonic-gate 
37c478bd9Sstevel@tonic-gate #include <stdlib.h>
47c478bd9Sstevel@tonic-gate 
57c478bd9Sstevel@tonic-gate #include "port_after.h"
67c478bd9Sstevel@tonic-gate 
77c478bd9Sstevel@tonic-gate #ifndef NEED_STRDUP
87c478bd9Sstevel@tonic-gate int __bind_strdup_unneeded;
97c478bd9Sstevel@tonic-gate #else
107c478bd9Sstevel@tonic-gate char *
strdup(const char * src)117c478bd9Sstevel@tonic-gate strdup(const char *src) {
127c478bd9Sstevel@tonic-gate 	char *dst = malloc(strlen(src) + 1);
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate 	if (dst)
157c478bd9Sstevel@tonic-gate 		strcpy(dst, src);
167c478bd9Sstevel@tonic-gate 	return (dst);
177c478bd9Sstevel@tonic-gate }
187c478bd9Sstevel@tonic-gate #endif
19*9525b14bSRao Shoaib 
20*9525b14bSRao Shoaib /*! \file */
21