xref: /csrg-svn/lib/libc/vax/string/strcat.s (revision 34480)
1/*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific written prior permission. This software
10 * is provided ``as is'' without express or implied warranty.
11 */
12
13#if defined(SYSLIBC_SCCS) && !defined(lint)
14_sccsid:.asciz	"@(#)strcat.s	5.4 (Berkeley) 05/25/88"
15#endif /* SYSLIBC_SCCS and not lint */
16
17/*
18 * Concatenate string s2 to the end of s1
19 * and return the base of s1.
20 *
21 * char *
22 * strcat(s1, s2)
23 *	char *s1, *s2;
24 */
25#include "DEFS.h"
26
27ENTRY(strcat, R6|R7)
28	movq	4(ap), r6	# r6 = s1; r7 = s2
29	movl	r6,r1
300:
31	locc	$0,$65535,(r1)	# look for '\0'
32	beql	0b
33	movl	r1,r3		# save end of s1
341:
35	locc	$0,$65535,(r7)	# find length of s2
36	bneq	2f
37	movc3	$65535,(r7),(r3)# copy full block
38	movl	r1,r7
39	jbr	1b
402:
41	subl2	r7,r1		# calculate length
42	incl	r1
43	movc3	r1,(r7),(r3)	# copy remainder
44	movl	r6,r0
45	ret
46