1989-04-11 10:25:38 -04:00
|
|
|
#ifdef OBJECTID
|
|
|
|
|
static char sccsid[] = "%W%";
|
|
|
|
|
#endif
|
1985-10-15 12:56:17 -04:00
|
|
|
|
1988-02-17 22:22:32 -05:00
|
|
|
/*LINTLIBRARY*/
|
|
|
|
|
|
1989-04-11 10:25:38 -04:00
|
|
|
#include "stdio.h"
|
1988-02-18 11:33:47 -05:00
|
|
|
|
1989-04-11 10:25:38 -04:00
|
|
|
#ifndef arg4alloc
|
|
|
|
|
#define arg4alloc unsigned
|
|
|
|
|
#endif
|
1986-03-12 13:36:34 -05:00
|
|
|
|
1989-04-11 10:25:38 -04:00
|
|
|
char * allocat(old, new)
|
|
|
|
|
char * old;
|
|
|
|
|
char * new;
|
1985-10-23 09:48:28 -04:00
|
|
|
{
|
1989-04-11 10:25:38 -04:00
|
|
|
register char * ret;
|
|
|
|
|
arg4alloc toalloc;
|
|
|
|
|
extern char * calloc();
|
|
|
|
|
extern char * realloc();
|
|
|
|
|
extern char * strcat();
|
1986-03-12 12:58:41 -05:00
|
|
|
|
1989-04-11 10:25:38 -04:00
|
|
|
if (new == NULL)
|
|
|
|
|
new = "";
|
|
|
|
|
toalloc = strlen(new) + 1;
|
|
|
|
|
ret = (old == NULL) ? calloc(toalloc, sizeof *ret) :
|
|
|
|
|
realloc(old, (toalloc + strlen(old)) * sizeof *ret);
|
|
|
|
|
if (ret != NULL)
|
|
|
|
|
(void) strcat(ret, new);
|
|
|
|
|
return ret;
|
1986-03-12 12:58:41 -05:00
|
|
|
}
|
|
|
|
|
|
1989-04-11 10:25:38 -04:00
|
|
|
char * allocpy(string)
|
|
|
|
|
char * string;
|
1986-03-12 12:58:41 -05:00
|
|
|
{
|
1989-04-11 10:25:38 -04:00
|
|
|
return allocat((char *) NULL, string);
|
1987-03-29 17:55:10 -05:00
|
|
|
}
|