]>
diplodocus.org Git - nmh/blob - sbr/getcpy.c
3 * getcpy.c -- copy a string in managed memory
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.
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.
26 len
= strlen(str
) + 1;
27 if (!(cp
= malloc (len
)))
28 adios (NULL
, "unable to allocate string storage");
29 memcpy (cp
, str
, len
);
31 if (!(cp
= malloc ((size_t) 1)))
32 adios (NULL
, "unable to allocate string storage");