aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libsimple/str.h93
-rw-r--r--libsimple/strn.h7
-rw-r--r--man/libsimple_strcaseends.371
-rw-r--r--man/libsimple_strcasestarts.373
-rw-r--r--man/libsimple_strcasestr.374
-rw-r--r--man/libsimple_strchrnul.376
-rw-r--r--man/libsimple_strend.369
-rw-r--r--man/libsimple_strends.371
-rw-r--r--man/libsimple_strrcasestr.374
-rw-r--r--man/libsimple_strrstr.374
-rw-r--r--man/libsimple_strstarts.373
l---------man/strcasecmpnul.3libsimple1
l---------man/strcaseends.3libsimple1
l---------man/strcaseeq.3libsimple1
l---------man/strcaseeqnul.3libsimple1
l---------man/strcasestarts.3libsimple1
l---------man/strcasestr.3libsimple1
l---------man/strchrnul.3libsimple1
l---------man/strcmpnul.3libsimple1
l---------man/strend.3libsimple1
l---------man/strends.3libsimple1
l---------man/streq.3libsimple1
l---------man/streqnul.3libsimple1
l---------man/strrcasestr.3libsimple1
l---------man/strrstr.3libsimple1
l---------man/strstarts.3libsimple1
-rw-r--r--strchrnul.c6
27 files changed, 773 insertions, 3 deletions
diff --git a/libsimple/str.h b/libsimple/str.h
index cacec57..5eaee4e 100644
--- a/libsimple/str.h
+++ b/libsimple/str.h
@@ -1,11 +1,36 @@
/* See LICENSE file for copyright and license details. */
+
+/* TODO strcasechr */
+/* TODO strcasechrnul */
+/* TODO strrcasechr */
+/* TODO stpcmp */
+/* TODO stpcmpnul */
+/* TODO stpcasecmp */
+/* TODO stpcasecmpnul */
+
+
+/**
+ * Scans for a character in a string, the scan is case-sensitive
+ *
+ * @param s The string to scan
+ * @param c The character for scan for
+ * @return `s` with a minimal offset such that `*r == c || !*r`,
+ * where `r` is the returned pointer
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strchrnul(const char *, int);
#ifndef strchrnul
# define strchrnul libsimple_strchrnul
#endif
+
+/**
+ * Scans for the end of a string
+ *
+ * @param s The string
+ * @return `s` with an offset such `!*r`, where `r` is the returned pointer
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
static inline char *libsimple_strend(const char *__s)
{ return strchr(__s, '\0'); }
@@ -13,12 +38,28 @@ static inline char *libsimple_strend(const char *__s)
# define strend libsimple_strend
#endif
+
+/**
+ * Checks the beginning of a string, the comparison is case-sensitive
+ *
+ * @param s The string the check
+ * @param t The string `s` should begin with
+ * @return 1 if `s` starts with `t`, 0 otherwise
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strstarts(const char *, const char *);
#ifndef strstarts
# define strstarts libsimple_strstarts
#endif
+
+/**
+ * Checks the beginning of a string, the comparison is case-insensitive
+ *
+ * @param s The string the check
+ * @param t The string `s` should begin with
+ * @return 1 if `s` starts with `t`, 0 otherwise
+ */
_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)); }
@@ -26,36 +67,83 @@ static inline int libsimple_strcasestarts(const char *__s, const char *__t)
# define strcasestarts libsimple_strcasestarts
#endif
+
+/**
+ * Checks the end of a string, the comparison is case-sensitive
+ *
+ * @param s The string the check
+ * @param t The string `s` should begin with
+ * @return 1 if `s` ends with `t`, 0 otherwise
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strends(const char *, const char *);
#ifndef strends
# define strends libsimple_strends
#endif
+
+/**
+ * Checks the end of a string, the comparison is case-insensitive
+ *
+ * @param s The string the check
+ * @param t The string `s` should begin with
+ * @return 1 if `s` end with `t`, 0 otherwise
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strcaseends(const char *, const char *);
#ifndef strcaseends
# define strcaseends libsimple_strcaseends
#endif
+
+/**
+ * Scans a string for a substring, the comparison is case-sensitive
+ *
+ * @param haystack The string to search
+ * @param needle The string to search for
+ * @return `haystack` with a maximal offset such that the returned
+ * pointer begins with `needle`, `NULL` if no such offset
+ * exists
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrstr(const char *, const char *);
#ifndef strrstr
# define strrstr libsimple_strrstr
#endif
+
+/**
+ * Scans a string for a substring, the comparison is case-insensitive
+ *
+ * @param haystack The string to search
+ * @param needle The string to search for
+ * @return `haystack` with a minimal offset such that the returned
+ * pointer begins with `needle`, `NULL` if no such offset
+ * exists
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strcasestr(const char *, const char *);
#ifndef strcasestr
# define strcasestr libsimple_strcasestr
#endif
+
+/**
+ * Scans a string for a substring, the comparison is case-insensitive
+ *
+ * @param haystack The string to search
+ * @param needle The string to search for
+ * @return `haystack` with a maximal offset such that the returned
+ * pointer begins with `needle`, `NULL` if no such offset
+ * exists
+ */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrcasestr(const char *, const char *);
#ifndef strrcasestr
# define strrcasestr libsimple_strrcasestr
#endif
+
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
static inline int libsimple_strcmpnul(const char *__a, const char *__b)
{ return (!__a || !__b) ? !__b - !__a : strcmp(__a, __b); }
@@ -63,6 +151,7 @@ static inline int libsimple_strcmpnul(const char *__a, const char *__b)
# define strcmpnul libsimple_strcmpnul
#endif
+
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
static inline int libsimple_strcasecmpnul(const char *__a, const char *__b)
{ return (!__a || !__b) ? !__b - !__a : strcasecmp(__a, __b); }
@@ -70,6 +159,7 @@ static inline int libsimple_strcasecmpnul(const char *__a, const char *__b)
# define strcasecmpnul libsimple_strcasecmpnul
#endif
+
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
static inline int libsimple_streq(const char *__a, const char *__b)
{ return !strcmp(__a, __b); }
@@ -77,6 +167,7 @@ static inline int libsimple_streq(const char *__a, const char *__b)
# define streq libsimple_streq
#endif
+
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
static inline int libsimple_streqnul(const char *__a, const char *__b)
{ return !strcmpnul(__a, __b); }
@@ -84,6 +175,7 @@ static inline int libsimple_streqnul(const char *__a, const char *__b)
# define streqnul libsimple_streqnul
#endif
+
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
static inline int libsimple_strcaseeq(const char *__a, const char *__b)
{ return !strcasecmp(__a, __b); }
@@ -91,6 +183,7 @@ static inline int libsimple_strcaseeq(const char *__a, const char *__b)
# define strcaseeq libsimple_strcaseeq
#endif
+
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__)))
static inline int libsimple_strcaseeqnul(const char *__a, const char *__b)
{ return !strcasecmpnul(__a, __b); }
diff --git a/libsimple/strn.h b/libsimple/strn.h
index e2dffdb..81d3797 100644
--- a/libsimple/strn.h
+++ b/libsimple/strn.h
@@ -1,11 +1,18 @@
/* See LICENSE file for copyright and license details. */
+/* TODO strncasechr */
+/* TODO strncasechrnul */
+/* TODO strrncasechr */
/* TODO strnchrnul */
/* TODO strnend */
/* TODO strnstarts */
/* TODO strncasestarts */
/* TODO strnends */
/* TODO strncaseends */
+/* TODO stpncmp */
+/* TODO stpncmpnul */
+/* TODO stpncasecmp */
+/* TODO stpncasecmpnul */
_LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strnstr(const char *, const char *, size_t);
diff --git a/man/libsimple_strcaseends.3 b/man/libsimple_strcaseends.3
new file mode 100644
index 0000000..2d26307
--- /dev/null
+++ b/man/libsimple_strcaseends.3
@@ -0,0 +1,71 @@
+.TH LIBSIMPLE_STRCASEENDS 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strcaseends \- check the beginning of a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+int libsimple_strcaseends(const char *\fIs\fP, const char *\fIt\fP);
+
+#ifndef strcaseends
+# define strcaseends libsimple_strcaseends
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strcaseends ()
+function checks whether the string
+.I s
+ends with the string
+.IR t .
+.SH RETURN VALUE
+The
+.BR libsimple_strcaseends ()
+function returns 1 if the string
+.I s
+ends with the string
+.IR t ,
+otherwise it returns 0.
+.PP
+The comparison is case-insensitive.
+.SH ERRORS
+The
+.BR libsimple_strcaseends ()
+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_strcaseends ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strcaseends ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strcaseends ()
+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_strends (3),
+.BR libsimple_strcasestarts (3),
+.BR libsimple_strrcasestr (3),
diff --git a/man/libsimple_strcasestarts.3 b/man/libsimple_strcasestarts.3
new file mode 100644
index 0000000..625edcb
--- /dev/null
+++ b/man/libsimple_strcasestarts.3
@@ -0,0 +1,73 @@
+.TH LIBSIMPLE_STRCASESTARTS 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strcasestarts \- check the beginning of a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+static inline int libsimple_strcasestarts(const char *\fIs\fP, const char *\fIt\fP);
+
+#ifndef strcasestarts
+# define strcasestarts libsimple_strcasestarts
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strcasestarts ()
+function checks whether the string
+.I s
+starts with the string
+.IR t .
+.SH RETURN VALUE
+The
+.BR libsimple_strcasestarts ()
+function returns 1 if the string
+.I s
+begins with the string
+.IR t ,
+otherwise it returns 0.
+.PP
+The comparison is case-insensitive.
+.SH ERRORS
+The
+.BR libsimple_strcasestarts ()
+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_strcasestarts ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strcasestarts ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strcasestarts ()
+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_strstarts (3),
+.BR libsimple_strcaseends (3),
+.BR libsimple_strcasestr (3),
+.BR strcasecmp (3),
+.BR strncasecmp (3)
diff --git a/man/libsimple_strcasestr.3 b/man/libsimple_strcasestr.3
new file mode 100644
index 0000000..c4d7aab
--- /dev/null
+++ b/man/libsimple_strcasestr.3
@@ -0,0 +1,74 @@
+.TH LIBSIMPLE_STRCASESTR 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strcasestr \- find a substring in a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+char *libsimple_strcasestr(const char *\fIhaystack\fP, const char *\fIneedle\fP);
+
+#ifndef strcasestr
+# define strcasestr libsimple_strcasestr
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strcasestr ()
+function scans the string
+.I haystack
+the first occurrence of the substring
+.IR needle .
+.SH RETURN VALUE
+The
+.BR libsimple_strcasestr ()
+function returns the pointer
+.I haystack
+with a minimal offset such that
+.I !*r
+begins with
+.IR needle ,
+where
+.I r
+is the returned pointer.
+.PP
+The comparison is case-insensitive.
+.SH ERRORS
+The
+.BR libsimple_strcasestr ()
+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_strcasestr ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strcasestr ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strcasestr ()
+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_strrcasestr (3),
+.BR strstr (3)
diff --git a/man/libsimple_strchrnul.3 b/man/libsimple_strchrnul.3
new file mode 100644
index 0000000..25d6618
--- /dev/null
+++ b/man/libsimple_strchrnul.3
@@ -0,0 +1,76 @@
+.TH LIBSIMPLE_STRCHRNUL 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strchrnul \- find a character in a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+char *libsimple_strchrnul(const char *\fIs\fP, int \fIc\fP);
+
+#ifndef strchrnul
+# define strchrnul libsimple_strchrnul
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strchrnul ()
+function scans the string
+.I s
+for the first occurence of the character
+.I c
+(it is converted to a
+.BR char ).
+If no such character exist in the string,
+the string's end is returned.
+.PP
+The comparison is case-sensitive.
+.SH RETURN VALUE
+The
+.BR libsimple_strchrnul ()
+function returns the pointer
+.I s
+with a minimal offset such that
+.IR *r==c||!*r ,
+where
+.I r
+is the returned pointer.
+.SH ERRORS
+The
+.BR libsimple_strchrnul ()
+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_strchrnul ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strchrnul ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strchrnul ()
+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_strend (3),
+.BR strchr (3)
diff --git a/man/libsimple_strend.3 b/man/libsimple_strend.3
new file mode 100644
index 0000000..1ceb9ac
--- /dev/null
+++ b/man/libsimple_strend.3
@@ -0,0 +1,69 @@
+.TH LIBSIMPLE_STREND 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strend \- find a character in a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+static inline char *libsimple_strend(const char *\fIs\fP);
+
+#ifndef strend
+# define strend libsimple_strend
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strend ()
+function scans the string
+.I s
+for its end.
+.SH RETURN VALUE
+The
+.BR libsimple_strend ()
+function returns the pointer
+.I s
+with an offset such that
+.IR !*r ,
+where
+.I r
+is the returned pointer.
+.SH ERRORS
+The
+.BR libsimple_strend ()
+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_strend ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strend ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strend ()
+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_strchrnul (3),
+.BR strchr (3)
diff --git a/man/libsimple_strends.3 b/man/libsimple_strends.3
new file mode 100644
index 0000000..63085ec
--- /dev/null
+++ b/man/libsimple_strends.3
@@ -0,0 +1,71 @@
+.TH LIBSIMPLE_STRENDS 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strends \- check the beginning of a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+int libsimple_strends(const char *\fIs\fP, const char *\fIt\fP);
+
+#ifndef strends
+# define strends libsimple_strends
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strends ()
+function checks whether the string
+.I s
+ends with the string
+.IR t .
+.SH RETURN VALUE
+The
+.BR libsimple_strends ()
+function returns 1 if the string
+.I s
+ends with the string
+.IR t ,
+otherwise it returns 0.
+.PP
+The comparison is case-sensitive.
+.SH ERRORS
+The
+.BR libsimple_strends ()
+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_strends ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strends ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strends ()
+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_strcaseends (3),
+.BR libsimple_strstarts (3),
+.BR libsimple_strrstr (3),
diff --git a/man/libsimple_strrcasestr.3 b/man/libsimple_strrcasestr.3
new file mode 100644
index 0000000..187a784
--- /dev/null
+++ b/man/libsimple_strrcasestr.3
@@ -0,0 +1,74 @@
+.TH LIBSIMPLE_STRRCASESTR 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strrcasestr \- find a substring in a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+char *libsimple_strrcasestr(const char *\fIhaystack\fP, const char *\fIneedle\fP);
+
+#ifndef strrcasestr
+# define strrcasestr libsimple_strrcasestr
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strrcasestr ()
+function scans the string
+.I haystack
+the last occurrence of the substring
+.IR needle .
+.SH RETURN VALUE
+The
+.BR libsimple_strrcasestr ()
+function returns the pointer
+.I haystack
+with a maximal offset such that
+.I !*r
+begins with
+.IR needle ,
+where
+.I r
+is the returned pointer.
+.PP
+The comparison is case-insensitive.
+.SH ERRORS
+The
+.BR libsimple_strrcasestr ()
+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_strrcasestr ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strrcasestr ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strrcasestr ()
+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_strrstr (3),
+.BR libsimple_strcasestr (3)
diff --git a/man/libsimple_strrstr.3 b/man/libsimple_strrstr.3
new file mode 100644
index 0000000..9806a2c
--- /dev/null
+++ b/man/libsimple_strrstr.3
@@ -0,0 +1,74 @@
+.TH LIBSIMPLE_STRRSTR 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strrstr \- find a substring in a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+char *libsimple_strrstr(const char *\fIhaystack\fP, const char *\fIneedle\fP);
+
+#ifndef strrstr
+# define strrstr libsimple_strrstr
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strrstr ()
+function scans the string
+.I haystack
+the last occurrence of the substring
+.IR needle .
+.SH RETURN VALUE
+The
+.BR libsimple_strrstr ()
+function returns the pointer
+.I haystack
+with a maximal offset such that
+.I !*r
+begins with
+.IR needle ,
+where
+.I r
+is the returned pointer.
+.PP
+The comparison is case-sensitive.
+.SH ERRORS
+The
+.BR libsimple_strrstr ()
+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_strrstr ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strrstr ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strrstr ()
+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_strrcasestr (3),
+.BR strstr (3)
diff --git a/man/libsimple_strstarts.3 b/man/libsimple_strstarts.3
new file mode 100644
index 0000000..128c4af
--- /dev/null
+++ b/man/libsimple_strstarts.3
@@ -0,0 +1,73 @@
+.TH LIBSIMPLE_STRSTARTS 3 2018-10-21 libsimple
+.SH NAME
+libsimple_strstarts \- check the beginning of a string
+.SH SYNOPSIS
+.nf
+#include <libsimple.h>
+
+int libsimple_strstarts(const char *\fIs\fP, const char *\fIt\fP);
+
+#ifndef strstarts
+# define strstarts libsimple_strstarts
+#endif
+.fi
+
+Link with
+.IR \-lsimple .
+.SH DESCRIPTION
+The
+.BR libsimple_strstarts ()
+function checks whether the string
+.I s
+starts with the string
+.IR t .
+.SH RETURN VALUE
+The
+.BR libsimple_strstarts ()
+function returns 1 if the string
+.I s
+begins with the string
+.IR t ,
+otherwise it returns 0.
+.PP
+The comparison is case-sensitive.
+.SH ERRORS
+The
+.BR libsimple_strstarts ()
+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_strstarts ()
+T} Thread safety MT-Safe
+T{
+.BR libsimple_strstarts ()
+T} Async-signal safety AS-Safe
+T{
+.BR libsimple_strstarts ()
+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_strcasestarts (3),
+.BR libsimple_strends (3),
+.BR strstr (3),
+.BR strcmp (3),
+.BR strncmp (3)
diff --git a/man/strcasecmpnul.3libsimple b/man/strcasecmpnul.3libsimple
new file mode 120000
index 0000000..e356b28
--- /dev/null
+++ b/man/strcasecmpnul.3libsimple
@@ -0,0 +1 @@
+libsimple_strcasecmpnul.3 \ No newline at end of file
diff --git a/man/strcaseends.3libsimple b/man/strcaseends.3libsimple
new file mode 120000
index 0000000..c363f5d
--- /dev/null
+++ b/man/strcaseends.3libsimple
@@ -0,0 +1 @@
+libsimple_strcaseends.3 \ No newline at end of file
diff --git a/man/strcaseeq.3libsimple b/man/strcaseeq.3libsimple
new file mode 120000
index 0000000..2f51780
--- /dev/null
+++ b/man/strcaseeq.3libsimple
@@ -0,0 +1 @@
+libsimple_strcaseeq.3 \ No newline at end of file
diff --git a/man/strcaseeqnul.3libsimple b/man/strcaseeqnul.3libsimple
new file mode 120000
index 0000000..902badb
--- /dev/null
+++ b/man/strcaseeqnul.3libsimple
@@ -0,0 +1 @@
+libsimple_strcaseeqnul.3 \ No newline at end of file
diff --git a/man/strcasestarts.3libsimple b/man/strcasestarts.3libsimple
new file mode 120000
index 0000000..c2619f3
--- /dev/null
+++ b/man/strcasestarts.3libsimple
@@ -0,0 +1 @@
+libsimple_strcasestarts.3 \ No newline at end of file
diff --git a/man/strcasestr.3libsimple b/man/strcasestr.3libsimple
new file mode 120000
index 0000000..7ba4049
--- /dev/null
+++ b/man/strcasestr.3libsimple
@@ -0,0 +1 @@
+libsimple_strcasestr.3 \ No newline at end of file
diff --git a/man/strchrnul.3libsimple b/man/strchrnul.3libsimple
new file mode 120000
index 0000000..78ebcea
--- /dev/null
+++ b/man/strchrnul.3libsimple
@@ -0,0 +1 @@
+libsimple_strchrnul.3 \ No newline at end of file
diff --git a/man/strcmpnul.3libsimple b/man/strcmpnul.3libsimple
new file mode 120000
index 0000000..4cb5905
--- /dev/null
+++ b/man/strcmpnul.3libsimple
@@ -0,0 +1 @@
+libsimple_strcmpnul.3 \ No newline at end of file
diff --git a/man/strend.3libsimple b/man/strend.3libsimple
new file mode 120000
index 0000000..0bf4a76
--- /dev/null
+++ b/man/strend.3libsimple
@@ -0,0 +1 @@
+libsimple_strend.3 \ No newline at end of file
diff --git a/man/strends.3libsimple b/man/strends.3libsimple
new file mode 120000
index 0000000..21f71aa
--- /dev/null
+++ b/man/strends.3libsimple
@@ -0,0 +1 @@
+libsimple_strends.3 \ No newline at end of file
diff --git a/man/streq.3libsimple b/man/streq.3libsimple
new file mode 120000
index 0000000..7ad81c1
--- /dev/null
+++ b/man/streq.3libsimple
@@ -0,0 +1 @@
+libsimple_streq.3 \ No newline at end of file
diff --git a/man/streqnul.3libsimple b/man/streqnul.3libsimple
new file mode 120000
index 0000000..4f3547a
--- /dev/null
+++ b/man/streqnul.3libsimple
@@ -0,0 +1 @@
+libsimple_streqnul.3 \ No newline at end of file
diff --git a/man/strrcasestr.3libsimple b/man/strrcasestr.3libsimple
new file mode 120000
index 0000000..7c5ce07
--- /dev/null
+++ b/man/strrcasestr.3libsimple
@@ -0,0 +1 @@
+libsimple_strrcasestr.3 \ No newline at end of file
diff --git a/man/strrstr.3libsimple b/man/strrstr.3libsimple
new file mode 120000
index 0000000..c9f34e7
--- /dev/null
+++ b/man/strrstr.3libsimple
@@ -0,0 +1 @@
+libsimple_strrstr.3 \ No newline at end of file
diff --git a/man/strstarts.3libsimple b/man/strstarts.3libsimple
new file mode 120000
index 0000000..2b6b62f
--- /dev/null
+++ b/man/strstarts.3libsimple
@@ -0,0 +1 @@
+libsimple_strstarts.3 \ No newline at end of file
diff --git a/strchrnul.c b/strchrnul.c
index 77634c0..3ec6a0f 100644
--- a/strchrnul.c
+++ b/strchrnul.c
@@ -4,10 +4,10 @@
char *
-libsimple_strchrnul(const char *s_, int c)
+libsimple_strchrnul(const char *s_, char c_)
{
- char *s = *(char **)(void *)&s_;
- for (; *s && (int)*s != c; s++);
+ char *s = *(char **)(void *)&s_, c = (char)c_;
+ for (; *s && *s != c; s++);
return s;
}