Files
Arquivotheca.SunOS-4.1.4/lib/libc/gen/common/bcopy.c
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

31 lines
510 B
C

#if !defined(lint) && defined(SCCSIDS)
static char sccsid[] = "@(#)bcopy.c 1.1 94/10/31 SMI";
#endif
/*
* Copy s1 to s2, always copy n bytes.
* For overlapped copies it does the right thing.
*/
void
bcopy(s1, s2, len)
register char *s1, *s2;
int len;
{
register int n;
if ((n = len) <= 0)
return;
if ((s1 < s2) && (n > abs(s1 - s2))) { /* overlapped */
s1 += (n - 1);
s2 += (n - 1);
do
*s2-- = *s1--;
while (--n);
} else { /* normal */
do
*s2++ = *s1++;
while (--n);
}
}