Release 961222
[wine/gsoc-2012-control.git] / misc / port.c
blob3eec824cb63e621611a372902cf69ebd2dfe13db
1 /*
2 * Misc. functions for systems that don't have them
4 * Copyright 1996 Alexandre Julliard
5 */
7 #include "config.h"
8 #include <sys/types.h>
9 #include <sys/time.h>
11 #ifndef HAVE_USLEEP
12 unsigned int usleep (unsigned int useconds)
14 struct timeval delay;
16 delay.tv_sec = 0;
17 delay.tv_usec = useconds;
19 select( 0, 0, 0, 0, &delay );
20 return 0;
22 #endif /* HAVE_USLEEP */
24 #ifndef HAVE_MEMMOVE
25 void *memmove( void *dest, const void *src, unsigned int len )
27 register char *dst = dest;
29 /* Use memcpy if not overlapping */
30 if ((dst + len <= (char *)src) || ((char *)src + len <= dst))
32 memcpy( dst, src, len );
34 /* Otherwise do it the hard way (FIXME: could do better than this) */
35 else if (dst < src)
37 while (len--) *dst++ = *((char *)src)++;
39 else
41 dst += len - 1;
42 src = (char *)src + len - 1;
43 while (len--) *dst-- = *((char *)src)--;
45 return dest;
47 #endif /* HAVE_MEMMOVE */