aboutsummaryrefslogtreecommitdiff
path: root/have
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2022-10-31 22:53:16 +0000
committerOmar Polo <op@omarpolo.com>2022-10-31 22:53:16 +0000
commit19a8d9fe745ca09a9966174c4826935f05daa8db (patch)
treeead89b48701852d388a20a2f31bfa54ab5fd1624 /have
parent4b93be289bc141a15484e782c85020b62b878ec2 (diff)
add memmem compat
Diffstat (limited to 'have')
-rw-r--r--have/Makefile1
-rw-r--r--have/memmem.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/have/Makefile b/have/Makefile
index cdd0fec..4ac7158 100644
--- a/have/Makefile
+++ b/have/Makefile
@@ -10,6 +10,7 @@ DISTFILES = Makefile \
libevent.c \
libevent2.c \
libtls.c \
+ memmem.c \
noop.c \
openssl.c \
pr_set_name.c \
diff --git a/have/memmem.c b/have/memmem.c
new file mode 100644
index 0000000..1171eb4
--- /dev/null
+++ b/have/memmem.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2022 Omar Polo <op@omarpolo.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <string.h>
+
+int
+main(void)
+{
+ char big[33], little[2];
+
+ memset(big, 0, sizeof(big));
+ memset(little, 0, sizeof(little));
+ return (memmem(big, sizeof(big), little, sizeof(little)) == NULL);
+}