summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2011-09-02 15:49:09 +0200
committerportix <portix@gmx.net>2011-09-02 15:49:09 +0200
commit8f4a57d7d10aaf52b48d717a3bd272474847863b (patch)
tree19c5873cafcd41cc220bd8bf71b24f021769ae30 /src/util.c
parentfa7f2b3198e15e88721da46cff1f9b00ac35685c (diff)
downloaddwb-8f4a57d7d10aaf52b48d717a3bd272474847863b.zip
Case insensitive completion
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 6a4048b9..ecadd19d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -515,3 +515,15 @@ gtk_box_insert(GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, gi
gtk_box_pack_start(box, child, expand, fill, padding);
gtk_box_reorder_child(box, child, position);
}
+char *
+dwb_util_strcasestr(const char *haystack, const char *needle) {
+ for (; *haystack; haystack++) {
+ if (tolower(*haystack) == tolower(*needle)) {
+ const char *h = haystack, *n = needle;
+ for (; *h && *n && tolower(*h) == tolower(*n); ++h, ++n);
+ if (! *n )
+ return (char*)haystack;
+ }
+ }
+ return NULL;
+}