From a98bbe8e03233ce3388bf72b7ae19823dbc9fc09 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 26 Nov 2002 20:04:15 +0000 Subject: temp fix for strcasestr --- src/FbTk/XmbFontImp.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc index f0c323d..c9a87d0 100644 --- a/src/FbTk/XmbFontImp.cc +++ b/src/FbTk/XmbFontImp.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XmbFontImp.cc,v 1.1 2002/11/26 16:01:28 fluxgen Exp $ +// $Id: XmbFontImp.cc,v 1.2 2002/11/26 20:04:15 fluxgen Exp $ #include "XmbFontImp.hh" @@ -44,6 +44,23 @@ using namespace std; namespace { +#ifndef HAVE_STRCASESTR +// +// Tries to find a string in another and +// ignoring the case of the characters +// Returns 0 on success else pointer to str. +const char *strcasestr(const char *str, const char *ptn) { + const char *s2, *p2; + for( ; *str; str++) { + for(s2=str, p2=ptn; ; s2++,p2++) { + if (!*p2) return str; // check if we reached the end of ptn, if so, return str + if (toupper(*s2) != toupper(*p2)) break; // check if the chars match(ignoring case) + } + } + return 0; +} +#endif //HAVE_STRCASESTR + const char *getFontSize(const char *pattern, int *size) { const char *p; const char *p2=0; @@ -80,7 +97,7 @@ const char *getFontElement(const char *pattern, char *buf, int bufsiz, ...) { buf[bufsiz-1] = 0; buf[bufsiz-2] = '*'; while((v = va_arg(va, char *)) != 0) { - p = strcasestr(pattern, v); + p = ::strcasestr(pattern, v); if (p) { std::strncpy(buf, p+1, bufsiz-2); p2 = strchr(buf, '-'); -- cgit v0.11.2