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: }

Defined functions

add defined in line 7; used 1 times
Last modified: 1985-12-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 873
Valid CSS Valid XHTML 1.0 Strict