comparison target-utils/libc/strncat.c @ 87:7fb62fc724dc

target-utils/libc: beginning of newlib-ectomy
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 28 Oct 2016 22:20:26 +0000
parents
children
comparison
equal deleted inserted replaced
86:684eddecbc62 87:7fb62fc724dc
1 /*
2 * Concatenate s2 on the end of s1. S1's space must be large enough.
3 * At most n characters are moved.
4 * Return s1.
5 */
6
7 char *
8 strncat(s1, s2, n)
9 register char *s1, *s2;
10 register n;
11 {
12 register char *os1;
13
14 os1 = s1;
15 while (*s1++)
16 ;
17 --s1;
18 while (*s1++ = *s2++)
19 if (--n < 0) {
20 *--s1 = '\0';
21 break;
22 }
23 return(os1);
24 }