121432Sdist/* 2*61222Sbostic * Copyright (c) 1983, 1993 3*61222Sbostic * The Regents of the University of California. All rights reserved. 434480Sbostic * 542639Sbostic * %sccs.include.redist.c% 621432Sdist */ 717319Ssam 834819Sbostic#if defined(LIBC_SCCS) && !defined(lint) 9*61222Sbostic .asciz "@(#)strcat.s 8.1 (Berkeley) 06/04/93" 1034819Sbostic#endif /* LIBC_SCCS and not lint */ 1121432Sdist 1217319Ssam/* 1317319Ssam * Concatenate string s2 to the end of s1 1417319Ssam * and return the base of s1. 1517319Ssam * 1617319Ssam * char * 1717319Ssam * strcat(s1, s2) 1817319Ssam * char *s1, *s2; 1917319Ssam */ 2017329Ssam#include "DEFS.h" 2117319Ssam 2217329SsamENTRY(strcat, R6|R7) 2317319Ssam movq 4(ap), r6 # r6 = s1; r7 = s2 2417319Ssam movl r6,r1 2517319Ssam0: 2617319Ssam locc $0,$65535,(r1) # look for '\0' 2717319Ssam beql 0b 2817319Ssam movl r1,r3 # save end of s1 2917319Ssam1: 3017319Ssam locc $0,$65535,(r7) # find length of s2 3117319Ssam bneq 2f 3217319Ssam movc3 $65535,(r7),(r3)# copy full block 3317319Ssam movl r1,r7 3417319Ssam jbr 1b 3517319Ssam2: 3617319Ssam subl2 r7,r1 # calculate length 3717319Ssam incl r1 3817319Ssam movc3 r1,(r7),(r3) # copy remainder 3917319Ssam movl r6,r0 4017319Ssam ret 41