ftp.nice.ch/pub/next/unix/mail/mh.6.7.s.tar.gz#/mh/sbr/add.c

This is add.c in view mode; [Download] [Up]

/* add.c - concatenate two strings in managed memory */

#include "../h/mh.h"
#include <stdio.h>


char   *add (this, that)
register char  *this,
               *that;
{
    register char  *cp;

    if (!this)
	this = "";
    if (!that)
	that = "";
    if ((cp = malloc ((unsigned) (strlen (this) + strlen (that) + 1))) == NULL)
	adios (NULLCP, "unable to allocate string storage");

    (void) sprintf (cp, "%s%s", that, this);
    if (*that)
	free (that);
    return cp;
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.