home *** CD-ROM | disk | FTP | other *** search
- /* Some brain-damaged systems don't have the basic set of ANSI
- functions. These are just functions I had to write myself.
- Your system may need even more standard functions written,
- or it may need less. */
-
- #ifndef __STDC__
-
- #include <string.h>
- #include <time.h>
-
- void *memmove(void *dest, const void *src, size_t n)
- {
- register char *d, *s;
- void *p;
-
- p = d = dest;
- s = src;
- while (n-- > 0)
- *d++ = *s++;
- return(p);
- }
-
- #if defined(SYS_UNIX) && ! defined(NeXT) && ! defined(ULTRIX)
-
- #include <sys/time.h>
-
- extern int gettimeofday(struct timeval *, struct timezone *);
-
- clock_t clock(void)
- {
- struct timeval tp;
- static clock_t first_sec;
-
- (void) gettimeofday(&tp, NULL);
- if (! first_sec)
- first_sec = tp.tv_sec;
- return((tp.tv_sec - first_sec) * 1000000 + tp.tv_usec);
- }
-
- #endif /* defined(SYS_UNIX) && ! defined(NeXT) && ! defined(ULTRIX) */
-
- #else /* __STDC__ */
-
- static char dummy; /* declaration to satisfy some compilers */
-
- #endif /* __STDC__ */
-