|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifdef LIBC_SCCS
8: .asciz "@(#)strcat.s 5.3 (Berkeley) 3/9/86"
9: #endif LIBC_SCCS
10:
11: /*
12: * Concatenate string s2 to the end of s1
13: * and return the base of s1.
14: *
15: * char *
16: * strcat(s1, s2)
17: * char *s1, *s2;
18: */
19: #include "DEFS.h"
20:
21: ENTRY(strcat, R6|R7)
22: movq 4(ap), r6 # r6 = s1; r7 = s2
23: movl r6,r1
24: 0:
25: locc $0,$65535,(r1) # look for '\0'
26: beql 0b
27: movl r1,r3 # save end of s1
28: 1:
29: locc $0,$65535,(r7) # find length of s2
30: bneq 2f
31: movc3 $65535,(r7),(r3)# copy full block
32: movl r1,r7
33: jbr 1b
34: 2:
35: subl2 r7,r1 # calculate length
36: incl r1
37: movc3 r1,(r7),(r3) # copy remainder
38: movl r6,r0
39: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.