Commit | Line | Data |
---|---|---|
dadab5a2 | 1 | /* strcat.s 4.2 84/11/01 */ |
3d55afdc SL |
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 | */ | |
dadab5a2 | 11 | #include "DEFS.h" |
3d55afdc | 12 | |
dadab5a2 | 13 | ENTRY(strcat, R6|R7) |
3d55afdc SL |
14 | movq 4(ap), r6 # r6 = s1; r7 = s2 |
15 | movl r6,r1 | |
16 | 0: | |
17 | locc $0,$65535,(r1) # look for '\0' | |
18 | beql 0b | |
19 | movl r1,r3 # save end of s1 | |
20 | 1: | |
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 | |
26 | 2: | |
27 | subl2 r7,r1 # calculate length | |
28 | incl r1 | |
29 | movc3 r1,(r7),(r3) # copy remainder | |
30 | movl r6,r0 | |
31 | ret |