1985-01-11 20:08:08 -05:00
|
|
|
#ifdef OBJECTID
|
|
|
|
|
static char sccsid[] = "%W%";
|
|
|
|
|
#endif
|
1984-03-11 00:42:43 -05:00
|
|
|
|
1984-02-21 10:36:09 -05:00
|
|
|
/*LINTLIBRARY*/
|
|
|
|
|
|
1985-01-14 13:23:36 -05:00
|
|
|
#include "stdio.h"
|
|
|
|
|
|
|
|
|
|
#ifndef arg4alloc
|
|
|
|
|
#define arg4alloc unsigned
|
|
|
|
|
#endif
|
1984-02-21 10:36:09 -05:00
|
|
|
|
1984-03-22 15:43:50 -05:00
|
|
|
char * allocat(old, new)
|
|
|
|
|
char * old;
|
|
|
|
|
char * new;
|
1984-02-21 10:36:09 -05:00
|
|
|
{
|
1984-03-22 15:43:50 -05:00
|
|
|
register char * ret;
|
1985-01-14 13:23:36 -05:00
|
|
|
arg4alloc toalloc;
|
1984-03-22 15:43:50 -05:00
|
|
|
extern char * calloc();
|
|
|
|
|
extern char * realloc();
|
|
|
|
|
extern char * strcat();
|
1984-02-21 10:36:09 -05:00
|
|
|
|
1984-03-22 15:43:50 -05:00
|
|
|
if (new == NULL)
|
|
|
|
|
new = "";
|
1985-01-14 13:23:36 -05:00
|
|
|
toalloc = strlen(new) + 1;
|
|
|
|
|
ret = (old == NULL) ? calloc(toalloc, sizeof *ret) :
|
1985-01-14 22:52:38 -05:00
|
|
|
realloc(old, (toalloc + strlen(old)) * sizeof *ret);
|
1984-03-22 15:43:50 -05:00
|
|
|
if (ret != NULL)
|
|
|
|
|
(void) strcat(ret, new);
|
|
|
|
|
return ret;
|
1984-02-21 10:36:09 -05:00
|
|
|
}
|
|
|
|
|
|
1984-03-22 15:43:50 -05:00
|
|
|
char * allocpy(string)
|
|
|
|
|
char * string;
|
1984-02-21 10:36:09 -05:00
|
|
|
{
|
1984-03-22 15:43:50 -05:00
|
|
|
return allocat((char *) NULL, string);
|
1984-02-21 10:36:09 -05:00
|
|
|
}
|