mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-04 04:31:04 +00:00
1 line
643 B
C
Executable File
1 line
643 B
C
Executable File
/***********************************************************************\
|
|
|
|
Filename: move.c
|
|
|
|
\***********************************************************************/
|
|
|
|
#include "proxlib.h"
|
|
|
|
/* Copy count bytes from source to dest. Note that this routine works
|
|
correctly even when the source and the destination overlap. */
|
|
|
|
VOID
|
|
move(dest, source, count)
|
|
register char *dest;
|
|
register char *source;
|
|
register int count;
|
|
{
|
|
if (count <= 0) {
|
|
return;
|
|
}
|
|
if (dest > source) {
|
|
source += count;
|
|
dest += count;
|
|
while (--count >= 0) {
|
|
*--dest = *--source;
|
|
}
|
|
} else {
|
|
while (--count >= 0) {
|
|
*dest++ = *source++;
|
|
}
|
|
}
|
|
}
|