xref: /csrg-svn/lib/libc/vax/string/strcat.s (revision 17329)
1/*	strcat.s	4.2	84/11/01	*/
2
3/*
4 * Concatenate string s2 to the end of s1
5 * and return the base of s1.
6 *
7 * char *
8 * strcat(s1, s2)
9 *	char *s1, *s2;
10 */
11#include "DEFS.h"
12
13ENTRY(strcat, R6|R7)
14	movq	4(ap), r6	# r6 = s1; r7 = s2
15	movl	r6,r1
160:
17	locc	$0,$65535,(r1)	# look for '\0'
18	beql	0b
19	movl	r1,r3		# save end of s1
201:
21	locc	$0,$65535,(r7)	# find length of s2
22	bneq	2f
23	movc3	$65535,(r7),(r3)# copy full block
24	movl	r1,r7
25	jbr	1b
262:
27	subl2	r7,r1		# calculate length
28	incl	r1
29	movc3	r1,(r7),(r3)	# copy remainder
30	movl	r6,r0
31	ret
32