aboutsummaryrefslogtreecommitdiff
path: root/src/libString/s_memappend.c
blob: 27b69850ea0f1ba3dd17a159884e75933dcfb112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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;
}