/*
    (C) 1995-96 AROS - The Amiga Replacement OS
    $Id: strdup.c,v 1.3 1996/12/10 13:59:48 aros Exp $

    Desc: ANSI C function strdup()
    Lang: english
*/

/*****************************************************************************

    NAME */
#include <string.h>
#include <memory.h>

	char * strdup (

/*  SYNOPSIS */
	const char * orig)

/*  FUNCTION
	Create a copy of a string. The copy can be freed with free() or will
	be freed when then program ends.

    INPUTS
	str1 - Strings to duplicate

    RESULT
	A copy of the string which can be freed with free().

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO

    INTERNALS

    HISTORY
	24-12-95    digulla created

******************************************************************************/
{
    char * copy;
    char * ptr;

    if ((copy = malloc (strlen (orig)+1)))
    {
	ptr = copy;

	while ((*ptr ++ = *orig ++));
    }

    return copy;
} /* strdup */

