X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/3c4e084de9ed00171748c20de1251d347fc33c1c..114f6096b4d2c31314a7d4030f67aaeb1f0f8787:/lib/minilib.c?ds=inline diff --git a/lib/minilib.c b/lib/minilib.c index 392eae7..935d0c4 100644 --- a/lib/minilib.c +++ b/lib/minilib.c @@ -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];