macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / vax / string / strcpy.s
CommitLineData
586c39b1
DF
1/*
2 * Copyright (c) 1983 Regents of the University of California.
493b70ca
KB
3 * All rights reserved.
4 *
019bea33 5 * %sccs.include.redist.c%
586c39b1
DF
6 */
7
f4f66d2c 8#if defined(LIBC_SCCS) && !defined(lint)
019bea33 9 .asciz "@(#)strcpy.s 5.6 (Berkeley) %G%"
f4f66d2c 10#endif /* LIBC_SCCS and not lint */
ae7679ef
SL
11
12/*
13 * Copy string s2 over top of s1.
dff54044 14 * Return base of s1.
ae7679ef
SL
15 *
16 * char *
17 * strcpy(s1, s2)
18 * char *s1, *s2;
19 */
dadab5a2 20#include "DEFS.h"
ae7679ef 21
dadab5a2 22ENTRY(strcpy, R6)
ae7679ef
SL
23 movl 4(ap), r3 # r3 = s1
24 movl 8(ap), r6 # r6 = s2
251:
26 locc $0,$65535,(r6) # find length of s2
27 bneq 2f
28 movc3 $65535,(r6),(r3)# copy full block
dff54044 29 movl r1,r6
ae7679ef
SL
30 jbr 1b
312:
32 subl2 r6,r1 # calculate length
33 incl r1
34 movc3 r1,(r6),(r3) # copy remainder
dff54044 35 movl 4(ap),r0 # return base of s1
ae7679ef 36 ret