Add libbroken.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@417 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
33
lib/roken/memmove.c
Normal file
33
lib/roken/memmove.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* memmove for systems that doesn't have it
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
void* memmove(void *s1, const void *s2, size_t n)
|
||||
{
|
||||
char *s=(char*)s2, *d=(char*)s1;
|
||||
|
||||
if(d > s){
|
||||
s+=n-1;
|
||||
d+=n-1;
|
||||
while(n){
|
||||
*d--=*s--;
|
||||
n--;
|
||||
}
|
||||
}else if(d < s)
|
||||
while(n){
|
||||
*d++=*s++;
|
||||
n--;
|
||||
}
|
||||
return s1;
|
||||
}
|
Reference in New Issue
Block a user