File: strdup.c

package info (click to toggle)
felt 3.02-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 16,460 kB
  • ctags: 6,885
  • sloc: ansic: 72,103; fortran: 3,614; yacc: 2,825; lex: 1,172; sh: 311; makefile: 279
file content (19 lines) | stat: -rw-r--r-- 330 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* strdup.c -- duplicate string contents using malloc(3)
 *
 * Written by reading the System V Interface Definition, not the code.
 *
 * Totally public domain.
 *
 */

char
*strdup(str)
char *str;
{
	extern char *malloc(), *strcpy();

	char	*copy = malloc(strlen(str) + 1);

	return(strcpy(copy, str));
}
/* strdup.c ends here */