This commit is contained in:
Oliver Lehmann 1989-02-07 12:38:01 +00:00
parent 5b9f337b8d
commit 95dc9881eb
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,23 @@
/*
** BLOCK CONCATANATE
** block `q' of length `n' is concatenated to block
** `b2' of length `l2', giving `p'.
**
** Returns the address of the next byte available after
** the end of `p'.
*/
char *AAappend(q, n, b2, l2, p)
register char *q;
register int n;
register char *p;
register char *b2;
register int l2;
{
while (n-- > 0)
*p++ = *q++;
n = l2;
q = b2;
while (n-- > 0)
*p++ = *q++;
return (p);
}

View File

@ -0,0 +1,20 @@
/*
** STRING CONCATENATE
**
** The strings `s1' and `s2' are concatenated and stored into
** `dst'. It is ok for `s1' to equal `dst', but terrible things
** will happen if `s2' equals `dst'. The return value is is a
** pointer to the end of `dst' field.
*/
char *AAconcat(s1, s2, dst)
register char *s1;
register char *s2;
register char *dst;
{
while (*s1)
*dst++ = *s1++;
while (*s2)
*dst++ = *s2++;
*dst = 0;
return (dst);
}

View File

@ -0,0 +1,27 @@
/*
** LOCAL STRING CONCATENATE
** Strings `a' and `b' are concatenated and left in an
** internal buffer. A pointer to that buffer is returned.
**
** Ztack can be called recursively as:
** AAztack(AAztack(AAztack(w, x), y), z);
*/
char *AAztack(a, b)
register char *a;
register char *b;
{
register char *c;
static char buf[101];
c = buf;
while (*a)
*c++ = *a++;
while (*b)
*c++ = *b++;
*c = '\0';
return (buf);
}