chiark / gitweb /
udev: builtin-keyboard: add support for EVDEV_ABS_*
[elogind.git] / src / shared / util.c
index 72984735ced828e33c2eca18df7828fdf1db58c9..392c42ba2be4280ba0284f0ccbe6449a75ad1c1c 100644 (file)
@@ -151,6 +151,27 @@ char* endswith(const char *s, const char *postfix) {
         return (char*) s + sl - pl;
 }
 
+char* endswith_no_case(const char *s, const char *postfix) {
+        size_t sl, pl;
+
+        assert(s);
+        assert(postfix);
+
+        sl = strlen(s);
+        pl = strlen(postfix);
+
+        if (pl == 0)
+                return (char*) s + sl;
+
+        if (sl < pl)
+                return NULL;
+
+        if (strcasecmp(s + sl - pl, postfix) != 0)
+                return NULL;
+
+        return (char*) s + sl - pl;
+}
+
 char* first_word(const char *s, const char *word) {
         size_t sl, wl;
         const char *p;