1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8#if defined(LIBC_SCCS) && !defined(lint) 9 .asciz "@(#)strcat.s 8.1 (Berkeley) 06/04/93" 10#endif /* LIBC_SCCS and not lint */ 11 12/* 13 * Concatenate string s2 to the end of s1 14 * and return the base of s1. 15 * 16 * char * 17 * strcat(s1, s2) 18 * char *s1, *s2; 19 */ 20#include "DEFS.h" 21 22ENTRY(strcat, R6|R7) 23 movq 4(ap), r6 # r6 = s1; r7 = s2 24 movl r6,r1 250: 26 locc $0,$65535,(r1) # look for '\0' 27 beql 0b 28 movl r1,r3 # save end of s1 291: 30 locc $0,$65535,(r7) # find length of s2 31 bneq 2f 32 movc3 $65535,(r7),(r3)# copy full block 33 movl r1,r7 34 jbr 1b 352: 36 subl2 r7,r1 # calculate length 37 incl r1 38 movc3 r1,(r7),(r3) # copy remainder 39 movl r6,r0 40 ret 41