aboutsummaryrefslogtreecommitdiff
path: root/src/libString/s_memappend.c
blob: 8cbacd185fed8a36982a6064dce672d28e0c1a45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <u.h>
#include <libc.h>
#include "libString.h"

/* append a char array ( of up to n characters) to a String */
String *
s_memappend(String *to, char *from, int n)
{
	char *e;

	if (to == 0)
		to = s_new();
	if (from == 0)
		return to;
	for(e = from + n; from < e; from++)
		s_putc(to, *from);
	s_terminate(to);
	return to;
}