don't truncate lines, don't allow tabs to back up (I think this is tested!)
[unix-history] / usr / src / lib / libc / string / strdup.c
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* %sccs.include.redist.c%
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strdup.c 5.3 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <stddef.h>
#include <string.h>
char *
strdup(str)
char *str;
{
int len;
char *copy, *malloc();
len = strlen(str) + 1;
if (!(copy = malloc((u_int)len)))
return((char *)NULL);
bcopy(str, copy, len);
return(copy);
}