From c7541bd6725c6c8e7322b767dbc02314c43ac2b0 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Fri, 27 Aug 2004 04:21:09 +0000 Subject: Merge "show applications" from corydon76 (bug #2291) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3665 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- utils.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'utils.c') diff --git a/utils.c b/utils.c index c1a03be5f..756cdfd19 100755 --- a/utils.c +++ b/utils.c @@ -9,6 +9,9 @@ * the GNU General Public License */ +#ifdef Linux /* For strcasestr */ +#define __USE_GNU +#endif #include #include #include @@ -20,6 +23,7 @@ #include #include #include +#include static char base64[64]; static char b2a[256]; @@ -363,3 +367,46 @@ int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_ro return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */ } #endif /* ! LINUX */ + +static char *upper(const char *orig, char *buf, int bufsize) +{ + int i; + memset(buf, 0, bufsize); + for (i=0; i u1len) { + /* Needle bigger than haystack */ + return NULL; + } + offset = strstr(upper(haystack, u1, u1len), upper(needle, u2, u2len)); + if (offset) { + /* Return the offset into the original string */ + return ((char *)((unsigned int)haystack + (unsigned int)(offset - u1))); + } else { + return NULL; + } + } else { + ast_log(LOG_ERROR, "Out of memory\n"); + return NULL; + } +} +#endif + -- cgit v1.2.3