]> Joshua Wise's Git repositories - netwatch.git/blob - grubload/minilib.c
f2ab6629d858238d8fd76b0634e1e06536110c5d
[netwatch.git] / grubload / minilib.c
1 #include "console.h"
2
3 void memcpy(unsigned char *a2, unsigned char *a1, int bytes)
4 {
5         while (bytes--)
6                 *(a2++) = *(a1++);
7 }
8
9 void memmove(unsigned char *dest, unsigned char *src, int bytes)
10 {
11         if ((dest > src) && (dest <= (src + bytes)))
12         {
13                 /* do it backwards! */
14                 dest += bytes;
15                 src += bytes;
16                 while (bytes--)
17                         *(--dest) = *(--src);
18         } else
19                 while (bytes--)
20                         *(dest++) = *(src++);
21 }
22
23 int strlen(char *c)
24 {
25         int l = 0;
26         while (*(c++))
27                 l++;
28         return l;
29 }
30
31 void puts(char *c)
32 {
33         putbytes(c, strlen(c));
34 }
35
36 static char hexarr[] = "0123456789ABCDEF";
37 void puthex(unsigned long l)
38 {
39         int i;
40         for (i = 0; i < 8; i++)
41         {
42                 putbyte(hexarr[l >> 28]);
43                 l <<= 4;
44         }
45 }
This page took 0.022559 seconds and 2 git commands to generate.