* uip/sendsbr.c: replaced st_mtim with st_mtime, that's what
[mmh] / sbr / getcpy.c
1
2 /*
3  * getcpy.c -- copy a string in managed memory
4  *
5  * THIS IS OBSOLETE.  NEED TO REPLACE ALL OCCURENCES
6  * OF GETCPY WITH STRDUP.  BUT THIS WILL REQUIRE
7  * CHANGING PARTS OF THE CODE TO DEAL WITH NULL VALUES.
8  *
9  * $Id$
10  *
11  * This code is Copyright (c) 2002, by the authors of nmh.  See the
12  * COPYRIGHT file in the root directory of the nmh distribution for
13  * complete copyright information.
14  */
15
16 #include <h/mh.h>
17 #include <h/utils.h>
18
19
20 char *
21 getcpy (char *str)
22 {
23     char *cp;
24     size_t len;
25
26     if (str) {
27         len = strlen(str) + 1;
28         cp = mh_xmalloc (len);
29         memcpy (cp, str, len);
30     } else {
31         cp = mh_xmalloc ((size_t) 1);
32         *cp = '\0';
33     }
34     return cp;
35 }