summaryrefslogtreecommitdiff
path: root/src/lib.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-01-27 02:14:19 -0500
committerFreya Murphy <freya@freyacat.org>2024-01-27 02:14:19 -0500
commit2747693fdb5aa334d8b00a04ed81d2234d710ba9 (patch)
tree47dad3fd0edac691126e261832a304c3125cd679 /src/lib.c
parentcreate bindings.h (diff)
downloadcorn-2747693fdb5aa334d8b00a04ed81d2234d710ba9.tar.gz
corn-2747693fdb5aa334d8b00a04ed81d2234d710ba9.tar.bz2
corn-2747693fdb5aa334d8b00a04ed81d2234d710ba9.zip
acpi + lib
Diffstat (limited to 'src/lib.c')
-rw-r--r--src/lib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib.c b/src/lib.c
new file mode 100644
index 0000000..d072f1a
--- /dev/null
+++ b/src/lib.c
@@ -0,0 +1,14 @@
+#include <lib.h>
+
+int strncmp(const char *lhs, const char *rhs, unsigned long n) {
+ const unsigned char *l=(void *)lhs, *r=(void *)rhs;
+ if (!n--) return 0;
+ for (; *l && *r && n && *l == *r ; l++, r++, n--);
+ return *l - *r;
+}
+
+int memcmp(const void *vl, const void *vr, unsigned long n) {
+ const unsigned char *l = vl, *r = vr;
+ for (; n && *l == *r; n--, l++, r++);
+ return n ? *l-*r : 0;
+}