]> diplodocus.org Git - nmh/blob - sbr/strdup.c
Reworked nmh.spec to support rpmbuild from source RPM.
[nmh] / sbr / strdup.c
1
2 /*
3 * strdup.c -- duplicate a string
4 *
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
8 */
9
10 #include <h/mh.h>
11 #include <h/utils.h>
12
13
14 char *
15 strdup (const char *str)
16 {
17 char *cp;
18 size_t len;
19
20 if (!str)
21 return NULL;
22
23 len = strlen(str) + 1;
24 cp = mh_xmalloc (len);
25 memcpy (cp, str, len);
26 return cp;
27 }