Fix non-portable echo usage in sysdeps/unix/make-syscalls.sh
[glibc.git] / timezone / ialloc.c
blobb6f018897b42fae10a040189ff93c478a3f7a7f5
1 /*
2 ** This file is in the public domain, so clarified as of
3 ** 2006-07-17 by Arthur David Olson.
4 */
6 /*LINTLIBRARY*/
8 #include "private.h"
10 char *
11 icatalloc(char *const old, const char *const new)
13 register char * result;
14 register int oldsize, newsize;
16 newsize = (new == NULL) ? 0 : strlen(new);
17 if (old == NULL)
18 oldsize = 0;
19 else if (newsize == 0)
20 return old;
21 else oldsize = strlen(old);
22 if ((result = realloc(old, oldsize + newsize + 1)) != NULL)
23 if (new != NULL)
24 (void) strcpy(result + oldsize, new);
25 return result;
28 char *
29 icpyalloc(const char *const string)
31 return icatalloc(NULL, string);