X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/18a0d8bbdf5091d39ce852c03a2a35000e1e0760..db9fad13f192963786c7ac90d305467ac00bd145:/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];