typo
[unix-history] / usr / src / lib / libc / string / strdup.c
CommitLineData
4a5f8f09
KB
1/*
2 * Copyright (c) 1988 The Regents of the University of California.
3 * All rights reserved.
4 *
019bea33 5 * %sccs.include.redist.c%
4a5f8f09
KB
6 */
7
8#if defined(LIBC_SCCS) && !defined(lint)
019bea33 9static char sccsid[] = "@(#)strdup.c 5.3 (Berkeley) %G%";
4a5f8f09
KB
10#endif /* LIBC_SCCS and not lint */
11
12#include <sys/types.h>
336401ac
KB
13#include <stddef.h>
14#include <string.h>
15
4a5f8f09
KB
16
17char *
18strdup(str)
19 char *str;
20{
21 int len;
22 char *copy, *malloc();
23
24 len = strlen(str) + 1;
25 if (!(copy = malloc((u_int)len)))
26 return((char *)NULL);
27 bcopy(str, copy, len);
28 return(copy);
29}