xref: /illumos-gate/usr/src/lib/libresolv2/common/bsd/strdup.c (revision 71269a2275bf5a143dad6461eee2710a344e7261)
1 /*
2  * Copyright (c) 1997, by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 
7 #pragma ident	"%Z%%M%	%I%	%E% SMI"
8 
9 #include "port_before.h"
10 
11 #include <stdlib.h>
12 
13 #include "port_after.h"
14 
15 #ifndef NEED_STRDUP
16 int __bind_strdup_unneeded;
17 #else
18 char *
19 strdup(const char *src) {
20 	char *dst = malloc(strlen(src) + 1);
21 
22 	if (dst)
23 		strcpy(dst, src);
24 	return (dst);
25 }
26 #endif
27