xref: /plan9/sys/src/libString/s_nappend.c (revision 80ee5cbfe36716af62da8896207e9763b8e3d760)
1 #include <u.h>
2 #include <libc.h>
3 #include "String.h"
4 
5 /* append a char array ( of up to n characters) to a String */
6 String *
s_nappend(String * to,char * from,int n)7 s_nappend(String *to, char *from, int n)
8 {
9 	if (to == 0)
10 		to = s_new();
11 	if (from == 0)
12 		return to;
13 	for(; n && *from; from++, n--)
14 		s_putc(to, *from);
15 	s_terminate(to);
16 	return to;
17 }
18 
19