summaryrefslogtreecommitdiff
path: root/epan/strutil.c
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2007-02-07 13:45:28 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2007-02-07 13:45:28 +0000
commit92fd73681d3288b4d89b66d99023a8f116b8bed6 (patch)
tree3c64cc0160f837e43ec1bf7772829e61c4ae0e67 /epan/strutil.c
parentbc2ca610836d19dfc506e484abc3dba07e37a522 (diff)
downloadwireshark-92fd73681d3288b4d89b66d99023a8f116b8bed6.tar.gz
From: Gisle Vanem
The file epan/dissectors/packet-k12.c uses the function strcasestr() which is not available on e.g. Windows. So I cooked up a patch to epan/strutil.c to add epan_strcasestr() (is there a more suited place for such a function?) svn path=/trunk/; revision=20734
Diffstat (limited to 'epan/strutil.c')
-rw-r--r--epan/strutil.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/epan/strutil.c b/epan/strutil.c
index 365b4e5594..cc8f2c4fab 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -966,3 +966,17 @@ g_strlcat(gchar *dst, gchar *src, gsize size)
return strl+strs;
}
#endif
+
+char *
+epan_strcasestr(const char *haystack, const char *needle)
+{
+ gsize hlen = strlen(haystack);
+ gsize nlen = strlen(needle);
+
+ while (hlen-- >= nlen) {
+ if (!g_strncasecmp(haystack, needle, nlen))
+ return (char*) haystack;
+ haystack++;
+ }
+ return NULL;
+}