136335Sbostic /* 236335Sbostic * Copyright (c) 1988 The Regents of the University of California. 336335Sbostic * All rights reserved. 436335Sbostic * 5*42635Sbostic * %sccs.include.redist.c% 636335Sbostic */ 736335Sbostic 836335Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*42635Sbostic static char sccsid[] = "@(#)strdup.c 5.3 (Berkeley) 06/01/90"; 1036335Sbostic #endif /* LIBC_SCCS and not lint */ 1136335Sbostic 1236335Sbostic #include <sys/types.h> 1342181Sbostic #include <stddef.h> 1442181Sbostic #include <string.h> 1536335Sbostic 1642181Sbostic 1736335Sbostic char * 1836335Sbostic strdup(str) 1936335Sbostic char *str; 2036335Sbostic { 2136335Sbostic int len; 2236335Sbostic char *copy, *malloc(); 2336335Sbostic 2436335Sbostic len = strlen(str) + 1; 2536335Sbostic if (!(copy = malloc((u_int)len))) 2636335Sbostic return((char *)NULL); 2736335Sbostic bcopy(str, copy, len); 2836335Sbostic return(copy); 2936335Sbostic } 30