mlib update: new isnan()/isnanf() implementation
[tangerine.git] / compiler / clib / strdup.c
blob936b0630214785e2ae62591c583c7ff9175c1370
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function strdup().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
12 #include <memory.h>
14 char * strdup (
16 /* SYNOPSIS */
17 const char * orig)
19 /* FUNCTION
20 Create a copy of a string. The copy can be freed with free() or will
21 be freed when then program ends.
23 INPUTS
24 str1 - Strings to duplicate
26 RESULT
27 A copy of the string which can be freed with free().
29 NOTES
31 EXAMPLE
33 BUGS
35 SEE ALSO
37 INTERNALS
39 ******************************************************************************/
41 char * copy;
42 char * ptr;
44 if ((copy = malloc (strlen (orig)+1)))
46 ptr = copy;
48 while ((*ptr ++ = *orig ++));
51 return copy;
52 } /* strdup */