1#ifdef LIBC_SCCS 2 .asciz "@(#)strncat.s 1.2 (Berkeley/CCI) 08/25/87" 3#endif LIBC_SCCS 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 * char *strncat(s1, s2, n) 11 * register char *s1, *s2; 12 * register n; 13 */ 14#include "DEFS.h" 15 16ENTRY(strncat, 0) 17 tstl 12(fp) 18 jgtr n_ok 19 movl 4(fp),r0 20 ret 21n_ok: 22 movl 8(fp),r0 23 movl r0,r1 24 cmps2 # r0 points at null at end of s2 25 subl3 8(fp),r0,r2 # r2 = numberof non-null chars in s2 26 cmpl 12(fp),r2 27 jgeq r2_ok 28 movl 12(fp),r2 # r2 = min (n, length(s2)) 29r2_ok: 30 movl 4(fp),r0 31 movl r0,r1 32 cmps2 # r1 points at null at end of s1 33 movl 8(fp),r0 # source for copy 34 movs3 # actual copy 35 clrb (r1) # null terminated string ! 36 movl 4(fp),r0 37 ret 38