X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/3c4e084de9ed00171748c20de1251d347fc33c1c..a6327524107e76c689841eda10fbc19030b4cd15:/lib/minilib.c 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];