about summary refs log tree commit diff
path: root/util.c
diff options
context:
space:
mode:
authorHeikki Kallasjoki <fis@zem.fi>2018-11-16 00:21:37 +0000
committerHeikki Kallasjoki <fis@zem.fi>2018-11-16 00:21:37 +0000
commite30fd51e676a9d03286c6dce5950314019800de4 (patch)
tree59490e6ddd892803371fc4672d590854afe5583d /util.c
parent13b42a939aaf63e1055f3313ddcfbfb84a049089 (diff)
downloadnano-exporter-e30fd51e676a9d03286c6dce5950314019800de4.tar.gz
nano-exporter-e30fd51e676a9d03286c6dce5950314019800de4.tar.xz
nano-exporter-e30fd51e676a9d03286c6dce5950314019800de4.zip
Add rudimentary (fake) HTTP server.
Diffstat (limited to 'util.c')
-rw-r--r--util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util.c b/util.c
index 6476f5c..e88ef95 100644
--- a/util.c
+++ b/util.c
@@ -48,6 +48,10 @@ void cbuf_reset(cbuf *buf) {
   buf->len = 0;
 }
 
+size_t cbuf_len(cbuf *buf) {
+  return buf->len;
+}
+
 void cbuf_put(cbuf *buf, const void *src, size_t len) {
   if (!cbuf_reserve(buf, len))
     return;
@@ -88,6 +92,10 @@ const char *cbuf_get(struct cbuf *buf, size_t *len) {
   return buf->data;
 }
 
+int cbuf_cmp(cbuf *buf, const char *other) {
+  return strncmp(buf->data, other, buf->len);
+}
+
 // string lists
 
 struct slist *slist_split(const char *str, const char *delim) {