]> Joshua Wise's Git repositories - netwatch.git/blobdiff - lib/minilib.c
Add support for the power button SMI.
[netwatch.git] / lib / minilib.c
index 392eae7abcaf146e8f09ce8a4b4f3cec32457b6e..935d0c40bc5fb25f62dd5d30bac40e09ec1d6b24 100644 (file)
@@ -74,6 +74,17 @@ void memset(void *dest, int data, int bytes)
                *(cdest++) = (unsigned char)data;
 }
 
+void *memchr(const void *buf, char c, int maxlen)
+{
+       const char * cbuf = buf;
+       while (maxlen--)
+       {
+               if (*cbuf == c) return (void *)cbuf;
+               cbuf++;
+       }
+       return 0;
+}
+
 void memmove(void *dest, void *src, int bytes)
 {
        char * cdest = dest;
@@ -157,6 +168,12 @@ void tohex(char *s, unsigned long l)
        }
 }
 
+void btohex(char *s, unsigned char c)
+{
+       s[0] = hexarr[c >> 4];
+       s[1] = hexarr[c & 0xF];
+}
+
 void puthex(unsigned long l)
 {
        char d[9];
This page took 0.02104 seconds and 4 git commands to generate.