aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile10
-rw-r--r--libsimple.c42
-rw-r--r--libsimple/mem.h113
-rw-r--r--libsimple/str.h70
-rw-r--r--man/libsimple_getenv_e.32
-rw-r--r--man/libsimple_getenv_ne.32
-rw-r--r--man/libsimple_memcaseeqlen.375
-rw-r--r--man/libsimple_memelem.34
-rw-r--r--man/libsimple_memends.34
-rw-r--r--man/libsimple_memeq.35
-rw-r--r--man/libsimple_memeqlen.375
-rw-r--r--man/libsimple_memmem.34
-rw-r--r--man/libsimple_mempcpy.32
-rw-r--r--man/libsimple_mempset.32
-rw-r--r--man/libsimple_mempsetelem.32
-rw-r--r--man/libsimple_memrcaseeqlen.375
-rw-r--r--man/libsimple_memrchr.34
-rw-r--r--man/libsimple_memrelem.34
-rw-r--r--man/libsimple_memreqlen.375
-rw-r--r--man/libsimple_memrmem.34
-rw-r--r--man/libsimple_memsetelem.32
-rw-r--r--man/libsimple_memstarts.34
-rw-r--r--man/libsimple_rawmemchr.34
-rw-r--r--man/libsimple_rawmemrchr.34
-rw-r--r--man/libsimple_strcasechr.32
-rw-r--r--man/libsimple_strcasechrnul.32
-rw-r--r--man/libsimple_strcasecmpnul.32
-rw-r--r--man/libsimple_strcaseends.32
-rw-r--r--man/libsimple_strcaseeq.33
-rw-r--r--man/libsimple_strcaseeqlen.371
-rw-r--r--man/libsimple_strcaseeqnul.32
-rw-r--r--man/libsimple_strcasestarts.32
-rw-r--r--man/libsimple_strcasestr.32
-rw-r--r--man/libsimple_strchrnul.32
-rw-r--r--man/libsimple_strcmpnul.32
-rw-r--r--man/libsimple_strend.32
-rw-r--r--man/libsimple_strends.32
-rw-r--r--man/libsimple_streq.34
-rw-r--r--man/libsimple_streqlen.371
-rw-r--r--man/libsimple_streqnul.32
-rw-r--r--man/libsimple_strrcasechr.32
-rw-r--r--man/libsimple_strrcaseeqlen.371
-rw-r--r--man/libsimple_strrcasestr.32
-rw-r--r--man/libsimple_strreqlen.371
-rw-r--r--man/libsimple_strrstr.32
-rw-r--r--man/libsimple_strstarts.32
-rw-r--r--man/libsimple_vputenvf.32
l---------man/memcaseeqlen.3libsimple1
l---------man/memeqlen.3libsimple1
l---------man/memrcaseeqlen.3libsimple1
l---------man/memreqlen.3libsimple1
l---------man/strcaseeqlen.3libsimple1
l---------man/streqlen.3libsimple1
l---------man/strrcaseeqlen.3libsimple1
l---------man/strreqlen.3libsimple1
-rw-r--r--memcaseeqlen.c42
-rw-r--r--memeqlen.c40
-rw-r--r--memrcaseeqlen.c41
-rw-r--r--memreqlen.c39
-rw-r--r--strcaseeqlen.c43
-rw-r--r--streqlen.c41
61 files changed, 1108 insertions, 59 deletions
diff --git a/Makefile b/Makefile
index 09d3d15..78b071a 100644
--- a/Makefile
+++ b/Makefile
@@ -43,12 +43,12 @@ OBJ =\
difftimeval.o\
doubletotimespec.o\
doubletotimeval.o\
- enaligned_memdup.o\
enaligned_allocz.o\
- enposix_memalignz.o\
+ enaligned_memdup.o\
encalloc.o\
enmalloc.o\
enmemdup.o\
+ enposix_memalignz.o\
enrealloc.o\
enstrdup.o\
enstrndup.o\
@@ -59,13 +59,17 @@ OBJ =\
envputenvf.o\
envreallocn.o\
isutf8.o\
+ memcaseeqlen.o\
memdup.o\
memelem.o\
memends.o\
+ memeqlen.o\
memmem.o\
mempsetelem.o\
+ memrcaseeqlen.o\
memrchr.o\
memrelem.o\
+ memreqlen.o\
memrmem.o\
memstarts.o\
minimise_number_string.o\
@@ -77,9 +81,11 @@ OBJ =\
strcasechr.o\
strcasechrnul.o\
strcaseends.o\
+ strcaseeqlen.o\
strcasestr.o\
strchrnul.o\
strends.o\
+ streqlen.o\
strncasestr.o\
strndup.o\
strnstr.o\
diff --git a/libsimple.c b/libsimple.c
index a874258..aecd0a3 100644
--- a/libsimple.c
+++ b/libsimple.c
@@ -97,7 +97,7 @@ main(void)
const char *cs;
char buf[1024], *s;
int intarray[10], fds[2], oldfd;
- size_t i, n;
+ size_t i, j, n;
assert(libsimple_default_failure_exit == 1);
@@ -1226,6 +1226,46 @@ main(void)
fprintf(stderr, "warning: libsimple_vasprintfa missing\n");
#endif
+ {
+ char a[] = "abcdefgh", b[] = "abcdefgh";
+ assert(libsimple_strreqlen("", "") == 0);
+ assert(libsimple_strreqlen("x", "") == 0);
+ assert(libsimple_strreqlen("x", "y") == 0);
+ assert(libsimple_strreqlen("", "y") == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_strreqlen(&a[i], &b[j]) == 8 - (i > j ? i : j));
+ a[i] = b[j] = '\0';
+ assert(libsimple_strreqlen(a, b) == (i == j ? i : 0));
+ a[i] = "abcdefgh"[i];
+ b[j] = "abcdefgh"[j];
+ }
+ }
+ assert(libsimple_strreqlen("abc", "ABC") == 0);
+ assert(libsimple_strreqlen("123", "123") == 3);
+ }
+
+ {
+ char a[] = "abcdefgh", b[] = "ABCDEFGH";
+ assert(libsimple_strrcaseeqlen("", "") == 0);
+ assert(libsimple_strrcaseeqlen("x", "") == 0);
+ assert(libsimple_strrcaseeqlen("x", "y") == 0);
+ assert(libsimple_strrcaseeqlen("", "y") == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_strrcaseeqlen(&a[i], &b[j]) == 8 - (i > j ? i : j));
+ assert(libsimple_strrcaseeqlen(&b[i], &a[j]) == 8 - (i > j ? i : j));
+ a[i] = b[j] = '\0';
+ assert(libsimple_strrcaseeqlen(a, b) == (i == j ? i : 0));
+ assert(libsimple_strrcaseeqlen(b, a) == (i == j ? i : 0));
+ a[i] = "abcdefgh"[i];
+ b[j] = "ABCDEFGH"[j];
+ }
+ }
+ assert(libsimple_strrcaseeqlen("abc", "abc") == 3);
+ assert(libsimple_strrcaseeqlen("123", "123") == 3);
+ }
+
if (!have_custom_malloc()) {
stderr_real = 1;
fprintf(stderr, "\nSome tests have not been ran because malloc(3) was not "
diff --git a/libsimple/mem.h b/libsimple/mem.h
index 6782c90..3092ddc 100644
--- a/libsimple/mem.h
+++ b/libsimple/mem.h
@@ -1,8 +1,21 @@
/* See LICENSE file for copyright and license details. */
+/* TODO memcasechr */
+/* TODO rawmemcasechr */
+/* TODO memrcasechr */
+/* TODO rawmemrcasechr */
+/* TODO memcasemem */
+/* TODO memrcasemem */
+/* TODO memcasestarts */
+/* TODO memcaseends */
+/* TODO memcasecmp */
+/* TODO memcaseeq */
+
+
/**
- * Finds the first occurence of a byte value in an array of bytes
+ * Finds the first occurence of a byte value in an array of bytes,
+ * the comparison is case-sensitive
*
* This function is optimised for instances where it is already
* known that there is at least one occurence; if is no occurence
@@ -22,7 +35,8 @@ void *libsimple_rawmemchr(const void *, int);
/**
- * Finds the last occurence of a byte value in an array of bytes
+ * Finds the last occurence of a byte value in an array of bytes,
+ * the comparison is case-sensitive
*
* @param s The array of bytes to search
* @param c The byte value to search for
@@ -39,7 +53,8 @@ void *libsimple_memrchr(const void *, int, size_t);
/**
- * Finds the last occurence of a byte value in an array of bytes
+ * Finds the last occurence of a byte value in an array of bytes,
+ * the comparison is case-sensitive
*
* This function is optimised for instances where it is already
* known that there is at least one occurence; if is no occurence
@@ -60,7 +75,7 @@ void *libsimple_rawmemrchr(const void *, int, size_t);
/**
- * Finds the first substring in an array of bytes
+ * Finds the first substring in an array of bytes, the comparison is case-sensitive
*
* @param haystack The array of bytes to search
* @param nhaystack The length of `haystack`
@@ -78,7 +93,7 @@ void *libsimple_memmem(const void *, size_t, const void *, size_t);
/**
- * Finds the last substring in an array of bytes
+ * Finds the last substring in an array of bytes, the comparison is case-sensitive
*
* @param haystack The array of bytes to search
* @param nhaystack The length of `haystack`
@@ -96,7 +111,7 @@ void *libsimple_memrmem(const void *, size_t, const void *, size_t);
/**
- * Finds the first element in an array
+ * Finds the first element in an array, the comparison is case-sensitive
*
* @param haystack The array of bytes to search
* @param nhaystack The length of `haystack`, divided by `needle`
@@ -115,7 +130,7 @@ void *libsimple_memelem(const void *, size_t, const void *, size_t);
/**
- * Finds the last element in an array
+ * Finds the last element in an array, the comparison is case-sensitive
*
* @param haystack The array of bytes to search
* @param nhaystack The length of `haystack`, divided by `needle`
@@ -134,7 +149,7 @@ void *libsimple_memrelem(const void *, size_t, const void *, size_t);
/**
- * Checks the beginning of an array of bytes
+ * Checks the beginning of an array of bytes, the comparison is case-sensitive
*
* @param s The array of bytes to check
* @param n The length of `s`
@@ -150,7 +165,7 @@ int libsimple_memstarts(const void *, size_t, const void *, size_t);
/**
- * Checks the end of an array of bytes
+ * Checks the end of an array of bytes, the comparison is case-sensitive
*
* @param s The array of bytes to check
* @param n The length of `s`
@@ -166,7 +181,7 @@ int libsimple_memends(const void *, size_t, const void *, size_t);
/**
- * Checks two arrays of bytes for equality
+ * Checks two arrays of bytes for equality, the comparison is case-sensitive
*
* @param a One of the arrays of bytes
* @param b The other arrays of bytes
@@ -222,9 +237,10 @@ static inline void *libsimple_mempset(void *__s, int __c, size_t __n)
* @param nitems The number of copies to fill `buf` with
* @return `&buf[nelems * size]`
*/
+_LIBSIMPLE_GCC_ONLY(__attribute__((__warn_unused_result__)))
void *libsimple_mempsetelem(void *__buf, const void *__item, size_t __size, size_t __nitems);
-#ifndef libsimple_mempsetelem
-# define libsimple_mempsetelem libsimple_mempsetelem
+#ifndef mempsetelem
+# define mempsetelem libsimple_mempsetelem
#endif
@@ -237,8 +253,77 @@ void *libsimple_mempsetelem(void *__buf, const void *__item, size_t __size, size
* @param nitems The number of copies to fill `buf` with
* @return `buf`
*/
+_LIBSIMPLE_GCC_ONLY(__attribute__((__warn_unused_result__)))
static inline void *libsimple_memsetelem(void *__buf, const void *__item, size_t __size, size_t __nitems)
{ return libsimple_mempsetelem(__buf, __item, __size, __nitems), __buf; }
-#ifndef libsimple_memsetelem
-# define libsimple_memsetelem libsimple_memsetelem
+#ifndef memsetelem
+# define memsetelem libsimple_memsetelem
+#endif
+
+
+/**
+ * Compares the beginning of two memory segments, the comparison is case-sensitive
+ *
+ * @param a One of the arrays
+ * @param n The length of `a`
+ * @param b The other array
+ * @param m The length of `b`
+ * @return The number of bytes `a` and `b` have
+ * in common in their beginnings
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
+size_t libsimple_memeqlen(const void *, size_t, const void *, size_t);
+#ifndef memeqlen
+# define memeqlen libsimple_memeqlen
+#endif
+
+
+/**
+ * Compares the beginning of two memory segments, the comparison is case-insensitive
+ *
+ * @param a One of the arrays
+ * @param n The length of `a`
+ * @param b The other array
+ * @param m The length of `b`
+ * @return The number of bytes `a` and `b` have
+ * in common in their beginnings
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
+size_t libsimple_memcaseeqlen(const void *, size_t, const void *, size_t);
+#ifndef memcaseeqlen
+# define memcaseeqlen libsimple_memcaseeqlen
+#endif
+
+
+/**
+ * Compares the end of two memory segments, the comparison is case-sensitive
+ *
+ * @param a One of the arrays
+ * @param n The length of `a`
+ * @param b The other array
+ * @param m The length of `b`
+ * @return The number of bytes `a` and `b` have
+ * in common in their ends
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
+size_t libsimple_memreqlen(const void *, size_t, const void *, size_t);
+#ifndef memreqlen
+# define memreqlen libsimple_memreqlen
+#endif
+
+
+/**
+ * Compares the end of two memory segments, the comparison is case-insensitive
+ *
+ * @param a One of the arrays
+ * @param n The length of `a`
+ * @param b The other array
+ * @param m The length of `b`
+ * @return The number of bytes `a` and `b` have
+ * in common in their ends
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
+size_t libsimple_memrcaseeqlen(const void *, size_t, const void *, size_t);
+#ifndef memrcaseeqlen
+# define memrcaseeqlen libsimple_memrcaseeqlen
#endif
diff --git a/libsimple/str.h b/libsimple/str.h
index c046fbc..522062e 100644
--- a/libsimple/str.h
+++ b/libsimple/str.h
@@ -1,12 +1,6 @@
/* See LICENSE file for copyright and license details. */
-/* TODO streqlen */
-/* TODO strcaseeqlen */
-/* TODO strreqlen */
-/* TODO strrcaseeqlen */
-
-
/**
* Scans for a character in a string, the scan is case-sensitive
*
@@ -104,7 +98,7 @@ int libsimple_strstarts(const char *, const char *);
*/
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
static inline int libsimple_strcasestarts(const char *__s, const char *__t)
-{ return !strncasecmp(__s, __t, strlen(__t)); }
+{ return !strncasecmp(__s, __t, (strlen)(__t)); }
#ifndef strcasestarts
# define strcasestarts libsimple_strcasestarts
#endif
@@ -284,3 +278,65 @@ static inline int libsimple_strcaseeqnul(const char *__a, const char *__b)
#ifndef strcaseeqnul
# define strcaseeqnul libsimple_strcaseeqnul
#endif
+
+
+/**
+ * Compares the beginning of two strings, the comparison is case-sensitive
+ *
+ * @param a One of the strings
+ * @param b The other string
+ * @return The number of bytes `a` and `b` have
+ * in common in their beginnings
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
+size_t libsimple_streqlen(const char *, const char *);
+#ifndef streqlen
+# define streqlen libsimple_streqlen
+#endif
+
+
+/**
+ * Compares the beginning of two strings, the comparison is case-insensitive
+ *
+ * @param a One of the strings
+ * @param b The other string
+ * @return The number of bytes `a` and `b` have
+ * in common in their beginnings
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
+size_t libsimple_strcaseeqlen(const char *, const char *);
+#ifndef strcaseeqlen
+# define strcaseeqlen libsimple_strcaseeqlen
+#endif
+
+
+/**
+ * Compares the end of two strings, the comparison is case-sensitive
+ *
+ * @param a One of the strings
+ * @param b The other string
+ * @return The number of bytes `a` and `b` have
+ * in common in their ends
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
+static inline size_t libsimple_strreqlen(const char *__a, const char *__b)
+{ return libsimple_memreqlen(__a, (strlen)(__a), __b, (strlen)(__b)); }
+#ifndef strreqlen
+# define strreqlen libsimple_strreqlen
+#endif
+
+
+/**
+ * Compares the end of two strings, the comparison is case-insensitive
+ *
+ * @param a One of the strings
+ * @param b The other string
+ * @return The number of bytes `a` and `b` have
+ * in common in their ends
+ */
+_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
+static inline size_t libsimple_strrcaseeqlen(const char *__a, const char *__b)
+{ return libsimple_memrcaseeqlen(__a, (strlen)(__a), __b, (strlen)(__b)); }
+#ifndef strrcaseeqlen
+# define strrcaseeqlen libsimple_strrcaseeqlen
+#endif
diff --git a/man/libsimple_getenv_e.3 b/man/libsimple_getenv_e.3
index 27fba39..7e3a3ca 100644
--- a/man/libsimple_getenv_e.3
+++ b/man/libsimple_getenv_e.3
@@ -11,7 +11,7 @@ static inline const char *libsimple_getenv_e(const char *\fIname\fP);
# define getenv_e libsimple_getenv_e
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_getenv_ne.3 b/man/libsimple_getenv_ne.3
index a0eca77..55b592e 100644
--- a/man/libsimple_getenv_ne.3
+++ b/man/libsimple_getenv_ne.3
@@ -11,7 +11,7 @@ static inline char *libsimple_getenv_ne(const char *\fIname\fP);
# define getenv_ne libsimple_getenv_ne
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_memcaseeqlen.3 b/man/libsimple_memcaseeqlen.3
new file mode 100644
index 0000000..8cad3ca
--- /dev/null
+++ b/man/libsimple_memcaseeqlen.3
@@ -0,0 +1,75 @@
+.TH LIBSIMPLE_MEMCASEEQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_memcaseeqlen \- check initial commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_memcaseeqlen(const void *\fIa\fP, size_t \fIn\fP, const void *\fIb\fP, size_t \fIm\fP);
+
+#ifndef memcaseeqlen
+# define memcaseeqlen libsimple_memcaseeqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_memcaseeqlen ()
+function scans the number of bytes the byte array
+.IR a ,
+with size
+.IR n ,
+have in common the byte array
+.IR b ,
+with size
+.IR m ,
+at their beginnings.
+.PP
+The comparison is case-insensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_memcaseeqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their beginnings.
+.SH ERRORS
+The
+.BR libsimple_memcaseeqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_memcaseeqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_memcaseeqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_memcaseeqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_memeqlen (3),
+.BR libsimple_memrcaseeqlen (3)
diff --git a/man/libsimple_memelem.3 b/man/libsimple_memelem.3
index 5e54171..833e246 100644
--- a/man/libsimple_memelem.3
+++ b/man/libsimple_memelem.3
@@ -11,7 +11,7 @@ void *libsimple_memelem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, cons
# define memelem libsimple_memelem
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -27,6 +27,8 @@ with the size
.IR nneedle ,
and with an offset equivalent to zero modulo
.IR nneedle .
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memelem ()
diff --git a/man/libsimple_memends.3 b/man/libsimple_memends.3
index 114cedb..8ab4f81 100644
--- a/man/libsimple_memends.3
+++ b/man/libsimple_memends.3
@@ -11,7 +11,7 @@ void *libsimple_memends(const void *\fIs\fP, size_t \fIn\fP, const void *\fIt\fP
# define memends libsimple_memends
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -31,6 +31,8 @@ is the same as the
.I m
first bytes of
.IR t .
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memends ()
diff --git a/man/libsimple_memeq.3 b/man/libsimple_memeq.3
index fa1ac20..1deca9c 100644
--- a/man/libsimple_memeq.3
+++ b/man/libsimple_memeq.3
@@ -11,7 +11,7 @@ void *libsimple_memeq(const void *\fIa\fP, const void *\fIb\fP, size_t \fIn\fP);
# define memeq libsimple_memeq
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -24,6 +24,8 @@ bytes of
and
.I b
are equal.
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memeq ()
@@ -67,4 +69,5 @@ None.
.SH BUGS
None.
.SH SEE ALSO
+.BR libsimple_memeqlen (3),
.BR memcmp (3)
diff --git a/man/libsimple_memeqlen.3 b/man/libsimple_memeqlen.3
new file mode 100644
index 0000000..6ef9121
--- /dev/null
+++ b/man/libsimple_memeqlen.3
@@ -0,0 +1,75 @@
+.TH LIBSIMPLE_MEMEQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_memeqlen \- check initial commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_memeqlen(const void *\fIa\fP, size_t \fIn\fP, const void *\fIb\fP, size_t \fIm\fP);
+
+#ifndef memeqlen
+# define memeqlen libsimple_memeqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_memeqlen ()
+function scans the number of bytes the byte array
+.IR a ,
+with size
+.IR n ,
+have in common the byte array
+.IR b ,
+with size
+.IR m ,
+at their beginnings.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_memeqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their beginnings.
+.SH ERRORS
+The
+.BR libsimple_memeqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_memeqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_memeqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_memeqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_memcaseeqlen (3),
+.BR libsimple_memreqlen (3)
diff --git a/man/libsimple_memmem.3 b/man/libsimple_memmem.3
index 18dec5d..15437cd 100644
--- a/man/libsimple_memmem.3
+++ b/man/libsimple_memmem.3
@@ -11,7 +11,7 @@ void *libsimple_memmem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, const
# define memmem libsimple_memmem
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -25,6 +25,8 @@ for the first occurence of the byte string
.I needle
with the size
.IR nneedle .
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memmem ()
diff --git a/man/libsimple_mempcpy.3 b/man/libsimple_mempcpy.3
index 4d4c514..26531b5 100644
--- a/man/libsimple_mempcpy.3
+++ b/man/libsimple_mempcpy.3
@@ -11,7 +11,7 @@ void *libsimple_mempcpy(void *\fIdest\fP, const void *\fIsrc\fP, size_t \fIn\fP)
# define mempcpy libsimple_mempcpy
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_mempset.3 b/man/libsimple_mempset.3
index 33b610c..f75e424 100644
--- a/man/libsimple_mempset.3
+++ b/man/libsimple_mempset.3
@@ -11,7 +11,7 @@ void *libsimple_mempset(void *\fIs\fP, int \fIc\fP, size_t \fIn\fP);
# define mempset libsimple_mempset
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_mempsetelem.3 b/man/libsimple_mempsetelem.3
index ca52a2e..0b32228 100644
--- a/man/libsimple_mempsetelem.3
+++ b/man/libsimple_mempsetelem.3
@@ -11,7 +11,7 @@ void *libsimple_mempsetelem(void *\fIbuf\fP, const void *\fIitem\fP, size_t \fIs
# define mempsetelem libsimple_mempsetelem
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_memrcaseeqlen.3 b/man/libsimple_memrcaseeqlen.3
new file mode 100644
index 0000000..ce6838c
--- /dev/null
+++ b/man/libsimple_memrcaseeqlen.3
@@ -0,0 +1,75 @@
+.TH LIBSIMPLE_MEMRCASEEQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_memrcaseeqlen \- check terminal commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_memrcaseeqlen(const void *\fIa\fP, size_t \fIn\fP, const void *\fIb\fP, size_t \fIm\fP);
+
+#ifndef memrcaseeqlen
+# define memrcaseeqlen libsimple_memrcaseeqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_memrcaseeqlen ()
+function scans the number of bytes the byte array
+.IR a ,
+with size
+.IR n ,
+have in common the byte array
+.IR b ,
+with size
+.IR m ,
+at their ends.
+.PP
+The comparison is case-insensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_memrcaseeqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their ends.
+.SH ERRORS
+The
+.BR libsimple_memrcaseeqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_memrcaseeqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_memrcaseeqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_memrcaseeqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_memreqlen (3),
+.BR libsimple_memcaseeqlen (3)
diff --git a/man/libsimple_memrchr.3 b/man/libsimple_memrchr.3
index b0a01a7..8fd74f7 100644
--- a/man/libsimple_memrchr.3
+++ b/man/libsimple_memrchr.3
@@ -11,7 +11,7 @@ void *libsimple_memrchr(const void *\fIs\fP, int \fIc\fP, size_t \fIn\fP);
# define memrchr libsimple_memrchr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -25,6 +25,8 @@ for the last occurence of the byte
.I c
(it is converted to a
.BR char ).
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memrchr ()
diff --git a/man/libsimple_memrelem.3 b/man/libsimple_memrelem.3
index 66f7bd8..203ffee 100644
--- a/man/libsimple_memrelem.3
+++ b/man/libsimple_memrelem.3
@@ -11,7 +11,7 @@ void *libsimple_memrelem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, con
# define memrelem libsimple_memrelem
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -27,6 +27,8 @@ with the size
.IR nneedle ,
and with an offset equivalent to zero modulo
.IR nneedle .
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memrelem ()
diff --git a/man/libsimple_memreqlen.3 b/man/libsimple_memreqlen.3
new file mode 100644
index 0000000..80ae98e
--- /dev/null
+++ b/man/libsimple_memreqlen.3
@@ -0,0 +1,75 @@
+.TH LIBSIMPLE_MEMREQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_memreqlen \- check terminal commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_memreqlen(const void *\fIa\fP, size_t \fIn\fP, const void *\fIb\fP, size_t \fIm\fP);
+
+#ifndef memreqlen
+# define memreqlen libsimple_memreqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_memreqlen ()
+function scans the number of bytes the byte array
+.IR a ,
+with size
+.IR n ,
+have in common the byte array
+.IR b ,
+with size
+.IR m ,
+at their ends.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_memreqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their ends.
+.SH ERRORS
+The
+.BR libsimple_memreqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_memreqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_memreqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_memreqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_memrcaseeqlen (3),
+.BR libsimple_memeqlen (3)
diff --git a/man/libsimple_memrmem.3 b/man/libsimple_memrmem.3
index aae6572..8ee94c2 100644
--- a/man/libsimple_memrmem.3
+++ b/man/libsimple_memrmem.3
@@ -11,7 +11,7 @@ void *libsimple_memrmem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, cons
# define memrmem libsimple_memrmem
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -25,6 +25,8 @@ for the last occurence of the byte string
.I needle
with the size
.IR nneedle .
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memrmem ()
diff --git a/man/libsimple_memsetelem.3 b/man/libsimple_memsetelem.3
index 700310a..516a20b 100644
--- a/man/libsimple_memsetelem.3
+++ b/man/libsimple_memsetelem.3
@@ -11,7 +11,7 @@ static inline void *libsimple_memsetelem(void *\fIbuf\fP, const void *\fIitem\fP
# define memsetelem libsimple_memsetelem
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_memstarts.3 b/man/libsimple_memstarts.3
index e5e183b..13713a2 100644
--- a/man/libsimple_memstarts.3
+++ b/man/libsimple_memstarts.3
@@ -11,7 +11,7 @@ void *libsimple_memstarts(const void *\fIs\fP, size_t \fIn\fP, const void *\fIt\
# define memstarts libsimple_memstarts
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -29,6 +29,8 @@ is the same as the
.I m
first bytes of
.IR t .
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_memstarts ()
diff --git a/man/libsimple_rawmemchr.3 b/man/libsimple_rawmemchr.3
index 2991b1f..4126fbb 100644
--- a/man/libsimple_rawmemchr.3
+++ b/man/libsimple_rawmemchr.3
@@ -11,7 +11,7 @@ void *libsimple_rawmemchr(const void *\fIs\fP, int \fIc\fP);
# define rawmemchr libsimple_rawmemchr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -29,6 +29,8 @@ The
function assumes there is at least one
occurence, its behaviour is undefined
if this is not the case.
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_rawmemchr ()
diff --git a/man/libsimple_rawmemrchr.3 b/man/libsimple_rawmemrchr.3
index c445794..198daa6 100644
--- a/man/libsimple_rawmemrchr.3
+++ b/man/libsimple_rawmemrchr.3
@@ -11,7 +11,7 @@ void *libsimple_rawmemrchr(const void *s, int c, size_t n);
# define rawmemrchr libsimple_rawmemrchr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -31,6 +31,8 @@ The
function assumes there is at least one
occurence, its behaviour is undefined
if this is not the case.
+.PP
+The comparison is case-sensitive.
.SH RETURN VALUE
The
.BR libsimple_rawmemrchr ()
diff --git a/man/libsimple_strcasechr.3 b/man/libsimple_strcasechr.3
index f100ac8..c7cc780 100644
--- a/man/libsimple_strcasechr.3
+++ b/man/libsimple_strcasechr.3
@@ -11,7 +11,7 @@ char *libsimple_strcasechr(const char *\fIs\fP, int \fIc\fP);
# define strcasechr libsimple_strcasechr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcasechrnul.3 b/man/libsimple_strcasechrnul.3
index a92387d..81bdc7a 100644
--- a/man/libsimple_strcasechrnul.3
+++ b/man/libsimple_strcasechrnul.3
@@ -11,7 +11,7 @@ char *libsimple_strcasechrnul(const char *\fIs\fP, int \fIc\fP);
# define strcasechrnul libsimple_strcasechrnul
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcasecmpnul.3 b/man/libsimple_strcasecmpnul.3
index ffd0f8d..e07b551 100644
--- a/man/libsimple_strcasecmpnul.3
+++ b/man/libsimple_strcasecmpnul.3
@@ -11,7 +11,7 @@ static inline int libsimple_strcasecmpnul(const char *\fIa\fP, const char *\fIb\
# define strcasecmpnul libsimple_strcasecmpnul
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcaseends.3 b/man/libsimple_strcaseends.3
index 4a792a3..ff9a578 100644
--- a/man/libsimple_strcaseends.3
+++ b/man/libsimple_strcaseends.3
@@ -11,7 +11,7 @@ int libsimple_strcaseends(const char *\fIs\fP, const char *\fIt\fP);
# define strcaseends libsimple_strcaseends
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcaseeq.3 b/man/libsimple_strcaseeq.3
index 41fb3c1..d38b439 100644
--- a/man/libsimple_strcaseeq.3
+++ b/man/libsimple_strcaseeq.3
@@ -11,7 +11,7 @@ static inline int libsimple_strcaseeq(const char *\fIa\fP, const char *\fIb\fP);
# define strcaseeq libsimple_strcaseeq
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -69,4 +69,5 @@ None.
.SH SEE ALSO
.BR libsimple_strcaseeqnul (3),
.BR libsimple_streq (3),
+.BR libsimple_strcaseeqlen (3),
.BR strcasecmp (3)
diff --git a/man/libsimple_strcaseeqlen.3 b/man/libsimple_strcaseeqlen.3
new file mode 100644
index 0000000..6ff8e18
--- /dev/null
+++ b/man/libsimple_strcaseeqlen.3
@@ -0,0 +1,71 @@
+.TH LIBSIMPLE_STRCASEEQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strcaseeqlen \- check initial commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_strcaseeqlen(const char *\fIa\fP, const char *\fIb\fP);
+
+#ifndef memrcaseeqlen
+# define memrcaseeqlen libsimple_strcaseeqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strcaseeqlen ()
+function scans the number of bytes the string
+.I a
+have in common the string
+.I b
+at their beginnings.
+.PP
+The comparison is case-insensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_strcaseeqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their beginnings.
+.SH ERRORS
+The
+.BR libsimple_strcaseeqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_strcaseeqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strcaseeqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strcaseeqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_streqlen (3),
+.BR libsimple_strrcaseeqlen (3)
diff --git a/man/libsimple_strcaseeqnul.3 b/man/libsimple_strcaseeqnul.3
index ab06c67..17edb4b 100644
--- a/man/libsimple_strcaseeqnul.3
+++ b/man/libsimple_strcaseeqnul.3
@@ -11,7 +11,7 @@ static inline int libsimple_strcaseeqnul(const char *\fIa\fP, const char *\fIb\f
# define strcaseeqnul libsimple_strcaseeqnul
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcasestarts.3 b/man/libsimple_strcasestarts.3
index 9b7081f..c36ac4a 100644
--- a/man/libsimple_strcasestarts.3
+++ b/man/libsimple_strcasestarts.3
@@ -11,7 +11,7 @@ static inline int libsimple_strcasestarts(const char *\fIs\fP, const char *\fIt\
# define strcasestarts libsimple_strcasestarts
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcasestr.3 b/man/libsimple_strcasestr.3
index 346a17b..fe8c6bb 100644
--- a/man/libsimple_strcasestr.3
+++ b/man/libsimple_strcasestr.3
@@ -11,7 +11,7 @@ char *libsimple_strcasestr(const char *\fIhaystack\fP, const char *\fIneedle\fP)
# define strcasestr libsimple_strcasestr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strchrnul.3 b/man/libsimple_strchrnul.3
index 8d8f53a..0ed76d9 100644
--- a/man/libsimple_strchrnul.3
+++ b/man/libsimple_strchrnul.3
@@ -11,7 +11,7 @@ char *libsimple_strchrnul(const char *\fIs\fP, int \fIc\fP);
# define strchrnul libsimple_strchrnul
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strcmpnul.3 b/man/libsimple_strcmpnul.3
index 79c53bf..ea962d7 100644
--- a/man/libsimple_strcmpnul.3
+++ b/man/libsimple_strcmpnul.3
@@ -11,7 +11,7 @@ static inline int libsimple_strcmpnul(const char *\fIa\fP, const char *\fIb\fP);
# define strcmpnul libsimple_strcmpnul
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strend.3 b/man/libsimple_strend.3
index 1ceb9ac..e1652b6 100644
--- a/man/libsimple_strend.3
+++ b/man/libsimple_strend.3
@@ -11,7 +11,7 @@ static inline char *libsimple_strend(const char *\fIs\fP);
# define strend libsimple_strend
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strends.3 b/man/libsimple_strends.3
index abc7e5a..e7b9088 100644
--- a/man/libsimple_strends.3
+++ b/man/libsimple_strends.3
@@ -11,7 +11,7 @@ int libsimple_strends(const char *\fIs\fP, const char *\fIt\fP);
# define strends libsimple_strends
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_streq.3 b/man/libsimple_streq.3
index f8d28fb..7904860 100644
--- a/man/libsimple_streq.3
+++ b/man/libsimple_streq.3
@@ -11,7 +11,7 @@ static inline int libsimple_streq(const char *\fIa\fP, const char *\fIb\fP);
# define streq libsimple_streq
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
@@ -68,4 +68,6 @@ None.
.SH SEE ALSO
.BR libsimple_streqnul (3),
.BR libsimple_strcaseeq (3),
+.BR libsimple_strcaseeq (3),
+.BR libsimple_streqlen (3),
.BR strcmp (3)
diff --git a/man/libsimple_streqlen.3 b/man/libsimple_streqlen.3
new file mode 100644
index 0000000..78fee3e
--- /dev/null
+++ b/man/libsimple_streqlen.3
@@ -0,0 +1,71 @@
+.TH LIBSIMPLE_STREQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_streqlen \- check initial commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_streqlen(const char *\fIa\fP, const char *\fIb\fP);
+
+#ifndef memrcaseeqlen
+# define memrcaseeqlen libsimple_streqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_streqlen ()
+function scans the number of bytes the string
+.I a
+have in common the string
+.I b
+at their beginnings.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_streqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their beginnings.
+.SH ERRORS
+The
+.BR libsimple_streqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_streqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_streqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_streqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_strreqlen (3),
+.BR libsimple_strcaseeqlen (3)
diff --git a/man/libsimple_streqnul.3 b/man/libsimple_streqnul.3
index fa0a35e..df39a67 100644
--- a/man/libsimple_streqnul.3
+++ b/man/libsimple_streqnul.3
@@ -11,7 +11,7 @@ static inline int libsimple_streqnul(const char *\fIa\fP, const char *\fIb\fP);
# define streqnul libsimple_streqnul
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strrcasechr.3 b/man/libsimple_strrcasechr.3
index 188bcd7..65382e6 100644
--- a/man/libsimple_strrcasechr.3
+++ b/man/libsimple_strrcasechr.3
@@ -11,7 +11,7 @@ char *libsimple_strrcasechr(const char *\fIs\fP, int \fIc\fP);
# define strrcasechr libsimple_strrcasechr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strrcaseeqlen.3 b/man/libsimple_strrcaseeqlen.3
new file mode 100644
index 0000000..429393f
--- /dev/null
+++ b/man/libsimple_strrcaseeqlen.3
@@ -0,0 +1,71 @@
+.TH LIBSIMPLE_STRRCASEEQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strrcaseeqlen \- check terminal commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_strrcaseeqlen(const char *\fIa\fP, const char *\fIb\fP);
+
+#ifndef strrcaseeqlen
+# define strrcaseeqlen libsimple_strrcaseeqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strrcaseeqlen ()
+function scans the number of bytes the string
+.I a
+have in common the string
+.I b
+at their ends.
+.PP
+The comparison is case-insensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_strrcaseeqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their ends.
+.SH ERRORS
+The
+.BR libsimple_strrcaseeqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_strrcaseeqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strrcaseeqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strrcaseeqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_strreqlen (3),
+.BR libsimple_strcaseeqlen (3)
diff --git a/man/libsimple_strrcasestr.3 b/man/libsimple_strrcasestr.3
index 3b277ae..4418795 100644
--- a/man/libsimple_strrcasestr.3
+++ b/man/libsimple_strrcasestr.3
@@ -11,7 +11,7 @@ char *libsimple_strrcasestr(const char *\fIhaystack\fP, const char *\fIneedle\fP
# define strrcasestr libsimple_strrcasestr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strreqlen.3 b/man/libsimple_strreqlen.3
new file mode 100644
index 0000000..e64358d
--- /dev/null
+++ b/man/libsimple_strreqlen.3
@@ -0,0 +1,71 @@
+.TH LIBSIMPLE_STRREQLEN 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strreqlen \- check terminal commonality
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+size_t libsimple_strreqlen(const char *\fIa\fP, const char *\fIb\fP);
+
+#ifndef strreqlen
+# define strreqlen libsimple_strreqlen
+#endif
+.fi
+.PP
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strreqlen ()
+function scans the number of bytes the string
+.I a
+have in common the string
+.I b
+at their ends.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_strreqlen ()
+function returns the number of bytes
+.I a
+and
+.I b
+have in common at their ends.
+.SH ERRORS
+The
+.BR libsimple_strreqlen ()
+function cannot fail.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface Attribute Value
+T{
+.BR libsimple_strreqlen ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strreqlen ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strreqlen ()
+T} Async-cancel safety AC-Safe
+.TE
+.SH EXAMPLES
+None.
+.SH APPLICATION USAGE
+None.
+.SH RATIONALE
+None.
+.SH FUTURE DIRECTIONS
+None.
+.SH NOTES
+None.
+.SH BUGS
+None.
+.SH SEE ALSO
+.BR libsimple_strreqlen (3),
+.BR libsimple_streqlen (3)
diff --git a/man/libsimple_strrstr.3 b/man/libsimple_strrstr.3
index ad85a54..973f50b 100644
--- a/man/libsimple_strrstr.3
+++ b/man/libsimple_strrstr.3
@@ -11,7 +11,7 @@ char *libsimple_strrstr(const char *\fIhaystack\fP, const char *\fIneedle\fP);
# define strrstr libsimple_strrstr
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_strstarts.3 b/man/libsimple_strstarts.3
index cf08967..c277f11 100644
--- a/man/libsimple_strstarts.3
+++ b/man/libsimple_strstarts.3
@@ -11,7 +11,7 @@ int libsimple_strstarts(const char *\fIs\fP, const char *\fIt\fP);
# define strstarts libsimple_strstarts
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/libsimple_vputenvf.3 b/man/libsimple_vputenvf.3
index 3c081e1..db6858e 100644
--- a/man/libsimple_vputenvf.3
+++ b/man/libsimple_vputenvf.3
@@ -31,7 +31,7 @@ static inline void libsimple_eputenvf(const char *\fIfmt\fP, ...);
# define eputenvf libsimple_eputenvf
#endif
.fi
-
+.PP
Link with
.IR \-lsimple .
.SH DESCRIPTION
diff --git a/man/memcaseeqlen.3libsimple b/man/memcaseeqlen.3libsimple
new file mode 120000
index 0000000..5fa4167
--- /dev/null
+++ b/man/memcaseeqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_memcaseeqlen.3 \ No newline at end of file
diff --git a/man/memeqlen.3libsimple b/man/memeqlen.3libsimple
new file mode 120000
index 0000000..73567aa
--- /dev/null
+++ b/man/memeqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_memeqlen.3 \ No newline at end of file
diff --git a/man/memrcaseeqlen.3libsimple b/man/memrcaseeqlen.3libsimple
new file mode 120000
index 0000000..5f451d1
--- /dev/null
+++ b/man/memrcaseeqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_memrcaseeqlen.3 \ No newline at end of file
diff --git a/man/memreqlen.3libsimple b/man/memreqlen.3libsimple
new file mode 120000
index 0000000..fd637c4
--- /dev/null
+++ b/man/memreqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_memreqlen.3 \ No newline at end of file
diff --git a/man/strcaseeqlen.3libsimple b/man/strcaseeqlen.3libsimple
new file mode 120000
index 0000000..36f0971
--- /dev/null
+++ b/man/strcaseeqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_strcaseeqlen.3 \ No newline at end of file
diff --git a/man/streqlen.3libsimple b/man/streqlen.3libsimple
new file mode 120000
index 0000000..85b2736
--- /dev/null
+++ b/man/streqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_streqlen.3 \ No newline at end of file
diff --git a/man/strrcaseeqlen.3libsimple b/man/strrcaseeqlen.3libsimple
new file mode 120000
index 0000000..698634c
--- /dev/null
+++ b/man/strrcaseeqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_strrcaseeqlen.3 \ No newline at end of file
diff --git a/man/strreqlen.3libsimple b/man/strreqlen.3libsimple
new file mode 120000
index 0000000..0be1d93
--- /dev/null
+++ b/man/strreqlen.3libsimple
@@ -0,0 +1 @@
+libsimple_strreqlen.3 \ No newline at end of file
diff --git a/memcaseeqlen.c b/memcaseeqlen.c
new file mode 100644
index 0000000..79ab198
--- /dev/null
+++ b/memcaseeqlen.c
@@ -0,0 +1,42 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+size_t
+libsimple_memcaseeqlen(const void *a_, size_t n, const void *b_, size_t m)
+{
+ const char *a = a_, *b = b_;
+ size_t i = 0;
+ n = n < m ? n : m;
+ for (; i < n && tolower(a[i]) == tolower(b[i]); i++);
+ return i;
+}
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char s[] = "abcdefgh", t[] = "ABCDEFGH";
+ size_t i, j;
+ assert(libsimple_memcaseeqlen("x", 0, "x", 0) == 0);
+ assert(libsimple_memcaseeqlen("x", 1, "x", 0) == 0);
+ assert(libsimple_memcaseeqlen("x", 1, "y", 1) == 0);
+ assert(libsimple_memcaseeqlen("y", 0, "y", 1) == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_memcaseeqlen(&s[i], 8 - i, &t[j], 8 - j) == (i == j ? 8 - i : 0));
+ assert(libsimple_memcaseeqlen(s, i, t, j) == (i < j ? i : j));
+ assert(libsimple_memcaseeqlen(&t[i], 8 - i, &s[j], 8 - j) == (i == j ? 8 - i : 0));
+ assert(libsimple_memcaseeqlen(t, i, s, j) == (i < j ? i : j));
+ }
+ }
+ assert(libsimple_memcaseeqlen("abc", 3, "abc", 3) == 3);
+ assert(libsimple_memcaseeqlen("123", 3, "123", 3) == 3);
+ return 0;
+}
+
+#endif
diff --git a/memeqlen.c b/memeqlen.c
new file mode 100644
index 0000000..f5a214c
--- /dev/null
+++ b/memeqlen.c
@@ -0,0 +1,40 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+size_t
+libsimple_memeqlen(const void *a_, size_t n, const void *b_, size_t m)
+{
+ const char *a = a_, *b = b_;
+ size_t i = 0;
+ n = n < m ? n : m;
+ for (; i < n && a[i] == b[i]; i++);
+ return i;
+}
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char s[] = "abcdefgh", t[] = "abcdefgh";
+ size_t i, j;
+ assert(libsimple_memeqlen("x", 0, "x", 0) == 0);
+ assert(libsimple_memeqlen("x", 1, "x", 0) == 0);
+ assert(libsimple_memeqlen("x", 1, "y", 1) == 0);
+ assert(libsimple_memeqlen("y", 0, "y", 1) == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_memeqlen(&s[i], 8 - i, &t[j], 8 - j) == (i == j ? 8 - i : 0));
+ assert(libsimple_memeqlen(s, i, t, j) == (i < j ? i : j));
+ }
+ }
+ assert(libsimple_memeqlen("abc", 3, "ABC", 3) == 0);
+ assert(libsimple_memeqlen("123", 3, "123", 3) == 3);
+ return 0;
+}
+
+#endif
diff --git a/memrcaseeqlen.c b/memrcaseeqlen.c
new file mode 100644
index 0000000..3f586b7
--- /dev/null
+++ b/memrcaseeqlen.c
@@ -0,0 +1,41 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+size_t
+libsimple_memrcaseeqlen(const void *a_, size_t n, const void *b_, size_t m)
+{
+ const char *a = &((char *)a_)[n], *b = &((char *)b_)[m];
+ size_t i = 0, len = n < m ? n : m;
+ for (; i < len && (--a, --b, tolower(*a) == tolower(*b)); i++);
+ return i;
+}
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char s[] = "abcdefgh", t[] = "ABCDEFGH";
+ size_t i, j;
+ assert(libsimple_memrcaseeqlen("x", 0, "x", 0) == 0);
+ assert(libsimple_memrcaseeqlen("x", 1, "x", 0) == 0);
+ assert(libsimple_memrcaseeqlen("x", 1, "y", 1) == 0);
+ assert(libsimple_memrcaseeqlen("y", 0, "y", 1) == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_memrcaseeqlen(&s[i], 8 - i, &t[j], 8 - j) == 8 - (i > j ? i : j));
+ assert(libsimple_memrcaseeqlen(s, i, t, j) == (i == j ? i : 0));
+ assert(libsimple_memrcaseeqlen(&t[i], 8 - i, &s[j], 8 - j) == 8 - (i > j ? i : j));
+ assert(libsimple_memrcaseeqlen(t, i, s, j) == (i == j ? i : 0));
+ }
+ }
+ assert(libsimple_memrcaseeqlen("abc", 3, "abc", 3) == 3);
+ assert(libsimple_memrcaseeqlen("123", 3, "123", 3) == 3);
+ return 0;
+}
+
+#endif
diff --git a/memreqlen.c b/memreqlen.c
new file mode 100644
index 0000000..c276b8d
--- /dev/null
+++ b/memreqlen.c
@@ -0,0 +1,39 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+size_t
+libsimple_memreqlen(const void *a_, size_t n, const void *b_, size_t m)
+{
+ const char *a = &((char *)a_)[n], *b = &((char *)b_)[m];
+ size_t i = 0, len = n < m ? n : m;
+ for (; i < len && *--a == *--b; i++);
+ return i;
+}
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char s[] = "abcdefgh", t[] = "abcdefgh";
+ size_t i, j;
+ assert(libsimple_memreqlen("x", 0, "x", 0) == 0);
+ assert(libsimple_memreqlen("x", 1, "x", 0) == 0);
+ assert(libsimple_memreqlen("x", 1, "y", 1) == 0);
+ assert(libsimple_memreqlen("y", 0, "y", 1) == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_memreqlen(&s[i], 8 - i, &t[j], 8 - j) == 8 - (i > j ? i : j));
+ assert(libsimple_memreqlen(s, i, t, j) == (i == j ? i : 0));
+ }
+ }
+ assert(libsimple_memreqlen("abc", 3, "ABC", 3) == 0);
+ assert(libsimple_memreqlen("123", 3, "123", 3) == 3);
+ return 0;
+}
+
+#endif
diff --git a/strcaseeqlen.c b/strcaseeqlen.c
new file mode 100644
index 0000000..625a3ad
--- /dev/null
+++ b/strcaseeqlen.c
@@ -0,0 +1,43 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+size_t
+libsimple_strcaseeqlen(const char *a, const char *b)
+{
+ size_t i = 0;
+ for (; tolower(a[i]) == tolower(b[i]) && a[i]; i++);
+ return i;
+}
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char s[] = "abcdefgh", t[] = "ABCDEFGH";
+ size_t i, j;
+ assert(libsimple_strcaseeqlen("", "") == 0);
+ assert(libsimple_strcaseeqlen("x", "") == 0);
+ assert(libsimple_strcaseeqlen("x", "y") == 0);
+ assert(libsimple_strcaseeqlen("", "y") == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_strcaseeqlen(&s[i], &t[j]) == (i == j ? 8 - i : 0));
+ assert(libsimple_strcaseeqlen(&t[i], &s[j]) == (i == j ? 8 - i : 0));
+ s[i] = t[j] = '\0';
+ assert(libsimple_strcaseeqlen(s, t) == (i < j ? i : j));
+ assert(libsimple_strcaseeqlen(t, s) == (i < j ? i : j));
+ s[i] = "abcdefgh"[i];
+ t[j] = "ABCDEFGH"[j];
+ }
+ }
+ assert(libsimple_strcaseeqlen("abc", "abc") == 3);
+ assert(libsimple_strcaseeqlen("123", "123") == 3);
+ return 0;
+}
+
+#endif
diff --git a/streqlen.c b/streqlen.c
new file mode 100644
index 0000000..d563ecc
--- /dev/null
+++ b/streqlen.c
@@ -0,0 +1,41 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+size_t
+libsimple_streqlen(const char *a, const char *b)
+{
+ size_t i = 0;
+ for (; a[i] == b[i] && a[i]; i++);
+ return i;
+}
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char s[] = "abcdefgh", t[] = "abcdefgh";
+ size_t i, j;
+ assert(libsimple_streqlen("", "") == 0);
+ assert(libsimple_streqlen("x", "") == 0);
+ assert(libsimple_streqlen("x", "y") == 0);
+ assert(libsimple_streqlen("", "y") == 0);
+ for (i = 0; i <= 8; i++) {
+ for (j = 0; j <= 8; j++) {
+ assert(libsimple_streqlen(&s[i], &t[j]) == (i == j ? 8 - i : 0));
+ s[i] = t[j] = '\0';
+ assert(libsimple_streqlen(s, t) == (i < j ? i : j));
+ s[i] = "abcdefgh"[i];
+ t[j] = "abcdefgh"[j];
+ }
+ }
+ assert(libsimple_streqlen("abc", "ABC") == 0);
+ assert(libsimple_streqlen("123", "123") == 3);
+ return 0;
+}
+
+#endif