4 void memcpy(void *dest, const void *src, int bytes)
7 const char *csrc = src;
9 *(cdest++) = *(csrc++);
12 void memmove(void *dest, void *src, int bytes)
16 if ((cdest > csrc) && (cdest <= (csrc + bytes)))
18 /* do it backwards! */
22 *(--cdest) = *(--csrc);
25 *(cdest++) = *(csrc++);
28 int memcmp (const char *a2, const char *a1, int bytes) {
31 if (*(a2++) != *(a1++))
37 int strcmp (const char *a2, const char *a1) {
39 if (*a2 != *a1) return 1;
40 if (*a2 == 0) return 0;
46 int strlen(const char *c)
54 void strcpy(char *a2, const char *a1)
61 void puts(const char *c)
63 putbytes(c, strlen(c));
66 static char hexarr[] = "0123456789ABCDEF";
67 void tohex(char *s, unsigned long l)
70 for (i = 0; i < 8; i++)
72 s[i] = hexarr[l >> 28];
77 void puthex(unsigned long l)
85 unsigned short htons(unsigned short in)
87 return (in >> 8) | (in << 8);