3 * strdup.c -- duplicate a string
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
16 strdup (const char *str)
24 len = strlen(str) + 1;
25 if (!(cp = malloc (len)))
27 memcpy (cp, str, len);