xref: /titanic_44/usr/src/lib/libresolv2/common/bsd/strdup.c (revision fd9cb95cbb2f626355a60efb9d02c5f0a33c10e6)
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