Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / sbr / add.c
1 /* add.c - concatenate two strings in managed memory */
2
3 #include "../h/mh.h"
4 #include <stdio.h>
5
6
7 char   *add (this, that)
8 register char  *this,
9                *that;
10 {
11     register char  *cp;
12
13     if (!this)
14         this = "";
15     if (!that)
16         that = "";
17     if ((cp = malloc ((unsigned) (strlen (this) + strlen (that) + 1))) == NULL)
18         adios (NULLCP, "unable to allocate string storage");
19
20     (void) sprintf (cp, "%s%s", that, this);
21     if (*that)
22         free (that);
23     return cp;
24 }