aboutsummaryrefslogtreecommitdiffstats
path: root/strcaseends.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-11-12 16:16:33 +0100
committerMattias Andrée <maandree@kth.se>2017-11-12 16:16:33 +0100
commit8cef2ca2598cfd0587faf29d0025d68c7dc598ea (patch)
treeee4737fed27a213869eb5ca005194cadf24b9cd2 /strcaseends.c
parentSplit into multiple units (diff)
downloadlibsimple-8cef2ca2598cfd0587faf29d0025d68c7dc598ea.tar.gz
libsimple-8cef2ca2598cfd0587faf29d0025d68c7dc598ea.tar.bz2
libsimple-8cef2ca2598cfd0587faf29d0025d68c7dc598ea.tar.xz
m + add readme
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'strcaseends.c')
-rw-r--r--strcaseends.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/strcaseends.c b/strcaseends.c
new file mode 100644
index 0000000..a672b0a
--- /dev/null
+++ b/strcaseends.c
@@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+
+
+int
+libsimple_strcaseends(const char *s, const char *t)
+{
+ size_t sn = strlen(s);
+ size_t tn = strlen(t);
+ if (tn > sn)
+ return 0;
+ return !strcasecmp(&s[sn - tn], t);
+}