xref: /plan9-contrib/sys/src/libc/port/strncat.c (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #include <u.h>
2 #include <libc.h>
3 
4 char*
5 strncat(char *s1, char *s2, int n)
6 {
7 	char *os1;
8 
9 	os1 = s1;
10 	while(*s1++)
11 		;
12 	s1--;
13 	while(*s1++ = *s2++)
14 		if(--n < 0) {
15 			s1[-1] = 0;
16 			break;
17 		}
18 	return os1;
19 }
20