projects
/
mmh
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
b4a5a9f350169cf5e6bf080987a23029451673dc
[mmh]
/
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
}