diff options
author | portix <portix@gmx.net> | 2011-09-02 15:49:09 +0200 |
---|---|---|
committer | portix <portix@gmx.net> | 2011-09-02 15:49:09 +0200 |
commit | 8f4a57d7d10aaf52b48d717a3bd272474847863b (patch) | |
tree | 19c5873cafcd41cc220bd8bf71b24f021769ae30 /src/util.c | |
parent | fa7f2b3198e15e88721da46cff1f9b00ac35685c (diff) | |
download | dwb-8f4a57d7d10aaf52b48d717a3bd272474847863b.zip |
Case insensitive completion
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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; +} |