1 #if defined(LIBC_SCCS) && !defined(lint) 2 static char sccsid[] = "@(#)strncat.c 5.2 (Berkeley) 03/09/86"; 3 #endif LIBC_SCCS and not lint 4 5 /* 6 * Concatenate s2 on the end of s1. S1's space must be large enough. 7 * At most n characters are moved. 8 * Return s1. 9 */ 10 11 char * 12 strncat(s1, s2, n) 13 register char *s1, *s2; 14 register n; 15 { 16 register char *os1; 17 18 os1 = s1; 19 while (*s1++) 20 ; 21 --s1; 22 while (*s1++ = *s2++) 23 if (--n < 0) { 24 *--s1 = '\0'; 25 break; 26 } 27 return(os1); 28 } 29